File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -311,9 +311,6 @@ func (r *Reader) run(cg *ConsumerGroup) {
311311 for _ , partition := range partitions {
312312 assignedPartitions = append (assignedPartitions , partition .ID )
313313 }
314- sort .Slice (assignedPartitions , func (i , j int ) bool {
315- return assignedPartitions [i ] < assignedPartitions [j ]
316- })
317314 assignments = append (assignments , GroupMemberTopic {
318315 Topic : topic ,
319316 Partitions : assignedPartitions ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "net"
1111 "os"
1212 "reflect"
13+ "sort"
1314 "strconv"
1415 "sync"
1516 "testing"
@@ -891,7 +892,7 @@ func TestReaderConsumerGroup(t *testing.T) {
891892 }
892893}
893894
894- func TestAssignmentListener (t * testing.T ) {
895+ func TestPartitionAssignmentListener (t * testing.T ) {
895896 // It appears that some of the tests depend on all these tests being
896897 // run concurrently to pass... this is brittle and should be fixed
897898 // at some point.
@@ -917,6 +918,12 @@ func TestAssignmentListener(t *testing.T) {
917918 AssignmentListener : func (partitions []GroupMemberTopic ) {
918919 lock .Lock ()
919920 defer lock .Unlock ()
921+ // we sort the received partitions for easier comparison
922+ for _ , partition := range partitions {
923+ sort .Slice (partition .Partitions , func (i , j int ) bool {
924+ return partition .Partitions [i ] < partition .Partitions [j ]
925+ })
926+ }
920927 assignments = append (assignments , partitions )
921928 },
922929 })
You can’t perform that action at this time.
0 commit comments