mirror of https://github.com/milvus-io/milvus.git
enhance: make integration test case timeout configurable (#30073)
currently integration test may timeout if any case run time is above 3 minutes. This duration was hard coded. This PR change this duration into a customized parameter and could be passed via test running commands. --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/30076/head
parent
0d4e781f69
commit
9f8eb0e527
|
@ -31,7 +31,7 @@ beginTime=`date +%s`
|
||||||
|
|
||||||
for d in $(go list ./tests/integration/...); do
|
for d in $(go list ./tests/integration/...); do
|
||||||
echo "$d"
|
echo "$d"
|
||||||
go test -race -tags dynamic -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d" -timeout=30m
|
go test -race -tags dynamic -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=15m -timeout=30m
|
||||||
if [ -f profile.out ]; then
|
if [ -f profile.out ]; then
|
||||||
grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ${FILE_COVERAGE_INFO}
|
grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ${FILE_COVERAGE_INFO}
|
||||||
rm profile.out
|
rm profile.out
|
||||||
|
|
|
@ -18,7 +18,7 @@ package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math/rand"
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -30,6 +30,12 @@ import (
|
||||||
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var caseTimeout time.Duration
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.DurationVar(&caseTimeout, "caseTimeout", 10*time.Minute, "timeout duration for single case")
|
||||||
|
}
|
||||||
|
|
||||||
// EmbedEtcdSuite contains embed setup & teardown related logic
|
// EmbedEtcdSuite contains embed setup & teardown related logic
|
||||||
type EmbedEtcdSuite struct {
|
type EmbedEtcdSuite struct {
|
||||||
EtcdServer *embed.Etcd
|
EtcdServer *embed.Etcd
|
||||||
|
@ -66,7 +72,6 @@ type MiniClusterSuite struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MiniClusterSuite) SetupSuite() {
|
func (s *MiniClusterSuite) SetupSuite() {
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
s.Require().NoError(s.SetupEmbedEtcd())
|
s.Require().NoError(s.SetupEmbedEtcd())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +89,8 @@ func (s *MiniClusterSuite) SetupTest() {
|
||||||
|
|
||||||
params = paramtable.Get()
|
params = paramtable.Get()
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*180)
|
s.T().Log("Setup case timeout", caseTimeout)
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), caseTimeout)
|
||||||
s.cancelFunc = cancel
|
s.cancelFunc = cancel
|
||||||
c, err := StartMiniClusterV2(ctx, func(c *MiniClusterV2) {
|
c, err := StartMiniClusterV2(ctx, func(c *MiniClusterV2) {
|
||||||
// change config etcd endpoints
|
// change config etcd endpoints
|
||||||
|
|
Loading…
Reference in New Issue