2024-07-02 06:42:08 +00:00
|
|
|
package resource
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
clientv3 "go.etcd.io/etcd/client/v3"
|
|
|
|
|
2024-08-03 23:40:15 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/mocks/mock_metastore"
|
2025-01-09 08:46:56 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/types"
|
2024-08-12 10:58:25 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
2025-01-09 08:46:56 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/util/syncutil"
|
2024-07-02 06:42:08 +00:00
|
|
|
)
|
|
|
|
|
2024-08-19 13:22:56 +00:00
|
|
|
func TestApply(t *testing.T) {
|
2024-08-12 10:58:25 +00:00
|
|
|
paramtable.Init()
|
|
|
|
|
2024-08-19 13:22:56 +00:00
|
|
|
Apply()
|
|
|
|
Apply(OptETCD(&clientv3.Client{}))
|
2025-01-09 08:46:56 +00:00
|
|
|
Apply(OptRootCoordClient(syncutil.NewFuture[types.RootCoordClient]()))
|
2024-08-19 13:22:56 +00:00
|
|
|
|
2024-07-02 06:42:08 +00:00
|
|
|
assert.Panics(t, func() {
|
2024-08-19 13:22:56 +00:00
|
|
|
Done()
|
2024-07-02 06:42:08 +00:00
|
|
|
})
|
2024-08-19 13:22:56 +00:00
|
|
|
|
|
|
|
Apply(
|
2024-07-25 04:19:44 +00:00
|
|
|
OptETCD(&clientv3.Client{}),
|
2025-01-09 08:46:56 +00:00
|
|
|
OptRootCoordClient(syncutil.NewFuture[types.RootCoordClient]()),
|
|
|
|
OptDataCoordClient(syncutil.NewFuture[types.DataCoordClient]()),
|
2024-08-03 23:40:15 +00:00
|
|
|
OptStreamingNodeCatalog(mock_metastore.NewMockStreamingNodeCataLog(t)),
|
2024-07-25 04:19:44 +00:00
|
|
|
)
|
2024-08-19 13:22:56 +00:00
|
|
|
Done()
|
2024-07-02 06:42:08 +00:00
|
|
|
|
2024-07-16 07:49:38 +00:00
|
|
|
assert.NotNil(t, Resource().TSOAllocator())
|
2024-07-02 06:42:08 +00:00
|
|
|
assert.NotNil(t, Resource().ETCD())
|
|
|
|
assert.NotNil(t, Resource().RootCoordClient())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInitForTest(t *testing.T) {
|
2024-08-03 23:40:15 +00:00
|
|
|
InitForTest(t)
|
2024-07-02 06:42:08 +00:00
|
|
|
}
|