File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1374,7 +1374,9 @@ func TestCommitOffsetsWithRetry(t *testing.T) {
13741374// than partitions in a group.
13751375// https://github.com/segmentio/kafka-go/issues/200
13761376func TestRebalanceTooManyConsumers (t * testing.T ) {
1377- ctx := context .Background ()
1377+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
1378+ defer cancel ()
1379+
13781380 conf := ReaderConfig {
13791381 Brokers : []string {"localhost:9092" },
13801382 GroupID : makeGroupID (),
@@ -1384,8 +1386,15 @@ func TestRebalanceTooManyConsumers(t *testing.T) {
13841386
13851387 // Create the first reader and wait for it to become the leader.
13861388 r1 := NewReader (conf )
1389+
1390+ // Give the reader some time to setup before reading a message
1391+ time .Sleep (1 * time .Second )
13871392 prepareReader (t , ctx , r1 , makeTestSequence (1 )... )
1388- r1 .ReadMessage (ctx )
1393+
1394+ _ , err := r1 .ReadMessage (ctx )
1395+ if err != nil {
1396+ t .Fatalf ("failed to read message: %v" , err )
1397+ }
13891398 // Clear the stats from the first rebalance.
13901399 r1 .Stats ()
13911400
You can’t perform that action at this time.
0 commit comments