mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Enable github action for go unittest
Signed-off-by: neza2017 <yefu.chen@zilliz.com>
This commit is contained in:
parent
b441685635
commit
980084ff15
62
.github/workflows/test.yml
vendored
Normal file
62
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
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)
|
||||
@ -1,7 +1,6 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -12,9 +11,10 @@ import (
|
||||
)
|
||||
|
||||
func newKvBase() *kv.EtcdKV {
|
||||
etcdAddr := conf.Config.Etcd.Address
|
||||
etcdAddr += ":"
|
||||
etcdAddr += strconv.FormatInt(int64(conf.Config.Etcd.Port), 10)
|
||||
//etcdAddr := conf.Config.Etcd.Address
|
||||
//etcdAddr += ":"
|
||||
//etcdAddr += strconv.FormatInt(int64(conf.Config.Etcd.Port), 10)
|
||||
etcdAddr := "127.0.0.1:2379"
|
||||
cli, _ := clientv3.New(clientv3.Config{
|
||||
Endpoints: []string{etcdAddr},
|
||||
DialTimeout: 5 * time.Second,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package master
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -15,6 +16,9 @@ func TestMetaTable_Collection(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
etcd_kv := kv.NewEtcdKV(cli, "/etcd/test/root")
|
||||
|
||||
_, err = cli.Delete(context.TODO(), "/etcd/test/root", clientv3.WithPrefix())
|
||||
assert.Nil(t, err)
|
||||
|
||||
meta, err := NewMetaTable(etcd_kv)
|
||||
assert.Nil(t, err)
|
||||
defer meta.client.Close()
|
||||
@ -133,6 +137,9 @@ func TestMetaTable_DeletePartition(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
etcd_kv := kv.NewEtcdKV(cli, "/etcd/test/root")
|
||||
|
||||
_, err = cli.Delete(context.TODO(), "/etcd/test/root", clientv3.WithPrefix())
|
||||
assert.Nil(t, err)
|
||||
|
||||
meta, err := NewMetaTable(etcd_kv)
|
||||
assert.Nil(t, err)
|
||||
defer meta.client.Close()
|
||||
@ -211,6 +218,9 @@ func TestMetaTable_Segment(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
etcd_kv := kv.NewEtcdKV(cli, "/etcd/test/root")
|
||||
|
||||
_, err = cli.Delete(context.TODO(), "/etcd/test/root", clientv3.WithPrefix())
|
||||
assert.Nil(t, err)
|
||||
|
||||
meta, err := NewMetaTable(etcd_kv)
|
||||
assert.Nil(t, err)
|
||||
defer meta.client.Close()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user