From 8f6e6086cb7bceeff6eec7cf0a2e3ff94f8d7705 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 20 Apr 2020 14:04:55 +0100 Subject: Tests: skips adjusted. --- test/test_proxy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/test_proxy.py') diff --git a/test/test_proxy.py b/test/test_proxy.py index 74bd0873..b539d5f6 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -601,8 +601,14 @@ Content-Length: 10 'proxy ipv6 invalid 4', ) - @unittest.skip('not yet') def test_proxy_loop(self): + self.skip_alerts.extend( + [ + r'socket.*failed', + r'accept.*failed', + r'new connections are not accepted', + ] + ) self.conf( { "listeners": { @@ -625,6 +631,7 @@ Content-Length: 10 ) self.get_http10(no_recv=True) + self.get_http10(read_timeout=1) if __name__ == '__main__': TestProxy.main() -- cgit From 6a9a4fe0d46263d4d158803d4a82851e240e0e63 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Fri, 24 Apr 2020 05:08:56 +0100 Subject: Tests: introduced module version specification in prerequisites. --- test/test_proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/test_proxy.py') diff --git a/test/test_proxy.py b/test/test_proxy.py index b539d5f6..852e970f 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython class TestProxy(TestApplicationPython): - prerequisites = {'modules': ['python']} + prerequisites = {'modules': {'python': 'any'}} SERVER_PORT = 7999 -- cgit From cf73fb809395da2a97e4a11a1185647e1d2b1d3d Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Fri, 15 May 2020 04:20:45 +0100 Subject: Tests: test_proxy_invalid simplified. --- test/test_proxy.py | 99 +++++++++++------------------------------------------- 1 file changed, 20 insertions(+), 79 deletions(-) (limited to 'test/test_proxy.py') diff --git a/test/test_proxy.py b/test/test_proxy.py index 852e970f..c163b14d 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -521,85 +521,26 @@ Content-Length: 10 self.assertEqual(len(resp['body']), 10, 'body gt Content-Length 15') def test_proxy_invalid(self): - self.assertIn( - 'error', - self.conf([{"action": {"proxy": 'blah'}}], 'routes'), - 'proxy invalid', - ) - self.assertIn( - 'error', - self.conf([{"action": {"proxy": '/blah'}}], 'routes'), - 'proxy invalid 2', - ) - self.assertIn( - 'error', - self.conf([{"action": {"proxy": 'unix:/blah'}}], 'routes'), - 'proxy unix invalid 2', - ) - self.assertIn( - 'error', - self.conf([{"action": {"proxy": 'http://blah'}}], 'routes'), - 'proxy unix invalid 3', - ) - self.assertIn( - 'error', - self.conf([{"action": {"proxy": 'http://127.0.0.1'}}], 'routes'), - 'proxy ipv4 invalid', - ) - self.assertIn( - 'error', - self.conf([{"action": {"proxy": 'http://127.0.0.1:'}}], 'routes'), - 'proxy ipv4 invalid 2', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://127.0.0.1:blah'}}], 'routes' - ), - 'proxy ipv4 invalid 3', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://127.0.0.1:-1'}}], 'routes' - ), - 'proxy ipv4 invalid 4', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://127.0.0.1:7080b'}}], 'routes' - ), - 'proxy ipv4 invalid 5', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://[]'}}], 'routes' - ), - 'proxy ipv6 invalid', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://[]:7080'}}], 'routes' - ), - 'proxy ipv6 invalid 2', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://[:]:7080'}}], 'routes' - ), - 'proxy ipv6 invalid 3', - ) - self.assertIn( - 'error', - self.conf( - [{"action": {"proxy": 'http://[::7080'}}], 'routes' - ), - 'proxy ipv6 invalid 4', - ) + def check_proxy(proxy): + self.assertIn( + 'error', + self.conf([{"action": {"proxy": proxy}}], 'routes'), + 'proxy invalid', + ) + + check_proxy('blah') + check_proxy('/blah') + check_proxy('unix:/blah') + check_proxy('http://blah') + check_proxy('http://127.0.0.1') + check_proxy('http://127.0.0.1:') + check_proxy('http://127.0.0.1:blah') + check_proxy('http://127.0.0.1:-1') + check_proxy('http://127.0.0.1:7080b') + check_proxy('http://[]') + check_proxy('http://[]:7080') + check_proxy('http://[:]:7080') + check_proxy('http://[::7080') def test_proxy_loop(self): self.skip_alerts.extend( -- cgit From ce4a2bbd05f42d258f9bf7880060a604ac1a866e Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Fri, 15 May 2020 04:20:56 +0100 Subject: Tests: style. --- test/test_proxy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/test_proxy.py') diff --git a/test/test_proxy.py b/test/test_proxy.py index c163b14d..feec1ac4 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -1,7 +1,8 @@ import re -import time import socket +import time import unittest + from unit.applications.lang.python import TestApplicationPython -- cgit