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) {
1374
1374
// than partitions in a group.
1375
1375
// https://github.com/segmentio/kafka-go/issues/200
1376
1376
func TestRebalanceTooManyConsumers (t * testing.T ) {
1377
- ctx := context .Background ()
1377
+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
1378
+ defer cancel ()
1379
+
1378
1380
conf := ReaderConfig {
1379
1381
Brokers : []string {"localhost:9092" },
1380
1382
GroupID : makeGroupID (),
@@ -1384,8 +1386,15 @@ func TestRebalanceTooManyConsumers(t *testing.T) {
1384
1386
1385
1387
// Create the first reader and wait for it to become the leader.
1386
1388
r1 := NewReader (conf )
1389
+
1390
+ // Give the reader some time to setup before reading a message
1391
+ time .Sleep (1 * time .Second )
1387
1392
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
+ }
1389
1398
// Clear the stats from the first rebalance.
1390
1399
r1 .Stats ()
1391
1400
You can’t perform that action at this time.
0 commit comments