Fix flaky TestJoinMembersWithRetryBackoff#412
Merged
dimitarvdimitrov merged 3 commits intomainfrom Oct 26, 2023
Merged
Conversation
```
memberlist_client_test.go:898:
Error Trace: /Users/dimitar/grafana/dskit/kv/memberlist/memberlist_client_test.go:898
/Users/dimitar/grafana/dskit/kv/memberlist/asm_arm64.s:1197
Error: Received unexpected error:
Member-2 failed to join the cluster: &{[%!f(*errors.errorString=&{Failed to join 127.0.0.1:57493: dial tcp 127.0.0.1:57493: connect: connection refused})] %!f(multierror.ErrorFormatFunc=<nil>)}
Test: TestJoinMembersWithRetryBackoff/Test_late_start_of_DNS_service
```
The failure was caused by the test clients starting and expecting to connect to a KV which still wasn't started.
This is unrelated with the backoff that the test asserts on (the backoff happens effectively in the call `err = services.StartAndAwaitRunning(context.Background(), mkv)`).
2 tasks
pstibrany
reviewed
Oct 26, 2023
| if err != nil { | ||
| t.Errorf("failed to start KV: %v", err) | ||
| } | ||
| kvsStarted.Done() |
Contributor
There was a problem hiding this comment.
We should probably use defer kvsStarted.Done() in this function, to unblock the main test goroutine even if starting of KVs fails.
Contributor
Author
There was a problem hiding this comment.
we can to run kvsStarted.Done() before running runClient. And t.Errorf continues the execution of the test
Don't we want to abort the test if a kv cannot start? I changed it so that we abort if the kv store cannot start and call kvsStarted.Done() regardless if the kv store started successfully or failed. See da2d513
Contributor
There was a problem hiding this comment.
Thanks, I think that should do it.
pstibrany
approved these changes
Oct 26, 2023
| if err != nil { | ||
| t.Errorf("failed to start KV: %v", err) | ||
| } | ||
| kvsStarted.Done() |
Contributor
There was a problem hiding this comment.
Thanks, I think that should do it.
ying-jeanne
pushed a commit
that referenced
this pull request
Nov 2, 2023
* Fix flaky `TestJoinMembersWithRetryBackoff`
```
memberlist_client_test.go:898:
Error Trace: /Users/dimitar/grafana/dskit/kv/memberlist/memberlist_client_test.go:898
/Users/dimitar/grafana/dskit/kv/memberlist/asm_arm64.s:1197
Error: Received unexpected error:
Member-2 failed to join the cluster: &{[%!f(*errors.errorString=&{Failed to join 127.0.0.1:57493: dial tcp 127.0.0.1:57493: connect: connection refused})] %!f(multierror.ErrorFormatFunc=<nil>)}
Test: TestJoinMembersWithRetryBackoff/Test_late_start_of_DNS_service
```
The failure was caused by the test clients starting and expecting to connect to a KV which still wasn't started.
This is unrelated with the backoff that the test asserts on (the backoff happens effectively in the call `err = services.StartAndAwaitRunning(context.Background(), mkv)`).
* Clean up logger
* abort running client if kv starting fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The failure was caused by the test clients starting and expecting to connect to a KV which still wasn't started. This is unrelated with the backoff that the test asserts on (the backoff happens effectively in the call
err = services.StartAndAwaitRunning(context.Background(), mkv)).