milvus/internal/cdc/resource/test_utility.go
yihao.dai 51f69f32d0
feat: Add CDC support (#44124)
This PR implements a new CDC service for Milvus 2.6, providing log-based
cross-cluster replication.

issue: https://github.com/milvus-io/milvus/issues/44123

---------

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
Signed-off-by: chyezh <chyezh@outlook.com>
Co-authored-by: chyezh <chyezh@outlook.com>
2025-09-16 16:32:01 +08:00

38 lines
959 B
Go

//go:build test
// +build test
package resource
import (
"testing"
"github.com/milvus-io/milvus/internal/cdc/cluster"
"github.com/milvus-io/milvus/internal/cdc/controller"
"github.com/milvus-io/milvus/internal/cdc/replication"
"github.com/milvus-io/milvus/internal/mocks/mock_metastore"
"github.com/milvus-io/milvus/pkg/v2/mocks/mock_kv"
)
// InitForTest initializes the singleton of resources for test.
func InitForTest(t *testing.T, opts ...optResourceInit) {
r = &resourceImpl{}
for _, opt := range opts {
opt(r)
}
if r.metaKV == nil {
r.metaKV = mock_kv.NewMockMetaKv(t)
}
if r.catalog == nil {
r.catalog = mock_metastore.NewMockReplicationCatalog(t)
}
if r.clusterClient == nil {
r.clusterClient = cluster.NewMockClusterClient(t)
}
if r.replicateManagerClient == nil {
r.replicateManagerClient = replication.NewMockReplicateManagerClient(t)
}
if r.controller == nil {
r.controller = controller.NewMockController(t)
}
}