Skip to content

Fix flaky tests in compactor #2018

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 1 commit into from
Jan 24, 2020

Conversation

pracucci
Copy link
Contributor

What this PR does:
In the PR #1942 I did a mistake in the compactor tests which cause some flaky tests. The compactor tests mock the bucket client after the compactor is started and this leads to flaky tests (unfrequent, but seen in CI). This PR fixes it.

Which issue(s) this PR fixes:
N/A

Checklist

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

Signed-off-by: Marco Pracucci <[email protected]>
compactorCfg := Config{}
storageCfg := cortex_tsdb.Config{}
flagext.DefaultValues(&compactorCfg, &storageCfg)
compactorCfg.retryMinBackoff = 0
compactorCfg.retryMaxBackoff = 0

bucketClient := &cortex_tsdb.BucketClientMock{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Changes look good to me but I am trying to understand how this was causing tests to fail intermittently since it was still created before calling newCompactor down below. Anything I am missing to see here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was created before newCompactor() but mocked later (after the prepare() exits).

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, my bad. Changes look more relevant for this block

Thanks!

@pracucci pracucci merged commit dd77369 into cortexproject:master Jan 24, 2020
@pracucci pracucci deleted the fix-compactor-flaky-tests branch January 24, 2020 11:34
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.

4 participants