Skip to content

Commit

Permalink
*: Fix data race in TestSetLabelsConcurrentWithGetLabel (pingcap#45579)
Browse files Browse the repository at this point in the history
  • Loading branch information
gengliqi authored and ti-chi-bot committed Jul 26, 2023
1 parent 5a5cad1 commit 41afaec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/http_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,9 @@ func TestSetLabels(t *testing.T) {
testUpdateLabels(updated, labels)

// reset the global variable
config.GetGlobalConfig().Labels = map[string]string{}
config.UpdateGlobal(func(conf *config.Config) {
conf.Labels = map[string]string{}
})
}

func TestSetLabelsConcurrentWithGetLabel(t *testing.T) {
Expand Down Expand Up @@ -1237,5 +1239,7 @@ func TestSetLabelsConcurrentWithGetLabel(t *testing.T) {
close(done)

// reset the global variable
config.GetGlobalConfig().Labels = map[string]string{}
config.UpdateGlobal(func(conf *config.Config) {
conf.Labels = map[string]string{}
})
}

0 comments on commit 41afaec

Please sign in to comment.