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
congqixia 2024-01-18 12:22:54 +08:00 committed by GitHub
parent 0d4e781f69
commit 9f8eb0e527
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -31,7 +31,7 @@ beginTime=`date +%s`
for d in $(go list ./tests/integration/...); do
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
grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ${FILE_COVERAGE_INFO}
rm profile.out

View File

@ -18,7 +18,7 @@ package integration
import (
"context"
"math/rand"
"flag"
"os"
"strings"
"time"
@ -30,6 +30,12 @@ import (
"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
type EmbedEtcdSuite struct {
EtcdServer *embed.Etcd
@ -66,7 +72,6 @@ type MiniClusterSuite struct {
}
func (s *MiniClusterSuite) SetupSuite() {
rand.Seed(time.Now().UnixNano())
s.Require().NoError(s.SetupEmbedEtcd())
}
@ -84,7 +89,8 @@ func (s *MiniClusterSuite) SetupTest() {
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
c, err := StartMiniClusterV2(ctx, func(c *MiniClusterV2) {
// change config etcd endpoints