diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-08-22 21:28:03 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-08-22 21:28:03 +0300 |
commit | c47af243b0e805376c4ec908f21e07dc811b33f0 (patch) | |
tree | e2448086dde9364f8eb818081107f3280cbd0ad9 | |
parent | bc57d1d07680e7605deb8ab959e19a76b5400af3 (diff) | |
download | unit-c47af243b0e805376c4ec908f21e07dc811b33f0.tar.gz unit-c47af243b0e805376c4ec908f21e07dc811b33f0.tar.bz2 |
Tests: removed keepalive_interval for websocket tests.
Also increased read_timeout in frame_read() for slow hosts.
-rw-r--r-- | test/test_node_websockets.py | 14 | ||||
-rw-r--r-- | test/unit/applications/websockets.py | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/test/test_node_websockets.py b/test/test_node_websockets.py index 895019c5..6652d8c5 100644 --- a/test/test_node_websockets.py +++ b/test/test_node_websockets.py @@ -12,6 +12,14 @@ class TestNodeWebsockets(TestApplicationNode): def setUp(self): super().setUp() + self.assertIn( + 'success', + self.conf( + {'http': {'websocket': {'keepalive_interval': 0}}}, 'settings' + ), + 'clear keepalive_interval', + ) + self.skip_alerts.extend( [ r'last message send failed', @@ -1530,14 +1538,13 @@ class TestNodeWebsockets(TestApplicationNode): self.ws.frame_write(sock, opcode, payload) # frame length is 101 self.check_close(sock, 1009) # 1009 - CLOSE_TOO_LARGE - @unittest.skip('not yet') def test_node_websockets_read_timeout(self): self.load('websockets/mirror') self.assertIn( 'success', self.conf( - {'http': {'websocket': {'read_timeout': 1}}}, 'settings' + {'http': {'websocket': {'read_timeout': 5}}}, 'settings' ), 'configure read_timeout', ) @@ -1551,14 +1558,13 @@ class TestNodeWebsockets(TestApplicationNode): self.check_close(sock, 1001) # 1001 - CLOSE_GOING_AWAY - @unittest.skip('not yet') def test_node_websockets_keepalive_interval(self): self.load('websockets/mirror') self.assertIn( 'success', self.conf( - {'http': {'websocket': {'keepalive_interval': 1}}}, 'settings' + {'http': {'websocket': {'keepalive_interval': 5}}}, 'settings' ), 'configure keepalive_interval', ) diff --git a/test/unit/applications/websockets.py b/test/unit/applications/websockets.py index d64b960c..417e9504 100644 --- a/test/unit/applications/websockets.py +++ b/test/unit/applications/websockets.py @@ -57,7 +57,7 @@ class TestApplicationWebsocket(TestApplicationProto): def serialize_close(self, code = 1000, reason = ''): return struct.pack('!H', code) + reason.encode('utf-8') - def frame_read(self, sock, read_timeout=5): + def frame_read(self, sock, read_timeout=10): def recv_bytes(sock, bytes): data = b'' while select.select([sock], [], [], read_timeout)[0]: @@ -204,7 +204,7 @@ class TestApplicationWebsocket(TestApplicationProto): op_code = self.OP_CONT pos = end - def message_read(self, sock, read_timeout=5): + def message_read(self, sock, read_timeout=10): frame = self.frame_read(sock, read_timeout=read_timeout) while(not frame['fin']): |