Skip to content

Add explicit tests for port polling helper methods #26

@justin808

Description

@justin808

Description

Currently, the port_in_use? and wait_for_port_to_be_available helper methods in E2eTestRunner are only tested indirectly through integration tests. We should add explicit unit tests for these methods to ensure better test coverage and catch edge cases.

Proposed Changes

Test Coverage Needed:

  1. port_in_use? method tests:

    • Port is available (can bind successfully)
    • Port is in use (Errno::EADDRINUSE)
    • Other socket errors are handled gracefully
    • TCPServer is always closed (resource leak prevention)
  2. wait_for_port_to_be_available method tests:

    • Port becomes available immediately
    • Port becomes available after several attempts
    • Port never becomes available (timeout)
    • Progress indicators are printed correctly
    • Warning message when port remains in use

Benefits:

  • Better test coverage for critical infrastructure code
  • Easier to identify and fix edge cases
  • Documents expected behavior explicitly
  • Faster feedback loop (unit tests run faster than integration tests)

Related

Priority

Nice to have - Current indirect testing is adequate but explicit tests would improve maintainability.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions