Skip to content

Fix flaky tests#24117

Merged
rudream merged 1 commit intomasterfrom
yassine/fix-flaky-test
Apr 5, 2023
Merged

Fix flaky tests#24117
rudream merged 1 commit intomasterfrom
yassine/fix-flaky-test

Conversation

@rudream
Copy link
Copy Markdown
Contributor

@rudream rudream commented Apr 5, 2023

Fixes flaky tests caused by updating a test module while using t.Parallel() with modules.SetTestModules()

Closes #24115
Closes #24105

@github-actions github-actions Bot requested review from avatus and zmb3 April 5, 2023 15:11
Comment thread lib/web/apiserver_test.go Outdated
@zmb3 zmb3 changed the title Fix flakey test in lib/web/apiserver_test.go Fix flaky test in lib/web/apiserver_test.go Apr 5, 2023
@rudream rudream force-pushed the yassine/fix-flaky-test branch from 649504d to 34bcecd Compare April 5, 2023 15:13
@rudream rudream requested a review from zmb3 April 5, 2023 15:14
Comment thread lib/web/apiserver_test.go Outdated
Comment thread lib/web/apiserver_test.go Outdated
@rudream rudream requested a review from zmb3 April 5, 2023 15:19
Comment thread lib/modules/test.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add a check that verifies if GetModules doesn't have the default content? It would be a stronger check than this one.

cc @zmb3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That wouldn't verify whether or not we are currently in a parallel test, it would only verify whether the modules were previously changed, which is technically something that's allowed in a non-parallel test. This would be a weaker check IMO.

Go's testing package doesn't expose an API to tell you whether or not you are in a parallel test, but they do have those checks internally, and t.Setenv will panic if called in a parallel test.

With this in place, it would not have been possible to merge the bad code in the first place.

Copy link
Copy Markdown
Contributor

@tigrato tigrato left a comment

Choose a reason for hiding this comment

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

We have other tests that do the same thing

@rudream rudream enabled auto-merge April 5, 2023 15:25
@rudream rudream force-pushed the yassine/fix-flaky-test branch from 5e57912 to e6a819a Compare April 5, 2023 15:59
@rudream rudream changed the title Fix flaky test in lib/web/apiserver_test.go Fix flaky tests Apr 5, 2023
@rudream rudream force-pushed the yassine/fix-flaky-test branch from e6a819a to 40f6a08 Compare April 5, 2023 16:09
@rudream rudream force-pushed the yassine/fix-flaky-test branch from 40f6a08 to 5fa65c0 Compare April 5, 2023 16:11
@rudream rudream requested a review from zmb3 April 5, 2023 16:11
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from avatus April 5, 2023 16:26
@rudream rudream added this pull request to the merge queue Apr 5, 2023
Merged via the queue into master with commit c7671c7 Apr 5, 2023
@rudream rudream deleted the yassine/fix-flaky-test branch April 5, 2023 16:55
@public-teleport-github-review-bot
Copy link
Copy Markdown

@rudream See the table below for backport results.

Branch Result
branch/v11 Failed
branch/v12 Create PR

@rudream rudream mentioned this pull request Apr 5, 2023
rudream added a commit that referenced this pull request Apr 5, 2023
@rudream rudream mentioned this pull request Apr 5, 2023
rudream added a commit that referenced this pull request Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants