Summary
Integration tests have two reliability issues that need to be addressed:
-
Port occupancy detection incorrectly reports ports as in-use — _is_port_free() in integration-tests/tests/utils/port_utils.py does not set SO_REUSEADDR on the probing socket before calling bind(). On Linux, sockets lingering in TIME_WAIT can cause bind() to fail even when no application is actively listening, leading to false positives. The fix is to call sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) before binding.
-
Default command timeout is too short — DEFAULT_CMD_TIMEOUT_SECONDS in integration-tests/tests/utils/classes.py is set to 120.0 seconds, which is insufficient for some integration test commands. It should be increased (e.g., to 300.0 seconds).
Affected Files
integration-tests/tests/utils/port_utils.py — add SO_REUSEADDR to _is_port_free()
integration-tests/tests/utils/classes.py — increase DEFAULT_CMD_TIMEOUT_SECONDS
Context
These fixes were included as a workaround in PR #2288 (OpenTelemetry metrics instrumentation). They have been identified as unrelated to that PR's scope and should be reverted from #2288 and addressed here instead.
References
/cc @quinntaylormitchell
Summary
Integration tests have two reliability issues that need to be addressed:
Port occupancy detection incorrectly reports ports as in-use —
_is_port_free()inintegration-tests/tests/utils/port_utils.pydoes not setSO_REUSEADDRon the probing socket before callingbind(). On Linux, sockets lingering inTIME_WAITcan causebind()to fail even when no application is actively listening, leading to false positives. The fix is to callsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)before binding.Default command timeout is too short —
DEFAULT_CMD_TIMEOUT_SECONDSinintegration-tests/tests/utils/classes.pyis set to120.0seconds, which is insufficient for some integration test commands. It should be increased (e.g., to300.0seconds).Affected Files
integration-tests/tests/utils/port_utils.py— addSO_REUSEADDRto_is_port_free()integration-tests/tests/utils/classes.py— increaseDEFAULT_CMD_TIMEOUT_SECONDSContext
These fixes were included as a workaround in PR #2288 (OpenTelemetry metrics instrumentation). They have been identified as unrelated to that PR's scope and should be reverted from #2288 and addressed here instead.
References
/cc @quinntaylormitchell