milvus/internal/metastore/model/partition_test.go
Jiquan Long a5e2d6b6fb
Refactor RootCoord (#18930)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
Co-authored-by: xaxys <tpnnghd@163.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
Co-authored-by: xaxys <tpnnghd@163.com>
2022-09-05 13:29:11 +08:00

48 lines
1.0 KiB
Go

package model
import (
"testing"
)
func TestCheckPartitionsEqual(t *testing.T) {
type args struct {
partitionsA []*Partition
partitionsB []*Partition
}
tests := []struct {
name string
args args
want bool
}{
{
// length not match.
args: args{
partitionsA: []*Partition{{PartitionName: "_default"}},
partitionsB: []*Partition{},
},
want: false,
},
{
args: args{
partitionsA: []*Partition{{PartitionName: "_default"}},
partitionsB: []*Partition{{PartitionName: "not_default"}},
},
want: false,
},
{
args: args{
partitionsA: []*Partition{{PartitionName: "_default"}, {PartitionName: "not_default"}},
partitionsB: []*Partition{{PartitionName: "_default"}, {PartitionName: "not_default"}},
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CheckPartitionsEqual(tt.args.partitionsA, tt.args.partitionsB); got != tt.want {
t.Errorf("CheckPartitionsEqual() = %v, want %v", got, tt.want)
}
})
}
}