Skip to content

Commit

Permalink
tests: fix the testify usage of re.Positive/Negative (#8221)
Browse files Browse the repository at this point in the history
ref #4399

Signed-off-by: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato authored May 28, 2024
1 parent 5eb66e0 commit b1cbc71
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/schedule/schedulers/evict_slow_trend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (suite *evictSlowTrendTestSuite) TestEvictSlowTrendBasicFuncs() {
re.Equal(slowCandidate{}, es2.conf.evictCandidate)
es2.conf.markCandidateRecovered()
lastCapturedCandidate = es2.conf.lastCapturedCandidate()
re.Greater(lastCapturedCandidate.recoverTS.Compare(recoverTS), 0)
re.Positive(lastCapturedCandidate.recoverTS.Compare(recoverTS))
re.Equal(lastCapturedCandidate.storeID, store.GetID())

// Test capture another store 2
Expand Down
2 changes: 1 addition & 1 deletion pkg/statistics/hot_peer_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func TestUpdateHotPeerStat(t *testing.T) {
cache.updateStat(newItem[0])
newItem = cache.checkPeerFlow(region, []*metapb.Peer{peer}, deltaLoads, interval)
}
re.Less(newItem[0].HotDegree, 0)
re.Negative(newItem[0].HotDegree)
re.Equal(0, newItem[0].AntiCount)
re.Equal(utils.Remove, newItem[0].actionType)
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/client/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ func (suite *httpClientTestSuite) checkMeta(mode mode, client pd.Client) {
re.Equal("INPROGRESS", state)
regionStats, err := client.GetRegionStatusByKeyRange(env.ctx, pd.NewKeyRange([]byte("a1"), []byte("a3")), false)
re.NoError(err)
re.Greater(regionStats.Count, 0)
re.Positive(regionStats.Count)
re.NotEmpty(regionStats.StoreLeaderCount)
regionStats, err = client.GetRegionStatusByKeyRange(env.ctx, pd.NewKeyRange([]byte("a1"), []byte("a3")), true)
re.NoError(err)
re.Greater(regionStats.Count, 0)
re.Positive(regionStats.Count)
re.Empty(regionStats.StoreLeaderCount)
hotReadRegions, err := client.GetHotReadRegions(env.ctx)
re.NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/mcs/tso/keyspace_group_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (suite *tsoKeyspaceGroupManagerTestSuite) TestTSOKeyspaceGroupSplit() {
// Check the split TSO from keyspace group `newID` now.
splitTS, err := suite.requestTSO(re, 222, newID)
re.NoError(err)
re.Greater(tsoutil.CompareTimestamp(&splitTS, &ts), 0)
re.Positive(tsoutil.CompareTimestamp(&splitTS, &ts))
}

func (suite *tsoKeyspaceGroupManagerTestSuite) requestTSO(
Expand Down Expand Up @@ -636,7 +636,7 @@ func (suite *tsoKeyspaceGroupManagerTestSuite) TestTSOKeyspaceGroupMerge() {
}
return err == nil && tsoutil.CompareTimestamp(&mergedTS, &pdpb.Timestamp{}) > 0
}, testutil.WithTickInterval(5*time.Second), testutil.WithWaitFor(time.Minute))
re.Greater(tsoutil.CompareTimestamp(&mergedTS, &ts), 0)
re.Positive(tsoutil.CompareTimestamp(&mergedTS, &ts))
}

func (suite *tsoKeyspaceGroupManagerTestSuite) TestTSOKeyspaceGroupMergeClient() {
Expand Down

0 comments on commit b1cbc71

Please sign in to comment.