Skip to content

Commit

Permalink
Address the comments
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato committed Jun 24, 2022
1 parent 38e32b0 commit 349bcd6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ func TestExpireRegionCache(t *testing.T) {
re.True(ok)
re.Equal(expV, v2.(string))

cache.PutWithTTL(11, "11", 1*time.Second)
cache.PutWithTTL(11, "11", time.Second)
time.Sleep(5 * time.Second)
k, v, success = cache.pop()
re.False(success)
re.Nil(k)
re.Nil(v)

// Test Get
cache.PutWithTTL(1, 1, 1*time.Second)
cache.PutWithTTL(1, 1, time.Second)
cache.PutWithTTL(2, "v2", 5*time.Second)
cache.PutWithTTL(3, 3.0, 5*time.Second)

Expand Down
2 changes: 1 addition & 1 deletion server/api/tso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (suite *tsoTestSuite) TestTransferAllocator() {
suite.svr.GetTSOAllocatorManager().ClusterDCLocationChecker()
_, err := suite.svr.GetTSOAllocatorManager().GetAllocator("dc-1")
return err == nil
}, tu.WithWaitFor(time.Second*15), tu.WithTickInterval(3*time.Second))
}, tu.WithWaitFor(15*time.Second), tu.WithTickInterval(3*time.Second))
addr := suite.urlPrefix + "/tso/allocator/transfer/pd1?dcLocation=dc-1"
err := tu.CheckPostJSON(testDialClient, addr, nil, tu.StatusOK(re))
suite.NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions server/schedule/operator/status_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ func TestCheckStepTimeout(t *testing.T) {
status OpStatus
}{{
step: AddLearner{},
start: time.Now().Add(-(SlowOperatorWaitTime - 1*time.Second)),
start: time.Now().Add(-(SlowOperatorWaitTime - time.Second)),
status: STARTED,
}, {
step: AddLearner{},
start: time.Now().Add(-(SlowOperatorWaitTime + 1*time.Second)),
start: time.Now().Add(-(SlowOperatorWaitTime + time.Second)),
status: TIMEOUT,
}}

Expand Down
8 changes: 4 additions & 4 deletions tests/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ func TestCustomTimeout(t *testing.T) {
defer cluster.Destroy()

endpoints := runServer(re, cluster)
cli := setupCli(re, ctx, endpoints, pd.WithCustomTimeoutOption(1*time.Second))
cli := setupCli(re, ctx, endpoints, pd.WithCustomTimeoutOption(time.Second))

start := time.Now()
re.NoError(failpoint.Enable("github.com/tikv/pd/server/customTimeout", "return(true)"))
_, err = cli.GetAllStores(context.TODO())
re.NoError(failpoint.Disable("github.com/tikv/pd/server/customTimeout"))
re.Error(err)
re.GreaterOrEqual(time.Since(start), 1*time.Second)
re.GreaterOrEqual(time.Since(start), time.Second)
re.Less(time.Since(start), 2*time.Second)
}

Expand Down Expand Up @@ -1306,7 +1306,7 @@ func (suite *clientTestSuite) TestScatterRegion() {
return resp.GetRegionId() == regionID &&
string(resp.GetDesc()) == "scatter-region" &&
resp.GetStatus() == pdpb.OperatorStatus_RUNNING
}, testutil.WithTickInterval(1*time.Second))
}, testutil.WithTickInterval(time.Second))

// Test interface `ScatterRegion`.
// TODO: Deprecate interface `ScatterRegion`.
Expand All @@ -1323,5 +1323,5 @@ func (suite *clientTestSuite) TestScatterRegion() {
return resp.GetRegionId() == regionID &&
string(resp.GetDesc()) == "scatter-region" &&
resp.GetStatus() == pdpb.OperatorStatus_RUNNING
}, testutil.WithTickInterval(1*time.Second))
}, testutil.WithTickInterval(time.Second))
}
2 changes: 1 addition & 1 deletion tests/server/member/member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func waitEtcdLeaderChange(re *require.Assertions, server *tests.TestServer, old
return false
}
return leader != old
}, testutil.WithWaitFor(time.Second*90), testutil.WithTickInterval(time.Second))
}, testutil.WithWaitFor(90*time.Second), testutil.WithTickInterval(time.Second))
return leader
}

Expand Down
2 changes: 1 addition & 1 deletion tests/server/tso/allocator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestPriorityAndDifferentLocalTSO(t *testing.T) {
defer wg.Done()
testutil.Eventually(re, func() bool {
return cluster.WaitAllocatorLeader(dc) == serName
}, testutil.WithWaitFor(time.Second*90), testutil.WithTickInterval(time.Second))
}, testutil.WithWaitFor(90*time.Second), testutil.WithTickInterval(time.Second))
}(serverName, dcLocation)
}
wg.Wait()
Expand Down
2 changes: 1 addition & 1 deletion tests/server/tso/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestNextLeaderKey(t *testing.T) {
cluster.CheckClusterDCLocation()
currName := cluster.WaitAllocatorLeader("dc-1")
return currName == name
}, testutil.WithTickInterval(1*time.Second))
}, testutil.WithTickInterval(time.Second))
return
}
}

0 comments on commit 349bcd6

Please sign in to comment.