Skip to content

test: use atomics in TestSystemMetricsReport to avoid race condition #233

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

Merged
merged 3 commits into from
Jun 16, 2025

Conversation

kruskall
Copy link
Member

What does this PR do?

replace bool with atomic.Bool to avoid race condition with multiple goroutines accessing the variables

Why is it important?

tests with race detector will fail

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md

Author's Checklist

  • [ ]

Related issues

Discovered in #232

replace bool with atomic.Bool to avoid race condition with multiple
goroutines accessing the variables
@kruskall kruskall requested a review from a team as a code owner June 13, 2025 13:01
@kruskall kruskall requested review from rdner and mauri870 and removed request for a team June 13, 2025 13:01
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jun 15, 2025
@kruskall kruskall enabled auto-merge (squash) June 16, 2025 13:21
@kruskall kruskall merged commit bbca5fd into elastic:main Jun 16, 2025
5 checks passed
@kruskall kruskall deleted the test/TestSystemMetricsReport-race branch June 16, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants