Skip to content

Commit

Permalink
pdutil: fix unstable test TestPauseSchedulersByKeyRange (#35949)
Browse files Browse the repository at this point in the history
close #35947
  • Loading branch information
sleepymole authored Jul 5, 2022
1 parent d8dbab2 commit ff7c120
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion br/pkg/pdutil/pd_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/http/httptest"
"net/url"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -239,11 +240,21 @@ func TestPauseSchedulersByKeyRange(t *testing.T) {

labelExpires := make(map[string]time.Time)

var (
mu sync.Mutex
deleted bool
)

httpSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
mu.Lock()
defer mu.Unlock()
if deleted {
return
}
if r.Method == http.MethodDelete {
ruleID := strings.TrimPrefix(r.URL.Path, "/"+regionLabelPrefix+"/")
print(ruleID)
delete(labelExpires, ruleID)
deleted = true
return
}
var labelRule LabelRule
Expand Down

0 comments on commit ff7c120

Please sign in to comment.