milvus/pkg/common/map_test.go
wayblink c62bf8a0b0
fix: [Cherry-pick]Pick major compaction fixs and optimizations (#34360)
This PR cherry-picks the following commits:

- fix: sync partitiion stats blocking balance task #33742
- fix: Fix meta prefix overlap bug #33830
- fix: Small fixs of major compaction #33929 
- fix: Fix memory buffer error & some renaming #33850
- fix: sync part stats task cannot be finished #34027 
- Add an option to enable/disable vector field clustering key #34097
- fix: fix error ignore in compactor #34169
- fix:load major compaction partial result #34052
- Use new stream segment reader in clustering compaction #34232

issue: #30633
pr: #33742 #33830 #33929 #33850 #34027 #34097 #34169 #34052 #34232

---------

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
Signed-off-by: wayblink <anyang.wang@zilliz.com>
Signed-off-by: MrPresent-Han <chun.han@gmail.com>
Co-authored-by: Chun Han <116052805+MrPresent-Han@users.noreply.github.com>
Co-authored-by: MrPresent-Han <chun.han@gmail.com>
2024-07-03 09:53:37 +08:00

60 lines
1011 B
Go

package common
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCloneStr2Str(t *testing.T) {
type args struct {
m Str2Str
}
tests := []struct {
name string
args args
}{
{
args: args{
m: nil,
},
},
{
args: args{
m: map[string]string{
"k1": "v1",
"k2": "v2",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := CloneStr2Str(tt.args.m)
assert.True(t, got.Equal(tt.args.m))
})
}
}
func TestMapEqual(t *testing.T) {
{
m1 := map[int64]int64{1: 11, 2: 22, 3: 33}
m2 := map[int64]int64{1: 11, 2: 22, 3: 33}
assert.True(t, MapEquals(m1, m2))
}
{
m1 := map[int64]int64{1: 11, 2: 23, 3: 33}
m2 := map[int64]int64{1: 11, 2: 22, 3: 33}
assert.False(t, MapEquals(m1, m2))
}
{
m1 := map[int64]int64{1: 11, 2: 23, 3: 33}
m2 := map[int64]int64{1: 11, 2: 22}
assert.False(t, MapEquals(m1, m2))
}
{
m1 := map[int64]int64{1: 11, 2: 23, 3: 33}
assert.False(t, MapEquals(m1, nil))
}
}