mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 19:39:21 +08:00
Add integration test make cmd (#22009)
Signed-off-by: wayblink <anyang.wang@zilliz.com>
This commit is contained in:
parent
7adabe09f1
commit
2265e81d97
10
Makefile
10
Makefile
@ -74,6 +74,7 @@ else
|
||||
@echo "Running $@ check"
|
||||
@GO111MODULE=on env bash $(PWD)/scripts/gofmt.sh cmd/
|
||||
@GO111MODULE=on env bash $(PWD)/scripts/gofmt.sh internal/
|
||||
@GO111MODULE=on env bash $(PWD)/scripts/gofmt.sh tests/integration/
|
||||
@GO111MODULE=on env bash $(PWD)/scripts/gofmt.sh tests/go/
|
||||
endif
|
||||
|
||||
@ -87,6 +88,7 @@ static-check: getdeps
|
||||
@GO111MODULE=on $(INSTALL_PATH)/golangci-lint cache clean
|
||||
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./internal/...
|
||||
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./cmd/...
|
||||
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./tests/integration/...
|
||||
|
||||
verifiers: build-cpp getdeps cppcheck fmt static-check
|
||||
|
||||
@ -105,6 +107,14 @@ meta-migration:
|
||||
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
|
||||
${APPLE_SILICON_FLAG} -o $(INSTALL_PATH)/meta-migration $(MIGRATION_PATH)/main.go 1>/dev/null
|
||||
|
||||
INTERATION_PATH = $(PWD)/tests/integration
|
||||
integration-test:
|
||||
@echo "Building integration tests ..."
|
||||
@source $(PWD)/scripts/setenv.sh && \
|
||||
mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && \
|
||||
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
|
||||
${APPLE_SILICON_FLAG} -o $(INSTALL_PATH)/integration-test $(INTERATION_PATH)/ 1>/dev/null
|
||||
|
||||
BUILD_TAGS = $(shell git describe --tags --always --dirty="-dev")
|
||||
BUILD_TIME = $(shell date -u)
|
||||
GIT_COMMIT = $(shell git rev-parse --short HEAD)
|
||||
|
@ -125,6 +125,7 @@ func TestHelloMilvus(t *testing.T) {
|
||||
HashKeys: hashKeys,
|
||||
NumRows: uint32(rowNum),
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, insertResult.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
|
||||
|
||||
// flush
|
||||
@ -150,7 +151,7 @@ func TestHelloMilvus(t *testing.T) {
|
||||
SegmentIDs: ids,
|
||||
})
|
||||
if err != nil {
|
||||
panic(errors.New("GetFlushState failed"))
|
||||
//panic(errors.New("GetFlushState failed"))
|
||||
return false
|
||||
}
|
||||
return resp.GetFlushed()
|
||||
@ -193,6 +194,7 @@ func TestHelloMilvus(t *testing.T) {
|
||||
if createIndexStatus.GetErrorCode() != commonpb.ErrorCode_Success {
|
||||
log.Warn("createIndexStatus fail reason", zap.String("reason", createIndexStatus.GetReason()))
|
||||
}
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, commonpb.ErrorCode_Success, createIndexStatus.GetErrorCode())
|
||||
|
||||
// load
|
||||
@ -200,16 +202,12 @@ func TestHelloMilvus(t *testing.T) {
|
||||
DbName: dbName,
|
||||
CollectionName: collectionName,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
if loadStatus.GetErrorCode() != commonpb.ErrorCode_Success {
|
||||
log.Warn("loadStatus fail reason", zap.String("reason", loadStatus.GetReason()))
|
||||
}
|
||||
assert.Equal(t, commonpb.ErrorCode_Success, loadStatus.GetErrorCode())
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
errors.New("context deadline exceeded")
|
||||
default:
|
||||
}
|
||||
loadProgress, err := c.proxy.GetLoadingProgress(ctx, &milvuspb.GetLoadingProgressRequest{
|
||||
CollectionName: collectionName,
|
||||
})
|
||||
|
@ -38,6 +38,7 @@ import (
|
||||
func TestShowSessions(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
c, err := StartMiniCluster(ctx)
|
||||
assert.NoError(t, err)
|
||||
err = c.Start()
|
||||
assert.NoError(t, err)
|
||||
defer c.Stop()
|
||||
@ -55,6 +56,7 @@ func TestShowSessions(t *testing.T) {
|
||||
func TestShowSegments(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
c, err := StartMiniCluster(ctx)
|
||||
assert.NoError(t, err)
|
||||
err = c.Start()
|
||||
assert.NoError(t, err)
|
||||
defer c.Stop()
|
||||
@ -132,6 +134,7 @@ func TestShowSegments(t *testing.T) {
|
||||
HashKeys: hashKeys,
|
||||
NumRows: uint32(rowNum),
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, insertResult.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
|
||||
|
||||
segments, err := c.metaWatcher.ShowSegments()
|
||||
@ -226,6 +229,7 @@ func TestShowReplicas(t *testing.T) {
|
||||
HashKeys: hashKeys,
|
||||
NumRows: uint32(rowNum),
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, insertResult.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
|
||||
|
||||
// flush
|
||||
@ -251,7 +255,7 @@ func TestShowReplicas(t *testing.T) {
|
||||
SegmentIDs: ids,
|
||||
})
|
||||
if err != nil {
|
||||
panic(errors.New("GetFlushState failed"))
|
||||
//panic(errors.New("GetFlushState failed"))
|
||||
return false
|
||||
}
|
||||
return resp.GetFlushed()
|
||||
@ -291,6 +295,7 @@ func TestShowReplicas(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
if createIndexStatus.GetErrorCode() != commonpb.ErrorCode_Success {
|
||||
log.Warn("createIndexStatus fail reason", zap.String("reason", createIndexStatus.GetReason()))
|
||||
}
|
||||
@ -301,16 +306,12 @@ func TestShowReplicas(t *testing.T) {
|
||||
DbName: dbName,
|
||||
CollectionName: collectionName,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
if loadStatus.GetErrorCode() != commonpb.ErrorCode_Success {
|
||||
log.Warn("loadStatus fail reason", zap.String("reason", loadStatus.GetReason()))
|
||||
}
|
||||
assert.Equal(t, commonpb.ErrorCode_Success, loadStatus.GetErrorCode())
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
errors.New("context deadline exceeded")
|
||||
default:
|
||||
}
|
||||
loadProgress, err := c.proxy.GetLoadingProgress(ctx, &milvuspb.GetLoadingProgressRequest{
|
||||
CollectionName: collectionName,
|
||||
})
|
||||
|
@ -121,7 +121,8 @@ func StartMiniCluster(ctx context.Context, opts ...Option) (cluster *MiniCluster
|
||||
cluster = &MiniCluster{
|
||||
ctx: ctx,
|
||||
}
|
||||
Params.InitOnce()
|
||||
//Params.InitOnce()
|
||||
Params.Init()
|
||||
cluster.params = DefaultParams()
|
||||
cluster.clusterConfig = DefaultClusterConfig()
|
||||
for _, opt := range opts {
|
||||
@ -555,7 +556,7 @@ func (cluster *MiniCluster) CreateDefaultDataCoord() (types.DataCoordComponent,
|
||||
}
|
||||
|
||||
func (cluster *MiniCluster) CreateDefaultQueryCoord() (types.QueryCoordComponent, error) {
|
||||
queryCoord, err := querycoord.NewQueryCoord(cluster.ctx, cluster.factory)
|
||||
queryCoord, err := querycoord.NewQueryCoord(cluster.ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -1147,9 +1148,8 @@ func (cluster *MiniCluster) UpdateClusterSize(clusterConfig ClusterConfig) error
|
||||
func (cluster *MiniCluster) GetProxy(ctx context.Context, addr string) (types.Proxy, error) {
|
||||
if cluster.proxy.GetAddress() == addr {
|
||||
return cluster.proxy, nil
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (cluster *MiniCluster) GetQueryNode(ctx context.Context, addr string) (types.QueryNode, error) {
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
func TestAddRemoveDataNode(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
c, err := StartMiniCluster(ctx)
|
||||
assert.NoError(t, err)
|
||||
err = c.Start()
|
||||
assert.NoError(t, err)
|
||||
defer c.Stop()
|
||||
@ -67,6 +68,7 @@ func TestAddRemoveDataNode(t *testing.T) {
|
||||
func TestAddRemoveQueryNode(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
c, err := StartMiniCluster(ctx)
|
||||
assert.NoError(t, err)
|
||||
err = c.Start()
|
||||
assert.NoError(t, err)
|
||||
defer c.Stop()
|
||||
@ -105,6 +107,7 @@ func TestAddRemoveQueryNode(t *testing.T) {
|
||||
func TestAddRemoveIndexNode(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
c, err := StartMiniCluster(ctx)
|
||||
assert.NoError(t, err)
|
||||
err = c.Start()
|
||||
assert.NoError(t, err)
|
||||
defer c.Stop()
|
||||
@ -143,6 +146,7 @@ func TestAddRemoveIndexNode(t *testing.T) {
|
||||
func TestUpdateClusterSize(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
c, err := StartMiniCluster(ctx)
|
||||
assert.NoError(t, err)
|
||||
err = c.Start()
|
||||
assert.NoError(t, err)
|
||||
defer c.Stop()
|
||||
|
Loading…
Reference in New Issue
Block a user