Skip to content

Commit

Permalink
fix race in discovery tests
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed May 9, 2023
1 parent 7f556f0 commit ff2d2b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions share/availability/discovery/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
func TestDiscovery(t *testing.T) {
const nodes = 10 // higher number brings higher coverage

discoveryRetryTimeout = time.Millisecond * 100 // defined in discovery.go

ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
t.Cleanup(cancel)

Expand All @@ -28,7 +30,6 @@ func TestDiscovery(t *testing.T) {
WithPeersLimit(nodes),
WithAdvertiseInterval(-1),
)
discoveryRetryTimeout = time.Millisecond * 100 // defined in discovery.go

type peerUpdate struct {
peerID peer.ID
Expand All @@ -42,7 +43,6 @@ func TestDiscovery(t *testing.T) {
discs := make([]*Discovery, nodes)
for i := range discs {
discs[i] = tn.discovery(WithPeersLimit(0), WithAdvertiseInterval(time.Millisecond*100))
discoveryRetryTimeout = -1 // defined in discovery.go

select {
case res := <-updateCh:
Expand Down

0 comments on commit ff2d2b0

Please sign in to comment.