-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 hetzner and openstack tests by adding AWS_EC2_METADATA_DISABLED=true in ec2 #37907
Fix hetzner and openstack tests by adding AWS_EC2_METADATA_DISABLED=true in ec2 #37907
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Perhaps we should also disable the IMDS client by default in the tests, by adding an func init() {
// Disable IMDS when the real AWS SDK IMDS client is used,
// so tests are isolated from the environment. Otherwise,
// tests for non-EC2 providers may fail when the tests are
// run within an EC2 VM.
os.Setenv("AWS_EC2_METADATA_DISABLED", "true")
} WDYT? |
@@ -60,6 +69,7 @@ func TestRetrieveHetznerMetadata(t *testing.T) { | |||
defer server.Close() | |||
|
|||
config, err := conf.NewConfigFrom(map[string]interface{}{ | |||
// "providers": []string{"hetzner"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axw Thanks for pointing out the config os.Setenv("AWS_EC2_METADATA_DISABLED", "true")
! Without specifying the providers
to be hetzner
, the test passes too now,. Should I still give a providers
just to be sure? 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be better to leave it out, to try and avoid issues like #13816 as much as possible.
libbeat/processors/add_cloud_metadata/provider_hetzner_cloud_test.go
Outdated
Show resolved
Hide resolved
@@ -60,6 +69,7 @@ func TestRetrieveHetznerMetadata(t *testing.T) { | |||
defer server.Close() | |||
|
|||
config, err := conf.NewConfigFrom(map[string]interface{}{ | |||
// "providers": []string{"hetzner"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be better to leave it out, to try and avoid issues like #13816 as much as possible.
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
…rue in ec2 (#37907) (#38016) (cherry picked from commit 38e7d6f) Co-authored-by: kaiyan-sheng <[email protected]>
Proposed commit message
This PR is to add
AWS_EC2_METADATA_DISABLED=true
to disable IMDS when the real AWS SDK IMDS client is used. With this parameter, the non-EC2 provider tests should pass when running within an EC2 VM.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist