diff --git a/dumpling/dumpling_test.go b/dumpling/dumpling_test.go index 42f9378ef6..cd0a0f42bf 100644 --- a/dumpling/dumpling_test.go +++ b/dumpling/dumpling_test.go @@ -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" ) @@ -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) } diff --git a/pkg/election/election_test.go b/pkg/election/election_test.go index 1074098aa7..29061aaf8c 100644 --- a/pkg/election/election_test.go +++ b/pkg/election/election_test.go @@ -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" @@ -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) @@ -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 @@ -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) @@ -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") } }() @@ -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" @@ -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) @@ -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() @@ -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" @@ -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) @@ -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" @@ -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) diff --git a/tests/http_apis/run.sh b/tests/http_apis/run.sh index 185ce29840..09087cc40b 100644 --- a/tests/http_apis/run.sh +++ b/tests/http_apis/run.sh @@ -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 }