Skip to content

Commit c08204e

Browse files
authored
Fix for flakiness in socket tests. NFC (#23103)
In #22987 I added a new veriant of the test_nodejs_sockets_echo test and chose the next consecutive port number, but it seems that each test ends up using two ports numbers so this could conflicted with the tests that were using both the previous and next number in the sequence (59164 and 59166).
1 parent 1ddef04 commit c08204e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/test_sockets.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def test_enet(self):
285285
'native': [WebsockifyServerHarness, 59160, ['-DTEST_DGRAM=0']],
286286
'tcp': [CompiledServerHarness, 59162, ['-DTEST_DGRAM=0']],
287287
'udp': [CompiledServerHarness, 59164, ['-DTEST_DGRAM=1']],
288-
'pthread': [CompiledServerHarness, 59165, ['-pthread', '-sPROXY_TO_PTHREAD']],
288+
'pthread': [CompiledServerHarness, 59166, ['-pthread', '-sPROXY_TO_PTHREAD']],
289289
})
290290
def test_nodejs_sockets_echo(self, harness_class, port, args):
291291
if harness_class == WebsockifyServerHarness and common.EMTEST_LACKS_NATIVE_CLANG:
@@ -304,12 +304,12 @@ def test_nodejs_sockets_echo_subprotocol(self):
304304
# Test against a Websockified server with compile time configured WebSocket subprotocol. We use a Websockified
305305
# server because as long as the subprotocol list contains binary it will configure itself to accept binary
306306
# This test also checks that the connect url contains the correct subprotocols.
307-
with WebsockifyServerHarness(test_file('sockets/test_sockets_echo_server.c'), [], 59166):
308-
self.run_process([EMCC, '-Werror', test_file('sockets/test_sockets_echo_client.c'), '-o', 'client.js', '-sSOCKET_DEBUG', '-sWEBSOCKET_SUBPROTOCOL="base64, binary"', '-DSOCKK=59166'])
307+
with WebsockifyServerHarness(test_file('sockets/test_sockets_echo_server.c'), [], 59168):
308+
self.run_process([EMCC, '-Werror', test_file('sockets/test_sockets_echo_client.c'), '-o', 'client.js', '-sSOCKET_DEBUG', '-sWEBSOCKET_SUBPROTOCOL="base64, binary"', '-DSOCKK=59168'])
309309

310310
out = self.run_js('client.js')
311311
self.assertContained('do_msg_read: read 14 bytes', out)
312-
self.assertContained(['connect: ws://127.0.0.1:59166, base64,binary', 'connect: ws://127.0.0.1:59166/, base64,binary'], out)
312+
self.assertContained(['connect: ws://127.0.0.1:59168, base64,binary', 'connect: ws://127.0.0.1:59168/, base64,binary'], out)
313313

314314
@requires_native_clang
315315
def test_nodejs_sockets_echo_subprotocol_runtime(self):

0 commit comments

Comments
 (0)