Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Quality reinforcement (5): fix unstable test cases #1127

Merged
merged 26 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
24c7999
Update README.md
lance6716 Sep 8, 2020
70c48f3
Merge branch 'master' into fixTest
lance6716 Sep 9, 2020
db840d9
Update server.go
lance6716 Sep 9, 2020
4278406
Update README.md
lance6716 Sep 9, 2020
5cc0c70
Update string.go
lance6716 Sep 9, 2020
924683d
worker: use rand address when starting test etcd server
csuzhangxc Sep 10, 2020
87e940e
*: increase context deadline
csuzhangxc Sep 10, 2020
b488f5f
scheduler: wait source bound revover before start task
csuzhangxc Sep 10, 2020
2d422a5
Merge branch 'master' into fixTest
csuzhangxc Sep 11, 2020
8ef10bb
scheduler: fix unstalbe `c.Assert(s.BoundSources(), DeepEquals, expec…
csuzhangxc Sep 11, 2020
269183e
Merge branch 'fixTest' of github.com:pingcap/dm into fixTest
csuzhangxc Sep 11, 2020
29299b1
worker: fix `c.Assert(st.Stage(), Equals, pb.Stage_Paused)`
csuzhangxc Sep 11, 2020
efc6663
master: fix unstalbe `master is not leader, and can't forward request…
csuzhangxc Sep 11, 2020
cb98757
shardddl: wait more time for watch operation to fix `c.Assert(len(opC…
csuzhangxc Sep 11, 2020
ae03550
master: fix data race
csuzhangxc Sep 11, 2020
4e0070b
tests: fix unstable dmctl_basic
csuzhangxc Sep 11, 2020
7d2652b
Update README.md
csuzhangxc Oct 6, 2020
b58cdd7
Merge branch 'master' into fixTest
csuzhangxc Oct 9, 2020
e05ead2
Merge branch 'fixTest' of github.com:pingcap/dm into fixTest
csuzhangxc Oct 9, 2020
124d89d
election: increase timeout for unit tests
csuzhangxc Oct 9, 2020
8e34248
*: revert README.md
csuzhangxc Oct 9, 2020
d728979
wait master knowing worker is offline
lance6716 Oct 10, 2020
0110162
Merge branch 'master' into fixTest
lance6716 Oct 10, 2020
54bfbaf
Merge branch 'master' into fixTest
lance6716 Oct 10, 2020
639c618
don't dump all DB in dumpling test
lance6716 Oct 12, 2020
69d6a47
Merge branch 'master' into fixTest
lance6716 Oct 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dumpling/dumpling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/pingcap/dm/dm/pb"
"github.com/pingcap/dm/pkg/log"
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb-tools/pkg/filter"

. "github.com/pingcap/check"
)
Expand Down Expand Up @@ -68,6 +69,9 @@ func (d *testDumplingSuite) SetUpSuite(c *C) {
LoaderConfig: config.LoaderConfig{
Dir: dir,
},
BAList: &filter.Rules{
DoDBs: []string{"information_schema"},
},
}
c.Assert(log.InitLogger(&log.Config{}), IsNil)
}
Expand Down
20 changes: 12 additions & 8 deletions pkg/election/election_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (t *testElectionSuite) TearDownTest(c *C) {

func testElection2After1(t *testElectionSuite, c *C, normalExit bool) {
var (
timeout = 3 * time.Second
sessionTTL = 60
key = "unit-test/election-2-after-1"
ID1 = "member1"
Expand Down Expand Up @@ -120,7 +121,7 @@ func testElection2After1(t *testElectionSuite, c *C, normalExit bool) {
select {
case leader := <-e1.LeaderNotify():
c.Assert(leader.ID, Equals, ID1)
case <-time.After(3 * time.Second):
case <-time.After(timeout):
c.Fatal("leader campaign timeout")
}
c.Assert(e1.IsLeader(), IsTrue)
Expand All @@ -141,7 +142,7 @@ func testElection2After1(t *testElectionSuite, c *C, normalExit bool) {
select {
case leader := <-e2.leaderCh:
c.Assert(leader.ID, Equals, ID1)
case <-time.After(time.Second):
case <-time.After(timeout):
c.Fatal("leader campaign timeout")
}
// but the leader should still be e1
Expand Down Expand Up @@ -171,7 +172,7 @@ func testElection2After1(t *testElectionSuite, c *C, normalExit bool) {
select {
case leader := <-e2.LeaderNotify():
c.Assert(leader.ID, Equals, ID2)
case <-time.After(3 * time.Second):
case <-time.After(timeout):
c.Fatal("leader campaign timeout")
}
c.Assert(e2.IsLeader(), IsTrue)
Expand All @@ -196,7 +197,7 @@ func testElection2After1(t *testElectionSuite, c *C, normalExit bool) {
c.Assert(terror.ErrElectionCampaignFail.Equal(err2), IsTrue)
// the old session is done, but we can't create a new one.
c.Assert(err2, ErrorMatches, ".*fail to campaign leader: create a new session.*")
case <-time.After(time.Second):
case <-time.After(timeout):
c.Fatal("do not receive error for e2")
}
}()
Expand All @@ -218,6 +219,7 @@ func (t *testElectionSuite) TestElection2After1(c *C) {

func (t *testElectionSuite) TestElectionAlways1(c *C) {
var (
timeout = 3 * time.Second
sessionTTL = 60
key = "unit-test/election-always-1"
ID1 = "member1"
Expand All @@ -239,7 +241,7 @@ func (t *testElectionSuite) TestElectionAlways1(c *C) {
select {
case leader := <-e1.LeaderNotify():
c.Assert(leader.ID, Equals, ID1)
case <-time.After(3 * time.Second):
case <-time.After(timeout):
c.Fatal("leader campaign timeout")
}
c.Assert(e1.IsLeader(), IsTrue)
Expand Down Expand Up @@ -270,7 +272,7 @@ func (t *testElectionSuite) TestElectionAlways1(c *C) {
select {
case err2 := <-e2.ErrorNotify():
c.Fatalf("cancel the campaign should not get an error, %v", err2)
case <-time.After(time.Second): // wait 1s
case <-time.After(timeout): // wait 3s
}
}()
cancel2()
Expand All @@ -288,6 +290,7 @@ func (t *testElectionSuite) TestElectionAlways1(c *C) {

func (t *testElectionSuite) TestElectionEvictLeader(c *C) {
var (
timeout = 3 * time.Second
sessionTTL = 60
key = "unit-test/election-evict-leader"
ID1 = "member1"
Expand All @@ -309,7 +312,7 @@ func (t *testElectionSuite) TestElectionEvictLeader(c *C) {
select {
case leader := <-e1.LeaderNotify():
c.Assert(leader.ID, Equals, ID1)
case <-time.After(3 * time.Second):
case <-time.After(timeout):
c.Fatal("leader campaign timeout")
}
c.Assert(e1.IsLeader(), IsTrue)
Expand Down Expand Up @@ -354,6 +357,7 @@ func (t *testElectionSuite) TestElectionEvictLeader(c *C) {

func (t *testElectionSuite) TestElectionDeleteKey(c *C) {
var (
timeout = 3 * time.Second
sessionTTL = 60
key = "unit-test/election-delete-key"
ID = "member"
Expand All @@ -373,7 +377,7 @@ func (t *testElectionSuite) TestElectionDeleteKey(c *C) {
select {
case leader := <-e.LeaderNotify():
c.Assert(leader.ID, Equals, ID)
case <-time.After(3 * time.Second):
case <-time.After(timeout):
c.Fatal("leader campaign timeout")
}
c.Assert(e.IsLeader(), IsTrue)
Expand Down
4 changes: 3 additions & 1 deletion tests/http_apis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ function run() {
echo "kill dm-worker1"
ps aux | grep dm-worker1 |awk '{print $2}'|xargs kill || true
check_port_offline $WORKER1_PORT 20
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"list-member --worker --name=worker1" \
"\"stage\": \"offline\"" 1
curl -X DELETE 127.0.0.1:$MASTER_PORT/apis/${API_VERSION}/members/worker/worker1 > $WORK_DIR/offline-worker.log
check_log_contains $WORK_DIR/offline-worker.log "\"result\": true" 1

echo "check data"
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml
}
Expand Down