mirror of https://github.com/milvus-io/milvus.git
enhance: Add scripts to use `gotestsum` to execute integration test (#31490)
See also #31489 --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/31513/head
parent
d90e01532f
commit
4da8b6607d
|
@ -219,7 +219,7 @@ jobs:
|
|||
run: |
|
||||
chmod +x build/builder.sh
|
||||
chmod +x scripts/run_intergration_test.sh
|
||||
./build/builder.sh /bin/bash -c ./scripts/run_intergration_test.sh
|
||||
./build/builder.sh /bin/bash -c "make integration-test"
|
||||
- name: Archive result
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
16
Makefile
16
Makefile
|
@ -55,6 +55,10 @@ INSTALL_GCI := $(findstring $(GCI_VERSION),$(GCI_OUTPUT))
|
|||
GOFUMPT_VERSION := 0.5.0
|
||||
GOFUMPT_OUTPUT := $(shell $(INSTALL_PATH)/gofumpt --version 2>/dev/null)
|
||||
INSTALL_GOFUMPT := $(findstring $(GOFUMPT_VERSION),$(GOFUMPT_OUTPUT))
|
||||
# gotestsum
|
||||
GOTESTSUM_VERSION := 1.11.0
|
||||
GOTESTSUM_OUTPUT := $(shell $(INSTALL_PATH)/gotestsum --version 2>/dev/null)
|
||||
INSTALL_GOTESTSUM := $(findstring $(GOTESTSUM_VERSION),$(GOTESTSUM_OUTPUT))
|
||||
|
||||
index_engine = knowhere
|
||||
|
||||
|
@ -94,6 +98,11 @@ getdeps:
|
|||
else \
|
||||
echo "Mockery v$(MOCKERY_VERSION) already installed"; \
|
||||
fi
|
||||
@if [ -z "$(INSTALL_GOTESTSUM)" ]; then \
|
||||
echo "Install gotestsum v$(GOTESTSUM_VERSION) to ./bin/" && curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v$(GOTESTSUM_VERSION)/gotestsum_$(GOTESTSUM_VERSION)_linux_amd64.tar.gz" | tar -xz -C ./bin/ gotestsum ; \
|
||||
else \
|
||||
echo "gotestsum v$(GOTESTSUM_VERSION) already installed";\
|
||||
fi
|
||||
|
||||
tools/bin/revive: tools/check/go.mod
|
||||
cd tools/check; \
|
||||
|
@ -166,12 +175,13 @@ meta-migration:
|
|||
-tags dynamic -o $(INSTALL_PATH)/meta-migration $(MIGRATION_PATH)/main.go 1>/dev/null
|
||||
|
||||
INTERATION_PATH = $(PWD)/tests/integration
|
||||
integration-test:
|
||||
integration-test: getdeps
|
||||
@echo "Building integration tests ..."
|
||||
@source $(PWD)/scripts/setenv.sh && \
|
||||
@(env bash $(PWD)/scripts/run_intergration_test.sh "$(INSTALL_PATH)/gotestsum --")
|
||||
#@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)'" \
|
||||
-tags dynamic -o $(INSTALL_PATH)/integration-test $(INTERATION_PATH)/ 1>/dev/null
|
||||
-tags dynamic -o $(INSTALL_PATH)/integration-test $(INTERATION_PATH)/ #1>/dev/null
|
||||
|
||||
BUILD_TAGS = $(shell git describe --tags --always --dirty="-dev")
|
||||
BUILD_TAGS_GPU = ${BUILD_TAGS}-gpu
|
||||
|
|
|
@ -23,20 +23,25 @@ FILE_COVERAGE_INFO="it_coverage.txt"
|
|||
BASEDIR=$(dirname "$0")
|
||||
source $BASEDIR/setenv.sh
|
||||
|
||||
set -ex
|
||||
TEST_CMD=$@
|
||||
if [ -z "$TEST_CMD" ]; then
|
||||
TEST_CMD="go test"
|
||||
fi
|
||||
|
||||
set -e
|
||||
echo "mode: atomic" > ${FILE_COVERAGE_INFO}
|
||||
|
||||
# starting the timer
|
||||
beginTime=`date +%s`
|
||||
|
||||
for d in $(go list ./tests/integration/...); do
|
||||
echo "Testing $d"
|
||||
echo "Start to run integration test under \"$d\" pkg"
|
||||
if [[ $d == *"coordrecovery"* ]]; then
|
||||
echo "running coordrecovery"
|
||||
# simplified command to speed up coord init test since it is large.
|
||||
go test -tags dynamic -v -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=20m -timeout=30m
|
||||
$TEST_CMD -tags dynamic -v -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=20m -timeout=30m
|
||||
else
|
||||
go test -race -tags dynamic -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=15m -timeout=30m
|
||||
$TEST_CMD -race -tags dynamic -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=15m -timeout=30m
|
||||
fi
|
||||
if [ -f profile.out ]; then
|
||||
grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ${FILE_COVERAGE_INFO}
|
||||
|
|
Loading…
Reference in New Issue