Project

General

Profile

Actions

Patch #44597

open

Avoid 60-second connection timeouts in webhook executor tests on macOS

Added by Go MAEDA about 12 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring

Description

On macOS, the following two tests in test/unit/webhook_test.rb take 60 seconds each. They were added in #44143.

  • test_executor_tries_the_next_IP_when_a_connection_fails
  • test_executor_raises_a_SocketError_when_no_IP_can_be_connected_to

These tests connect to 127.0.0.2 and expect the connection to be refused. This works on Linux, where the whole 127.0.0.0/8 block is routed to the loopback interface. On macOS, however, only 127.0.0.1 is assigned to the loopback interface, so the connection attempt is not refused and the tests wait until the 60-second open_timeout of Webhook::Executor expires.

The attached patch changes the address to ::1. Since the test server binds only to 127.0.0.1, a connection to [::1] on the same port fails immediately on both Linux and macOS. In an environment where IPv6 is unavailable, the connection attempt should still fail immediately, so the tests should not be affected.

With the patch, each of the two tests finishes in less than 0.01 seconds on macOS. The patch changes only the tests and does not change the application code.


Files

No data to display

Actions

Also available in: Atom PDF