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

Add timeouts to TestCoordinatorReportsInvalidPolicy #4358

Conversation

AndersonQ
Copy link
Member

@AndersonQ AndersonQ commented Mar 5, 2024

What does this PR do?

Adds a timeout to TestCoordinatorReportsInvalidPolicy when trying to receive from the state channel.

Why is it important?

Even thought the coordinator.runLoopIteration is synchronous, the actual state update, which is sent on stateChan, happens on a goroutine. Therefore there is the possibility when the test tries to read the channel, the stat isn't there yet. Whereas unlikely, it has been observed and made the test flaky.

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/fragments using the changelog tool
  • I have added an integration test or an E2E test

How to test this PR locally

I tried running it 500000 times and still could not catch a failure, therefore I'd not try to catch the flakyness. Let's CI do its job

Related issues

Use cases

Screenshots

Logs

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@AndersonQ AndersonQ added flaky-test Unstable or unreliable test cases. skip-changelog backport-v8.13.0 Automated backport with mergify labels Mar 5, 2024
@AndersonQ AndersonQ self-assigned this Mar 5, 2024
@AndersonQ AndersonQ requested a review from a team as a code owner March 5, 2024 14:14
Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Mar 5, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to add a little wait for the change, all depends on how golang schedules the goroutines.

I believe the issue you are reference is incorrect, I was unable to find that issue.

@AndersonQ AndersonQ merged commit 6db169e into elastic:main Mar 6, 2024
13 checks passed
@AndersonQ AndersonQ deleted the 4117-flaky-TestCoordinatorReportsInvalidPolicy branch March 6, 2024 07:10
mergify bot pushed a commit that referenced this pull request Mar 6, 2024
AndersonQ added a commit that referenced this pull request Mar 6, 2024
(cherry picked from commit 6db169e)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.13.0 Automated backport with mergify flaky-test Unstable or unreliable test cases. skip-changelog Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flaky Test]: TestCoordinatorReportsInvalidPolicy – Vars change should cause state update
4 participants