Skip to content

Commit

Permalink
fix: data race in test
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Mar 1, 2022
1 parent 3c890ed commit 40ddaff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/replicate_automatically_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func TestReplicateAutomatically(t *testing.T) {

infinity := -1
go func() {
defer cancel()
for event := range sub2.Out() {
switch e := event.(type) {
case stores.EventReplicateProgress:
Expand Down Expand Up @@ -264,7 +265,7 @@ func TestReplicateAutomatically(t *testing.T) {
require.Equal(t, string(result1[i].GetValue()), string(result2[i].GetValue()))
}

cancel()
return
}
}
}()
Expand All @@ -275,6 +276,7 @@ func TestReplicateAutomatically(t *testing.T) {
}

<-subCtx.Done()

require.True(t, hasAllResults)
})
}
Expand Down

0 comments on commit 40ddaff

Please sign in to comment.