Skip to content

Wait for proxy with blocking socket

David Nelson requested to merge proxy-wait-blocking-socket into main

What does this MR do?

The behavior of the non-blocking socket used by the wait_for_proxy method differs per OS. Although this does not affect production behavior since we always run in a container, it does make unit testing it reliably difficult. For example, the code assumes that a successful connection will always return 0; however, on my Intel Mac with Ventura 13.6, the connect_ex method returns errno.EINPROGRESS, and the expectation is that the socket will be polled with select to determine when it is available. This causes the test_should_return_when_port_open to fail on my machine.

This MR switches to a blocking connect call with a timeout, which delegates the logic for handling connection states to the standard library. This results in the tests passing both on my Mac and in the container.

Merge request reports