Skip to content

Commit

Permalink
integration-test: fix the unstable leader watch test (#1372)
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <[email protected]>
  • Loading branch information
nolouch authored and Connor1996 committed Dec 12, 2018
1 parent acb9512 commit 0690f68
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 35 deletions.
19 changes: 10 additions & 9 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
branch = "master"

[[constraint]]
name = "github.com/etcd-io/gofail"
name = "github.com/pingcap/gofail"
branch = "master"

[[constraint]]
Expand Down
2 changes: 1 addition & 1 deletion hack/retool-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ which retool >/dev/null || go get github.com/twitchtv/retool
./hack/retool add github.com/mgechev/revive 7773f47324c2bf1c8f7a5500aff2b6c01d3ed73b
./hack/retool add github.com/securego/gosec/cmd/gosec 1.0.0
# go fail
./hack/retool add github.com/etcd-io/gofail master
./hack/retool add github.com/pingcap/gofail master
5 changes: 3 additions & 2 deletions pkg/integration_test/leader_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"context"
"time"

gofail "github.com/etcd-io/gofail/runtime"
. "github.com/pingcap/check"
gofail "github.com/pingcap/gofail/runtime"
"github.com/pingcap/pd/pkg/testutil"
"github.com/pingcap/pd/server"
)
Expand All @@ -44,14 +44,15 @@ func (s *integrationTestSuite) TestWatcher(c *C) {
time.Sleep(5 * time.Second)
pd3, err := cluster.Join()
c.Assert(err, IsNil)
gofail.Enable("github.com/pingcap/pd/server/delayWatcher", `sleep("15s")`)
gofail.Enable("github.com/pingcap/pd/server/delayWatcher", `pause`)
err = pd3.Run(context.Background())
c.Assert(err, IsNil)
time.Sleep(200 * time.Millisecond)
c.Assert(pd3.GetLeader().GetName(), Equals, pd1.GetConfig().Name)
pd1.Stop()
cluster.WaitLeader()
c.Assert(pd2.GetLeader().GetName(), Equals, pd2.GetConfig().Name)
gofail.Disable("github.com/pingcap/pd/server/delayWatcher")
testutil.WaitUntil(c, func(c *C) bool {
return c.Check(pd3.GetLeader().GetName(), Equals, pd2.GetConfig().Name)
})
Expand Down
2 changes: 1 addition & 1 deletion server/tso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"time"

"github.com/coreos/etcd/clientv3"
gofail "github.com/etcd-io/gofail/runtime"
. "github.com/pingcap/check"
gofail "github.com/pingcap/gofail/runtime"
"github.com/pingcap/kvproto/pkg/pdpb"
)

Expand Down
10 changes: 3 additions & 7 deletions tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@
"Commit": "5fb530cda357c16175f2c049577d2030de735b28"
},
{
"Repository": "github.com/etcd-io/gofail/runtime",
"Commit": "51ce9a71510a58bad5ae66ddd278ef28762a1550"
},
{
"Repository": "github.com/etcd-io/gofail",
"Commit": "51ce9a71510a58bad5ae66ddd278ef28762a1550"
"Repository": "github.com/pingcap/gofail",
"Commit": "e47081505b9cbcb513b138a2e45ff94a4bd5af4d"
}
],
"RetoolVersion": "1.3.7"
}
}
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0690f68

Please sign in to comment.