Skip to content

Listen explicitly on localhost on heartbeat TCP tests#15583

Merged
jsoriano merged 2 commits intoelastic:feature/python3from
jsoriano:heartbeat-localhost-test
Jan 15, 2020
Merged

Listen explicitly on localhost on heartbeat TCP tests#15583
jsoriano merged 2 commits intoelastic:feature/python3from
jsoriano:heartbeat-localhost-test

Conversation

@jsoriano
Copy link
Copy Markdown
Member

Some tests were requiring localhost to resolve to 127.0.0.1, but this is
not always the case. In some machines localhost resolve to other local
addresses as 127.0.1.1, or to [::1] if ipv4 is not available.

httptest.NewServer always binds to 127.0.0.1, so connections to
localhost can fail if localhost resolves to a different IP.

Explicitly use localhost when binding and later expecting name resolution.

Issue seen in Travis when upgrading the Ubuntu image during the
migration to Python 3, can be reproduced by modifying /etc/hosts to
use an IP different to 127.0.0.1 as localhost.

Some tests were requiring localhost to resolve to 127.0.0.1, but this is
not always the case. In some machines localhost resolve to other local
addresses as 127.0.1.1, or to [::1] if ipv4 is not available.
@@ -1,5 +1,5 @@
Elastic Beats
Copyright 2014-2019 Elasticsearch BV
Copyright 2014-2020 Elasticsearch BV
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this change but required in the python 3 branch.

@jsoriano jsoriano merged commit 3c908d1 into elastic:feature/python3 Jan 15, 2020
@jsoriano jsoriano deleted the heartbeat-localhost-test branch January 15, 2020 18:10
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Some tests were requiring localhost to resolve to 127.0.0.1, but this is
not always the case. In some machines localhost resolve to other local
addresses as 127.0.1.1, or to [::1] if ipv4 is not available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants