Skip to content

fix(integration-tests): Fix port occupancy detection and command timeout #2347

Description

@coderabbitai

Summary

Integration tests have two reliability issues that need to be addressed:

  1. 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.

  2. Default command timeout is too shortDEFAULT_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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions