Skip to content

Commit

Permalink
Disable a test
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Dec 6, 2024
1 parent 18f7987 commit 4b2a17b
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions tests/ert/unit_tests/shared/test_port_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,42 +311,43 @@ def test_reuse_active_close_nok_ok(unused_tcp_port):
assert sock.fileno() != -1


def test_reuse_active_live_nok_nok(unused_tcp_port):
"""
Executive summary of this test
1. the original socket is obtained with will_close_then_reopen_socket=True
2. activity is triggered on the socket using a dummy-server/client
3. socket is not closed but kept alive
4. port can not be re-bound in default mode (TIME_WAIT?)...
5. ... but can with will_close_then_reopen_socket=True (ignoring TIME_WAIT)
"""
custom_range = range(unused_tcp_port, unused_tcp_port + 1)

orig_sock = find_available_socket(
custom_range=custom_range,
custom_host="127.0.0.1",
will_close_then_reopen_socket=True,
)
host, port = orig_sock.getsockname()
assert port == unused_tcp_port
assert orig_sock is not None
assert orig_sock.fileno() != -1

# Run a dummy-server to actually use the socket a little, then close it
_simulate_server(host, port, orig_sock)

# Even with "will_close_then_reopen_socket"=True when obtaining original
# socket, subsequent calls fails
with pytest.raises(NoPortsInRangeException):
find_available_socket(custom_range=custom_range, custom_host="127.0.0.1")

with pytest.raises(NoPortsInRangeException):
find_available_socket(
custom_range=custom_range,
custom_host="127.0.0.1",
will_close_then_reopen_socket=True,
)
# This test is disabled because it is not clear if zmq needs it
# def test_reuse_active_live_nok_nok(unused_tcp_port):
# """
# Executive summary of this test

# 1. the original socket is obtained with will_close_then_reopen_socket=True
# 2. activity is triggered on the socket using a dummy-server/client
# 3. socket is not closed but kept alive
# 4. port can not be re-bound in default mode (TIME_WAIT?)...
# 5. ... but can with will_close_then_reopen_socket=True (ignoring TIME_WAIT)
# """
# custom_range = range(unused_tcp_port, unused_tcp_port + 1)

# orig_sock = find_available_socket(
# custom_range=custom_range,
# custom_host="127.0.0.1",
# will_close_then_reopen_socket=True,
# )
# host, port = orig_sock.getsockname()
# assert port == unused_tcp_port
# assert orig_sock is not None
# assert orig_sock.fileno() != -1

# # Run a dummy-server to actually use the socket a little, then close it
# _simulate_server(host, port, orig_sock)

# # Even with "will_close_then_reopen_socket"=True when obtaining original
# # socket, subsequent calls fails
# with pytest.raises(NoPortsInRangeException):
# find_available_socket(custom_range=custom_range, custom_host="127.0.0.1")

# with pytest.raises(NoPortsInRangeException):
# find_available_socket(
# custom_range=custom_range,
# custom_host="127.0.0.1",
# will_close_then_reopen_socket=True,
# )


def test_def_active_live_nok_nok(unused_tcp_port):
Expand Down

0 comments on commit 4b2a17b

Please sign in to comment.