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

[8.15](backport #41891) Invoke m.Run on TestMain and fix test flakiness #41905

Closed
wants to merge 3 commits into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Dec 5, 2024

Proposed commit message

invoke m.Run on TestMain and reduce test flakiness

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.

The following 4 packages were not running any test as the TestMain was not invoking m.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

  • My code follows the style guidelines of this project
  • [ ] 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 tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

  • N/A

How to test this PR locally

Run the test for the affected packages, the tests should run.

go test -v ./filebeat/autodiscover/builder/hints
go test -v ./filebeat/processor/add_kubernetes_metadata
go test -v ./metricbeat/autodiscover/appender/kubernetes/token
go test -v ./metricbeat/autodiscover/builder/hints

Before the fix:

❯ go test -v .
ok  	github.com/elastic/beats/v7/filebeat/autodiscover/builder/hints	0.530s

After the fix

❯ go test -v .
=== RUN   TestUnpackCopiesDefault
--- PASS: TestUnpackCopiesDefault (0.00s)
=== RUN   TestGenerateHints
--- PASS: TestGenerateHints (0.01s)
=== RUN   TestGenerateHintsWithPaths
--- PASS: TestGenerateHintsWithPaths (0.00s)
PASS
ok  	github.com/elastic/beats/v7/filebeat/autodiscover/builder/hints	0.172s

Related issues

  • N/A

This is an automatic backport of pull request #41891 done by [Mergify](https://mergify.com).

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
@mergify mergify bot requested a review from a team as a code owner December 5, 2024 11:17
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Dec 5, 2024
@mergify mergify bot removed the request for review from a team December 5, 2024 11:17
@mergify mergify bot requested review from faec and VihasMakwana December 5, 2024 11:17
Copy link
Contributor Author

mergify bot commented Dec 5, 2024

Cherry-pick of 83251ea has failed:

On branch mergify/bp/8.15/pr-41891
Your branch is up to date with 'origin/8.15'.

You are currently cherry-picking commit 83251eafbc.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   filebeat/autodiscover/builder/hints/logs_test.go
	modified:   filebeat/input/filestream/input_integration_test.go
	modified:   filebeat/processor/add_kubernetes_metadata/matchers_test.go
	modified:   metricbeat/autodiscover/appender/kubernetes/token/token_test.go
	modified:   metricbeat/autodiscover/builder/hints/metrics_test.go

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   filebeat/tests/integration/translate_ldap_attribute_test.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 5, 2024
@AndersonQ AndersonQ added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Dec 6, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 6, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@AndersonQ AndersonQ requested review from AndersonQ and removed request for faec and VihasMakwana December 6, 2024 09:25
@AndersonQ AndersonQ removed the conflicts There is a conflict in the backported pull request label Dec 6, 2024
@AndersonQ AndersonQ enabled auto-merge (squash) December 6, 2024 09:28
@AndersonQ AndersonQ disabled auto-merge December 6, 2024 10:44
@AndersonQ
Copy link
Member

should not have opened the backport

@AndersonQ AndersonQ closed this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants