summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2019-08-22 18:28:23 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2019-08-22 18:28:23 +0300
commit72b56388b765686cc947bd84e6bc569316ad8de2 (patch)
treeb86f7f3c3180197c06366978a07aa600f77f2837 /test
parente291841b3379f8787a10ad4f91e4aeae2ae323a4 (diff)
downloadunit-72b56388b765686cc947bd84e6bc569316ad8de2.tar.gz
unit-72b56388b765686cc947bd84e6bc569316ad8de2.tar.bz2
Tests: Node.js websockets tests tuned.
Diffstat (limited to 'test')
-rw-r--r--test/test_node_websockets.py17
-rw-r--r--test/unit/applications/websockets.py4
2 files changed, 16 insertions, 5 deletions
diff --git a/test/test_node_websockets.py b/test/test_node_websockets.py
index 655b5202..895019c5 100644
--- a/test/test_node_websockets.py
+++ b/test/test_node_websockets.py
@@ -9,9 +9,15 @@ class TestNodeWebsockets(TestApplicationNode):
ws = TestApplicationWebsocket()
- @classmethod
- def setUpClass(cls):
- raise unittest.SkipTest('Websockets is not available')
+ def setUp(self):
+ super().setUp()
+
+ self.skip_alerts.extend(
+ [
+ r'last message send failed',
+ r'socket close\(\d+\) failed',
+ ]
+ )
def close_connection(self, sock):
self.assertEqual(self.recvall(sock, read_timeout=1), b'', 'empty sock')
@@ -432,6 +438,7 @@ class TestNodeWebsockets(TestApplicationNode):
# validation for websocket frames. It should be implemented
# by application, if necessary.
+ @unittest.skip('not yet')
def test_node_websockets_1_1_1__1_1_8(self):
self.load('websockets/mirror')
@@ -458,6 +465,7 @@ class TestNodeWebsockets(TestApplicationNode):
self.close_connection(sock)
+ @unittest.skip('not yet')
def test_node_websockets_1_2_1__1_2_8(self):
self.load('websockets/mirror')
@@ -799,6 +807,7 @@ class TestNodeWebsockets(TestApplicationNode):
self.check_close(sock, 1002)
+ @unittest.skip('not yet')
def test_node_websockets_5_1__5_20(self):
self.load('websockets/mirror')
@@ -1521,6 +1530,7 @@ 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')
@@ -1541,6 +1551,7 @@ 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')
diff --git a/test/unit/applications/websockets.py b/test/unit/applications/websockets.py
index 7b516239..d64b960c 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=1):
+ def frame_read(self, sock, read_timeout=5):
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=1):
+ def message_read(self, sock, read_timeout=5):
frame = self.frame_read(sock, read_timeout=read_timeout)
while(not frame['fin']):