diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2018-08-21 20:49:23 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2018-08-21 20:49:23 +0300 |
commit | dea7e0dc87dc2e63c4702cf6714aa3e946f64ca6 (patch) | |
tree | 53d045cf1454153e330c03b2c58fc5456057b1ca | |
parent | a4e75be524b9171b0e6a487b99e34673d0c9bacb (diff) | |
download | unit-dea7e0dc87dc2e63c4702cf6714aa3e946f64ca6.tar.gz unit-dea7e0dc87dc2e63c4702cf6714aa3e946f64ca6.tar.bz2 |
Tests: more timeout tests.
-rw-r--r-- | test/test_settings.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test_settings.py b/test/test_settings.py index 041d6f28..3df88ec4 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -25,6 +25,31 @@ Connection: close self.assertEqual(resp['status'], 408, 'status header read timeout') + @unittest.expectedFailure + def test_settings_header_read_timeout_update(self): + self.load('empty') + + self.conf({'http': { 'header_read_timeout': 4 }}, '/settings') + + (resp, sock) = self.http(b"""GET / HTTP/1.1 +""", start=True, raw=True) + + time.sleep(2) + + (resp, sock) = self.http(b"""Host: localhost +""", start=True, sock=sock, raw=True) + + time.sleep(2) + + resp = self.http(b"""Connection: close + +""", sock=sock, raw=True) + + time.sleep(2) + + self.assertEqual(resp['status'], 408, + 'status header read timeout update') + def test_settings_body_read_timeout(self): self.load('empty') @@ -43,6 +68,32 @@ Connection: close self.assertEqual(resp['status'], 408, 'status body read timeout') + def test_settings_body_read_timeout_update(self): + self.load('empty') + + self.conf({'http': { 'body_read_timeout': 4 }}, '/settings') + + (resp, sock) = self.http(b"""POST / HTTP/1.1 +Host: localhost +Content-Length: 10 +Connection: close + +""", start=True, raw=True) + + time.sleep(2) + + (resp, sock) = self.http(b"""012""", start=True, sock=sock, raw=True) + + time.sleep(2) + + (resp, sock) = self.http(b"""345""", start=True, sock=sock, raw=True) + + time.sleep(2) + + resp = self.http(b"""6789""", sock=sock, raw=True) + + self.assertEqual(resp['status'], 200, 'status body read timeout update') + def test_settings_send_timeout(self): self.load('mirror') |