Skip to content

Commit

Permalink
*: limit a single test function timeout to 4s (pingcap#13573)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored and sre-bot committed Nov 21, 2019
1 parent 0e0faee commit ebe8b09
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ ifeq ("$(TRAVIS_COVERAGE)", "1")
else
@echo "Running in native mode."
@export log_level=error; export TZ='Asia/Shanghai'; \
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) || { $(FAILPOINT_DISABLE); exit 1; }
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) -check.timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
endif
@$(FAILPOINT_DISABLE)

Expand Down
5 changes: 5 additions & 0 deletions ddl/util/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"testing"
"time"

. "github.com/pingcap/check"
"github.com/pingcap/errors"
"github.com/pingcap/parser/terror"
. "github.com/pingcap/tidb/ddl"
Expand All @@ -35,6 +36,10 @@ import (
"google.golang.org/grpc/codes"
)

func TestT(t *testing.T) {
TestingT(t)
}

const minInterval = 10 * time.Nanosecond // It's used to test timeout.

func TestSyncerSimple(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ require (
)

go 1.13

replace github.com/pingcap/check => github.com/tiancaiamao/check v0.0.0-20191119042138-8e73d07b629d
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d h1:4J9HCZVpvDmj2t
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
github.com/tiancaiamao/check v0.0.0-20191119042138-8e73d07b629d h1:TMYOU9yCm2egiuzypRgFlVDw/5LzkJZaTmT26GPyFtE=
github.com/tiancaiamao/check v0.0.0-20191119042138-8e73d07b629d/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
Expand Down
6 changes: 6 additions & 0 deletions plugin/conn_ip_example/conn_ip_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ package main_test

import (
"context"
"testing"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/plugin"
"github.com/pingcap/tidb/sessionctx/variable"
)
Expand Down Expand Up @@ -52,3 +54,7 @@ func LoadRunShutdownPluginExample() {

plugin.Shutdown(context.Background())
}

func TestT(t *testing.T) {
TestingT(t)
}
5 changes: 5 additions & 0 deletions plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ import (
"strconv"
"testing"

"github.com/pingcap/check"
"github.com/pingcap/tidb/sessionctx/variable"
)

func TestT(t *testing.T) {
check.TestingT(t)
}

func TestLoadPluginSuccess(t *testing.T) {
ctx := context.Background()

Expand Down
6 changes: 6 additions & 0 deletions sessionctx/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ package sessionctx
import (
"fmt"
"testing"

. "github.com/pingcap/check"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestBasicCtxTypeToString(t *testing.T) {
tests := []struct {
key fmt.Stringer
Expand Down
5 changes: 5 additions & 0 deletions store/tikv/oracle/oracles/pd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ import (
"testing"
"time"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/store/tikv/oracle"
"github.com/pingcap/tidb/store/tikv/oracle/oracles"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestPDOracle_UntilExpired(t *testing.T) {
lockAfter, lockExp := 10, 15
o := oracles.NewEmptyPDOracle()
Expand Down
10 changes: 9 additions & 1 deletion tidb-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

package main

import "testing"
import (
"testing"

. "github.com/pingcap/check"
)

var isCoverageServer = "0"

Expand All @@ -24,3 +28,7 @@ func TestRunMain(t *testing.T) {
main()
}
}

func TestT(t *testing.T) {
TestingT(t)
}
6 changes: 6 additions & 0 deletions util/arena/arena_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ package arena

import (
"testing"

. "github.com/pingcap/check"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestSimpleArenaAllocator(t *testing.T) {
arena := NewAllocator(1000)
slice := arena.Alloc(10)
Expand Down
5 changes: 5 additions & 0 deletions util/execdetails/execdetails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ import (
"testing"
"time"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/util/stringutil"
"github.com/pingcap/tipb/go-tipb"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestString(t *testing.T) {
detail := &ExecDetails{
ProcessTime: 2*time.Second + 5*time.Millisecond,
Expand Down
6 changes: 6 additions & 0 deletions util/hack/hack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ package hack
import (
"bytes"
"testing"

. "github.com/pingcap/check"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestString(t *testing.T) {
b := []byte("hello world")
a := String(b)
Expand Down
6 changes: 6 additions & 0 deletions util/mvmap/mvmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ import (
"fmt"
"hash/fnv"
"testing"

. "github.com/pingcap/check"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestMVMap(t *testing.T) {
m := NewMVMap()
var vals [][]byte
Expand Down
5 changes: 5 additions & 0 deletions util/sys/linux/sys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ package linux_test
import (
"testing"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/util/sys/linux"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestGetOSVersion(t *testing.T) {
osRelease, err := linux.OSVersion()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions util/systimemon/systime_mon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ import (
"sync/atomic"
"testing"
"time"

. "github.com/pingcap/check"
)

func TestT(t *testing.T) {
TestingT(t)
}

func TestSystimeMonitor(t *testing.T) {
var jumpForward int32

Expand Down

0 comments on commit ebe8b09

Please sign in to comment.