Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integration tests on macOS #754

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thiagosalles
Copy link

@thiagosalles thiagosalles commented Mar 19, 2025

Fix integration tests by binding the listener to localhost, just like the client

The integration tests were failing because the server listener was configured with net.Listen("tcp", ":8080"), without specifying a hostname, which binds to all network interfaces (including IPv6). Meanwhile, the client connection used net.Dial("tcp", "localhost:8080"), which resolved to IPv4 (127.0.0.1) on my machine.

The discrepancy between the listener accepting both IPv4 and IPv6 and the client specifically using IPv4 may have caused the X-Forwarded-For header to be populated with the client’s IP (127.0.0.1) instead of being empty, as the tests expected.

Changing the listener to net.Listen("tcp", "localhost:8080") ensures the server binds to the same interface as the client, aligning with the test expectations and fixing the failures.

Evidence

After the modification, the integration tests pass successfully:

$ go test -tags integration ./test
ok  	github.com/luraproject/lura/v2/test	3.107s

Fixes #753

Signed-off-by: Thiago Salles <tsmlima@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration tests failing locally on macOS
1 participant