mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-11 01:16:09 +08:00
18df2ba6fd
Support Database(#23742) Fix db nonexists error for FlushAll (#24222) Fix check collection limits fails (#24235) backward compatibility with empty DB name (#24317) Fix GetFlushAllState with DB (#24347) Remove db from global meta cache after drop database (#24474) Fix db name is empty for describe collection response (#24603) Add RBAC for Database API (#24653) Fix miss load the same name collection during recover stage (#24941) RBAC supports Database validation (#23609) Fix to list grant with db return empty (#23922) Optimize PrivilegeAll permission check (#23972) Add the default db value for the rbac request (#24307) Signed-off-by: jaime <yun.zhang@zilliz.com> Co-authored-by: SimFG <bang.fu@zilliz.com> Co-authored-by: longjiquan <jiquan.long@zilliz.com>
50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package model
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
|
)
|
|
|
|
var (
|
|
dbPB = &etcdpb.DatabaseInfo{
|
|
TenantId: "1",
|
|
Name: "test",
|
|
Id: 1,
|
|
CreatedTime: 1,
|
|
State: etcdpb.DatabaseState_DatabaseCreated,
|
|
}
|
|
|
|
dbModel = &Database{
|
|
TenantID: "1",
|
|
Name: "test",
|
|
ID: 1,
|
|
CreatedTime: 1,
|
|
State: etcdpb.DatabaseState_DatabaseCreated,
|
|
}
|
|
)
|
|
|
|
func TestMarshalDatabaseModel(t *testing.T) {
|
|
ret := MarshalDatabaseModel(dbModel)
|
|
assert.Equal(t, dbPB, ret)
|
|
assert.Nil(t, MarshalDatabaseModel(nil))
|
|
}
|
|
|
|
func TestUnmarshalDatabaseModel(t *testing.T) {
|
|
ret := UnmarshalDatabaseModel(dbPB)
|
|
assert.Equal(t, dbModel, ret)
|
|
assert.Nil(t, UnmarshalDatabaseModel(nil))
|
|
}
|
|
|
|
func TestDatabaseCloneAndEqual(t *testing.T) {
|
|
clone := dbModel.Clone()
|
|
assert.Equal(t, dbModel, clone)
|
|
}
|
|
|
|
func TestDatabaseAvailable(t *testing.T) {
|
|
assert.True(t, dbModel.Available())
|
|
assert.True(t, NewDefaultDatabase().Available())
|
|
}
|