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

Improve TestSpreadMinimizingTokenGenerator_GetMissingTokens #399

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

duricanikolic
Copy link
Contributor

What this PR does:
It has been reported that TestSpreadMinimizingTokenGenerator_GetMissingTokens is flaky. After a more detailed analysis, it has been noticed that in an unlucky case a generation of 3 random integeres

missingIndex := []int{rand.Intn(tokensPerInstance - 1), rand.Intn(tokensPerInstance - 1), rand.Intn(tokensPerInstance - 1)}

actually returns an array with a repeated element. This is the main cause of the problem and it has been fixed by this PR.

Which issue(s) this PR fixes:

Fixes #398

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@duricanikolic duricanikolic self-assigned this Oct 10, 2023
Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this so quickly

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@duricanikolic duricanikolic merged commit 0f57536 into main Oct 10, 2023
3 checks passed
@duricanikolic duricanikolic deleted the yuri/issue-398 branch October 10, 2023 09:55
ying-jeanne pushed a commit that referenced this pull request Nov 2, 2023
* Improve TestSpreadMinimizingTokenGenerator_GetMissingTokens

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>

* Fixing review findings

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>

---------

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ring: test flake
2 participants