milvus/cmd/tools/migration/backend/backup_restore_test.go
Jiquan Long a8a074162f
Add meta migration tool (#19709)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
2022-10-12 11:37:23 +08:00

32 lines
643 B
Go

package backend
import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBackupCodec_Serialize(t *testing.T) {
header := &BackupHeader{
Version: BackupHeaderVersionV1,
Instance: "/by-dev",
MetaPath: "meta",
Entries: 0,
Component: "",
Extra: nil,
}
kvs := map[string]string{
"1": "1",
"2": "2",
"3": "3",
}
codec := &BackupCodec{}
file, err := codec.Serialize(header, kvs)
assert.NoError(t, err)
gotHeader, gotEntries, err := codec.DeSerialize(file)
assert.NoError(t, err)
assert.True(t, reflect.DeepEqual(header, gotHeader))
assert.True(t, reflect.DeepEqual(kvs, gotEntries))
}