File tree 2 files changed +8
-4
lines changed
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) {
311
311
for _ , partition := range partitions {
312
312
assignedPartitions = append (assignedPartitions , partition .ID )
313
313
}
314
- sort .Slice (assignedPartitions , func (i , j int ) bool {
315
- return assignedPartitions [i ] < assignedPartitions [j ]
316
- })
317
314
assignments = append (assignments , GroupMemberTopic {
318
315
Topic : topic ,
319
316
Partitions : assignedPartitions ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"net"
11
11
"os"
12
12
"reflect"
13
+ "sort"
13
14
"strconv"
14
15
"sync"
15
16
"testing"
@@ -891,7 +892,7 @@ func TestReaderConsumerGroup(t *testing.T) {
891
892
}
892
893
}
893
894
894
- func TestAssignmentListener (t * testing.T ) {
895
+ func TestPartitionAssignmentListener (t * testing.T ) {
895
896
// It appears that some of the tests depend on all these tests being
896
897
// run concurrently to pass... this is brittle and should be fixed
897
898
// at some point.
@@ -917,6 +918,12 @@ func TestAssignmentListener(t *testing.T) {
917
918
AssignmentListener : func (partitions []GroupMemberTopic ) {
918
919
lock .Lock ()
919
920
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
+ }
920
927
assignments = append (assignments , partitions )
921
928
},
922
929
})
You can’t perform that action at this time.
0 commit comments