Skip to content

Commit

Permalink
test-1
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Jan 14, 2025
1 parent 3264e80 commit ec6fbb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ func (c *RaftCluster) runNodeStateCheckJob() {

ticker := time.NewTicker(nodeStateCheckJobInterval)
failpoint.Inject("highFrequencyClusterJobs", func() {
ticker.Reset(2 * time.Second)
ticker.Reset(time.Millisecond)
})
defer ticker.Stop()

Expand Down
20 changes: 19 additions & 1 deletion tests/server/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/pingcap/log"

"github.com/tikv/pd/pkg/core"
"github.com/tikv/pd/pkg/response"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/pkg/utils/typeutil"
Expand Down Expand Up @@ -800,6 +801,23 @@ func TestRemovingProgress(t *testing.T) {
output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=2", http.MethodGet, http.StatusNotFound)
re.Contains(string(output), "no progress found for the given store ID")

testutil.Eventually(re, func() bool {
output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores", http.MethodGet, http.StatusOK)
var storesInfo response.StoresInfo
if err := json.Unmarshal(output, &storesInfo); err != nil {
return false
}
if len(storesInfo.Stores) != 3 {
return false
}
for _, store := range storesInfo.Stores {
if store.Store.GetNodeState() != metapb.NodeState_Serving {
return false
}
}
return true
})

// remove store 1 and store 2
_ = sendRequest(re, leader.GetAddr()+"/pd/api/v1/store/1", http.MethodDelete, http.StatusOK)
_ = sendRequest(re, leader.GetAddr()+"/pd/api/v1/store/2", http.MethodDelete, http.StatusOK)
Expand Down Expand Up @@ -827,7 +845,7 @@ func TestRemovingProgress(t *testing.T) {
resp, err := tests.TestDialClient.Do(req)
re.NoError(err)
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK /stores/progress{
if resp.StatusCode != http.StatusOK {
return false
}
// is not prepared
Expand Down

0 comments on commit ec6fbb7

Please sign in to comment.