-
Notifications
You must be signed in to change notification settings - Fork 119
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
[CI] Enable wolfi Elastic Agent images in tests #2067
Conversation
@@ -17,6 +17,7 @@ inputs: | |||
- apache-access | |||
type: logfile | |||
use_output: default | |||
namespaces: [] |
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.
It looks like that for policy tests it should also be needed to be able to mark some fields optional @jsoriano
This namespaces
field appeared when testing with 8.16.0-SNAPSHOT
. But they are not present in older stack versions (e.g. 8.15.0).
Changes required present in these two commits:
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.
Reverting these two commits in order to be able to merge this PR.
// Try to keep the test agnostic from the environment variables defined in CI | ||
t.Setenv(disableElasticAgentWolfiEnvVar, "") | ||
os.Unsetenv(disableElasticAgentWolfiEnvVar) |
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.
Could this cause any issues ?
It looks like the environment variable is defined in other tests even here it is unset.
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.
Setting environment variables is only going to be problematic if tests are run in parallel, as it affects the global process. t.Setenv
recovers the previous value on cleanup, see https://pkg.go.dev/testing#B.Setenv.
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.
Perfect, so as these tests do not use t.Parallel()
, I guess it is safe here. Even if it is called os.Unsetenv
, the environment variable would be recovered aftwards thanks to the t.Setenv()
t.Parallel() is used in other tests:
- internal/servicedeployer/terraform_test.go
- internal/testrunner/runners/system/tester_test.go
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 each package is executed in a different process, so we should be fine if the tests are in different packages.
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @mrodm |
Run tests using Elastic Agent images where it is possible.
Author's checklist