Run unittest in CI

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
pull/4973/head^2
cai.zhang 2020-11-09 18:47:37 +08:00 committed by yefu.chen
parent be409b29c8
commit 62a59d094b
6 changed files with 10 additions and 67 deletions

View File

@ -61,6 +61,10 @@ jobs:
path: .docker
key: ubuntu${{ matrix.ubuntu }}-${{ hashFiles('internal/core/**') }}
restore-keys: ubuntu${{ matrix.ubuntu }}-
- name: Start Service
shell: bash
run: |
cd ${GITHUB_WORKSPACE}/deployments/docker && docker-compose up -d
- name: Docker Run
run: |
docker-compose run ubuntu

View File

@ -1,62 +0,0 @@
name: Test
on:
pull_request:
branches: [ main ]
jobs:
build:
name: PR Test
runs-on: ubuntu-latest
steps:
- name: Lanuch Pulsar
run : docker run -d -p 6650:6650 -p 8080:8080 apachepulsar/pulsar:2.6.0 bin/pulsar standalone
- name: Launch Etcd
run : |
docker run -d -p 2379:2379 -p 2380:2380 --name etcd \
quay.io/coreos/etcd:v3.4.9 etcd \
--name node1 \
--initial-advertise-peer-urls http://127.0.0.1:2380 \
--listen-peer-urls http://0.0.0.0:2380 \
--advertise-client-urls http://127.0.0.1:2379 \
--listen-client-urls http://0.0.0.0:2379 \
--initial-cluster node1=http://127.0.0.1:2380
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
go get gotest.tools/gotestsum
- name: Run Test
run: |
pushd internal/kv
go test -v ./...
popd
pushd internal/msgstream
go test -v ./...
popd
pushd internal/master
go test -v ./...
popd
# - name: Send test to codecov
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# run: bash <(curl -s https://codecov.io/bash)

View File

@ -16,7 +16,7 @@ GOPATH := $(shell $(GO) env GOPATH)
INSTALL_PATH := $(PWD)/bin
LIBRARY_PATH := $(PWD)/lib
all: build-cpp build-go
all: build-cpp build-go
#TODO: Use ruleguard to check code specifications
get-check-deps:
@ -68,7 +68,7 @@ build-cpp-with-unittest:
unittest: test-cpp test-go
#TODO: proxy master reader writer's unittest
test-go: verifiers build-go
test-go:
@echo "Running go unittests..."
@(env bash $(PWD)/scripts/run_go_unittest.sh)

View File

@ -10,6 +10,7 @@ x-ccache: &ccache
services:
ubuntu:
image: ${REPO}:${ARCH}-ubuntu${UBUNTU}-${SHOW_DATE}
network_mode: "host"
build:
context: .
dockerfile: build/docker/env/cpu/ubuntu${UBUNTU}/Dockerfile
@ -24,4 +25,4 @@ services:
working_dir: "/milvus-distributed"
command: &ubuntu-command >
/bin/bash -c "
make verifiers && make all"
make verifiers && make unittest"

View File

@ -28,7 +28,7 @@ for UNITTEST_DIR in "${UNITTEST_DIRS[@]}"; do
for test in `ls ${UNITTEST_DIR}`; do
echo $test " running..."
# run unittest
# ${UNITTEST_DIR}/${test}
${UNITTEST_DIR}/${test}
if [ $? -ne 0 ]; then
echo ${UNITTEST_DIR}/${test} "run failed"
exit 1

View File

@ -13,4 +13,4 @@ SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# ignore Minio,S3 unittes
MILVUS_DIR="${SCRIPTS_DIR}/../internal/"
echo $MILVUS_DIR
echo go test "${MILVUS_DIR}/storage/internal/tikv/..." "${MILVUS_DIR}/reader/..." "${MILVUS_DIR}/writer/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/proxy/..." -failfast
go test "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/reader/..." -failfast