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

Deflake some tests - 2020-05-27 edition #8060

Merged
merged 8 commits into from
May 27, 2020
Merged

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented May 27, 2020

Deflake some tests that I noticed recently. Best reviewed on commit by commit basis:

In high level, I noticed the following:

Fixed this by ensuring that background goroutines are cancelled after the driver context is cancelled. Also, default to having tests run with disabled GC.

  • Some CSI tests expect the nodes to be in the Server State Store, but block until a connection is established. This results into spurious failures such as ones found in https://circleci.com/gh/hashicorp/nomad/69646 . Notice how the failure is reported 1ms after "client: node registration complete" log line.

  • Weird sparious failures in api package like ones in https://circleci.com/gh/hashicorp/nomad/69688 , where the test pass by gets reported as a failure. My hunch is that it fails because the nomad process is killed before the log newline is flushed and gotestsum get confused. I'll report this to gotestsum developer. Here, I ensure that the process is killed gracefully first.

Mahmood Ali added 6 commits May 26, 2020 18:53
Fix some docker test flakiness where image cleanup process may
contaminate other tests. A clean up process may attempt to delete an
image while it's used by another test.
@notnoop notnoop requested a review from tgross May 27, 2020 13:18
@notnoop notnoop self-assigned this May 27, 2020
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Left a couple notes where we could be expressing the test intent better if you want.

case structs.EvalStatusPending, structs.EvalStatusComplete:
// success
default:
require.Equal(t, structs.EvalStatusPending, eval.Status)
Copy link
Member

Choose a reason for hiding this comment

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

If we saying EvalStatusPending or EvalStatusComplete are the success case, do you think this would be more clear (and provide more accurate error messages) if we used assert.Fail here instead?

require.Len(node.Events, 3)

// sometimes test gets a duplicate node drain complete event
if len(node.Events) < 3 {
Copy link
Member

Choose a reason for hiding this comment

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

Could we use require.GreaterOrEqual to make the intent more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:TIL: Agreed.

@notnoop notnoop merged commit 48cc0ae into master May 27, 2020
@notnoop notnoop deleted the tests-deflake-20200526 branch May 27, 2020 19:24
notnoop pushed a commit that referenced this pull request Jun 2, 2020
Deflake some tests - 2020-05-27 edition
@github-actions
Copy link

github-actions bot commented Jan 4, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants