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

Address flakiness in command/exec tests #4517

Merged
merged 3 commits into from
Aug 10, 2018

Conversation

freddygv
Copy link
Contributor

Several of the command/exec tests were consistently flaky and reporting the following errors:

  • Missing check 'serfHealth' registration
  • Missing node registration
  • Failed to find Consul server in remote datacenter

These are associated with a race between bootstrapping the test agent and actions like creating a session.

With the WaitForTestAgent helper function we now wait for the new node (and its check) to be registered in the catalog.

Also, there was some flakiness around the timeouts in TestExecCommand_StreamResults, so the channel reads were wrapped in retries.

After making all these changes the tests in command/exec have consistently passed in the repro environment.

@freddygv freddygv requested a review from kyhavlov August 10, 2018 18:06
Copy link
Contributor

@kyhavlov kyhavlov left a comment

Choose a reason for hiding this comment

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

This looks great; just one comment and then this should be good to merge 👍

testrpc/wait.go Outdated
@@ -9,10 +9,10 @@ import (

type rpcFn func(string, interface{}, interface{}) error

func WaitForLeader(t *testing.T, rpc rpcFn, dc string) {
// WaitForLeader ensures we have a leader and a node registration.
func WaitForLeader(t *testing.T, rpc rpcFn, dc, node string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like maybe a leftover (unintentional) change - changing this function signature would affect a lot of tests and downstream things that pull in this package to test with, like consul-template and nomad.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks!

@freddygv freddygv merged commit e305443 into hashicorp:master Aug 10, 2018
@freddygv freddygv deleted the debug-exec-tests branch August 10, 2018 19:04
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.

2 participants