Skip to content

Commit

Permalink
consumer: fix test case data race
Browse files Browse the repository at this point in the history
Test must wait for the shard to react to the assignment and update its
status, to avoid a data race when modifying WatchApplyDelay again.
  • Loading branch information
jgraettinger committed Feb 14, 2022
1 parent a21a5b8 commit 443ab90
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions consumer/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ func TestResolverShardTransitions(t *testing.T) {
tf.ks.WatchApplyDelay = 3 * time.Millisecond
tf.allocateShardNoWait(makeShard(shardB))
tf.allocateShard(makeShard(shardB), localID)

expectStatusCode(t, tf.state, pc.ReplicaStatus_PRIMARY)
tf.ks.WatchApplyDelay = 0

// Expect a new shard |newB| is created, and the prior |sB| is cancelled.
Expand Down

0 comments on commit 443ab90

Please sign in to comment.