summaryrefslogtreecommitdiffhomepage
path: root/test/unit
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2022-08-25 15:50:49 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2022-08-25 15:50:49 +0100
commitd1cb8ab2bb27a864ec6cb21c5e64af315266100d (patch)
tree455d15d3fabde9f027081ec487d834a04add3d73 /test/unit
parent7e4a8a54221adf00cd3eb45a24b633ce61400570 (diff)
downloadunit-d1cb8ab2bb27a864ec6cb21c5e64af315266100d.tar.gz
unit-d1cb8ab2bb27a864ec6cb21c5e64af315266100d.tar.bz2
Tests: added tests with abstract UNIX sockets.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/check/unix_abstract.py25
-rw-r--r--test/unit/http.py2
2 files changed, 26 insertions, 1 deletions
diff --git a/test/unit/check/unix_abstract.py b/test/unit/check/unix_abstract.py
new file mode 100644
index 00000000..5d1f629e
--- /dev/null
+++ b/test/unit/check/unix_abstract.py
@@ -0,0 +1,25 @@
+import json
+
+from unit.http import TestHTTP
+from unit.option import option
+
+http = TestHTTP()
+
+
+def check_unix_abstract():
+ available = option.available
+
+ resp = http.put(
+ url='/config',
+ sock_type='unix',
+ addr=option.temp_dir + '/control.unit.sock',
+ body=json.dumps(
+ {
+ "listeners": {"unix:@sock": {"pass": "routes"}},
+ "routes": [],
+ }
+ ),
+ )
+
+ if 'success' in resp['body']:
+ available['features']['unix_abstract'] = True
diff --git a/test/unit/http.py b/test/unit/http.py
index 522d2ea6..b29667c9 100644
--- a/test/unit/http.py
+++ b/test/unit/http.py
@@ -51,7 +51,7 @@ class TestHTTP:
connect_args = addr if sock_type == 'unix' else (addr, port)
try:
sock.connect(connect_args)
- except ConnectionRefusedError:
+ except (ConnectionRefusedError, FileNotFoundError):
sock.close()
pytest.fail('Client can\'t connect to the server.')