From d1cb8ab2bb27a864ec6cb21c5e64af315266100d Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 25 Aug 2022 15:50:49 +0100 Subject: Tests: added tests with abstract UNIX sockets. --- test/test_configuration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/test_configuration.py') diff --git a/test/test_configuration.py b/test/test_configuration.py index 4a9d9840..75fbb845 100644 --- a/test/test_configuration.py +++ b/test/test_configuration.py @@ -2,6 +2,7 @@ import socket import pytest from unit.control import TestControl +from unit.option import option class TestConfiguration(TestControl): @@ -226,6 +227,21 @@ class TestConfiguration(TestControl): {"*:7080": {"pass": "applications/app"}}, 'listeners' ), 'listeners no app' + def test_listeners_unix_abstract(self): + if option.system != 'Linux': + assert 'error' in self.conf( + {"unix:@sock": {"pass": "routes"}}, 'listeners' + ), 'unix abstract at' + + pytest.skip('not yet') + + assert 'error' in self.conf( + {"unix:\0sock": {"pass": "routes"}}, 'listeners' + ), 'unix abstract zero' + assert 'error' in self.conf( + {"unix:\u0000sock": {"pass": "routes"}}, 'listeners' + ), 'unix abstract zero unicode' + def test_listeners_addr(self): assert 'success' in self.try_addr("*:7080"), 'wildcard' assert 'success' in self.try_addr("127.0.0.1:7081"), 'explicit' -- cgit From c65e04682e85cc708b534863ae8f4e069ccccf64 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 7 Sep 2022 01:11:04 +0100 Subject: Tests: minor fixes. --- test/test_configuration.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'test/test_configuration.py') diff --git a/test/test_configuration.py b/test/test_configuration.py index 75fbb845..7c612db0 100644 --- a/test/test_configuration.py +++ b/test/test_configuration.py @@ -229,18 +229,12 @@ class TestConfiguration(TestControl): def test_listeners_unix_abstract(self): if option.system != 'Linux': - assert 'error' in self.conf( - {"unix:@sock": {"pass": "routes"}}, 'listeners' - ), 'unix abstract at' + assert 'error' in self.try_addr("unix:@sock"), 'abstract at' pytest.skip('not yet') - assert 'error' in self.conf( - {"unix:\0sock": {"pass": "routes"}}, 'listeners' - ), 'unix abstract zero' - assert 'error' in self.conf( - {"unix:\u0000sock": {"pass": "routes"}}, 'listeners' - ), 'unix abstract zero unicode' + assert 'error' in self.try_addr("unix:\0soc"), 'abstract \0' + assert 'error' in self.try_addr("unix:\u0000soc"), 'abstract \0 unicode' def test_listeners_addr(self): assert 'success' in self.try_addr("*:7080"), 'wildcard' -- cgit