fix unstable ut due to unstable sort of unique set (#27302)

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
pull/27329/head
MrPresent-Han 2023-09-22 19:07:26 +08:00 committed by GitHub
parent fa06265756
commit 4b12cb8847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -19,6 +19,7 @@ package querycoordv2
import (
"context"
"encoding/json"
"sort"
"testing"
"time"
@ -1768,7 +1769,7 @@ func (suite *ServiceSuite) updateChannelDist(collection int64) {
replicas := suite.meta.ReplicaManager.GetByCollection(collection)
for _, replica := range replicas {
i := 0
for _, node := range replica.GetNodes() {
for _, node := range suite.sortInt64(replica.GetNodes()) {
suite.dist.ChannelDistManager.Update(node, meta.DmChannelFromVChannel(&datapb.VchannelInfo{
CollectionID: collection,
ChannelName: channels[i],
@ -1792,13 +1793,20 @@ func (suite *ServiceSuite) updateChannelDist(collection int64) {
}
}
func (suite *ServiceSuite) sortInt64(ints []int64) []int64 {
sort.Slice(ints, func(i int, j int) bool {
return ints[i] < ints[j]
})
return ints
}
func (suite *ServiceSuite) updateChannelDistWithoutSegment(collection int64) {
channels := suite.channels[collection]
replicas := suite.meta.ReplicaManager.GetByCollection(collection)
for _, replica := range replicas {
i := 0
for _, node := range replica.GetNodes() {
for _, node := range suite.sortInt64(replica.GetNodes()) {
suite.dist.ChannelDistManager.Update(node, meta.DmChannelFromVChannel(&datapb.VchannelInfo{
CollectionID: collection,
ChannelName: channels[i],