Skip to content

Commit

Permalink
Fix grpc tests sleep between connections (#5778)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?

Previously there was no sleep when `testc.EmptyCall` returned an error,
so it was easy to blow throw 3000 attempts with no sleep whatsoever.

## Description of the changes

Sleep at the beginning of call iterations (except the first one).

## How was this change tested?

It no longer fails in our internal aarch64 CI with this patch.

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: Ivan Babrou <[email protected]>
  • Loading branch information
bobrik authored Jul 26, 2024
1 parent 0e9c96a commit 5bf667e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/discovery/grpcresolver/grpc_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ func makeSureConnectionsUp(t *testing.T, count int, testc grpc_testing.TestServi
for si := 0; si < count; si++ {
connected := false
for i := 0; i < 3000; i++ { // 3000 * 10ms = 30s
if i != 0 {
time.Sleep(time.Millisecond * 10)
}
_, err := testc.EmptyCall(context.Background(), &grpc_testing.Empty{}, grpc.Peer(&p))
if err != nil {
continue
Expand All @@ -98,7 +101,6 @@ func makeSureConnectionsUp(t *testing.T, count int, testc grpc_testing.TestServi
t.Logf("connected to peer #%d (%v) on iteration %d", si, p.Addr, i)
break
}
time.Sleep(time.Millisecond * 10)
}
assert.True(t, connected, "Connection #%d was still not up. Connections so far: %+v", si, addrs)
}
Expand Down

0 comments on commit 5bf667e

Please sign in to comment.