-
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
Invoke m.Run on TestMain and fix test flakiness #41891
Conversation
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
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.
Good catch!
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've seem more than once tests failing like that (see output below). So as this PR is already to fix tests, let's fix those as well.
2024-12-04 17:57:18 CEST === FAIL: filebeat/input/filestream TestFilestreamCloseRemoved (unknown)
2024-12-04 17:57:18 CEST panic: name fake-ID already used
2024-12-04 17:57:18 CEST
2024-12-04 17:57:18 CEST goroutine 279 [running]:
2024-12-04 17:57:18 CEST github.com/elastic/elastic-agent-libs/monitoring.panicErr(...)
2024-12-04 17:57:18 CEST /opt/buildkite-agent/.asdf/installs/golang/1.22.9/packages/pkg/mod/github.com/elastic/[email protected]/monitoring/registry.go:257
2024-12-04 17:57:18 CEST github.com/elastic/elastic-agent-libs/monitoring.(*Registry).Add(0xc00060dd80, {0xf4003b?, 0x0?}, {0x10f39a0, 0xc00295ad40}, 0xe0?)
2024-12-04 17:57:18 CEST /opt/buildkite-agent/.asdf/installs/golang/1.22.9/packages/pkg/mod/github.com/elastic/[email protected]/monitoring/registry.go:155 +0xcc
2024-12-04 17:57:18 CEST github.com/elastic/elastic-agent-libs/monitoring.(*Registry).NewRegistry(0xc00060dd80, {0xf4003b, 0x7}, {0x0?, 0x0?, 0xf45374?})
2024-12-04 17:57:18 CEST /opt/buildkite-agent/.asdf/installs/golang/1.22.9/packages/pkg/mod/github.com/elastic/[email protected]/monitoring/registry.go:94 +0x15d
2024-12-04 17:57:18 CEST github.com/elastic/beats/v7/libbeat/monitoring/inputmon.NewInputRegistry({0xf43ba8, 0xa}, {0xf4003b, 0x7}, 0xe7faa0?)
2024-12-04 17:57:18 CEST /opt/buildkite-agent/builds/bk-agent-prod-gcp-1733331086222823672/elastic/filebeat/libbeat/monitoring/inputmon/input.go:65 +0x38c
2024-12-04 17:57:18 CEST github.com/elastic/beats/v7/filebeat/input/filestream/internal/input-logfile.NewMetrics({0xf4003b, 0x7})
2024-12-04 17:57:18 CEST /opt/buildkite-agent/builds/bk-agent-prod-gcp-1733331086222823672/elastic/filebeat/filebeat/input/filestream/internal/input-logfile/metrics.go:66 +0x94
2024-12-04 17:57:18 CEST github.com/elastic/beats/v7/filebeat/input/filestream/internal/input-logfile.(*managedInput).Run(_, {0xc00f8624f0, {0xf4003b, 0x7}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...)
2024-12-04 17:57:18 CEST /opt/buildkite-agent/builds/bk-agent-prod-gcp-1733331086222823672/elastic/filebeat/filebeat/input/filestream/internal/input-logfile/input.go:67 +0x205
2024-12-04 17:57:18 CEST github.com/elastic/beats/v7/filebeat/input/filestream.(*inputTestingEnvironment).startInput.func1(0xc0004e9f90?, 0xc0004e9f90?)
2024-12-04 17:57:18 CEST /opt/buildkite-agent/builds/bk-agent-prod-gcp-1733331086222823672/elastic/filebeat/filebeat/input/filestream/environment_test.go:132 +0x163
2024-12-04 17:57:18 CEST created by github.com/elastic/beats/v7/filebeat/input/filestream.(*inputTestingEnvironment).startInput in goroutine 159
2024-12-04 17:57:18 CEST /opt/buildkite-agent/builds/bk-agent-prod-gcp-1733331086222823672/elastic/filebeat/filebeat/input/filestream/environment_test.go:128 +0x11b
added more changes
Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea) # Conflicts: # filebeat/tests/integration/translate_ldap_attribute_test.go
Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea) # Conflicts: # filebeat/tests/integration/translate_ldap_attribute_test.go
Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea)
Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea)
Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea) Co-authored-by: Anderson Queiroz <[email protected]>
Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea) Co-authored-by: Anderson Queiroz <[email protected]>
…iness (#41906) * invoke m.Run on TestMain and reduce test flakiness (#41891) Some TestMain were not running any tests as they did not invoke m.Run. This change fixes that. Also other tests were presenting some flakyness, therefore this change also attempts to fix the flakiness by setting really unique IDs for filestream tests and increasing a timeout for TestTranslateGUIDWithLDAP. (cherry picked from commit 83251ea) --------- Co-authored-by: Anderson Queiroz <[email protected]>
Proposed commit message
The following 4 packages were not running any test as the
TestMain
was not invokingm.Run()
to actually run the test. The packages were:filebeat/autodiscover/builder/hints
filebeat/processor/add_kubernetes_metadata
metricbeat/autodiscover/appender/kubernetes/token
metricbeat/autodiscover/builder/hints
Checklist
[ ] I have commented my code, particularly in hard-to-understand areas[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
How to test this PR locally
Run the test for the affected packages, the tests should run.
Before the fix:
After the fix
Related issues