Skip to content

Commit 96f6214

Browse files
authored
*: Fix data race in TestSetLabelsConcurrentWithGetLabel (#45579) (#45590)
close #45578
1 parent 8e174f0 commit 96f6214

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/http_handler_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,9 @@ func TestSetLabels(t *testing.T) {
11961196
testUpdateLabels(updated, labels)
11971197

11981198
// reset the global variable
1199-
config.GetGlobalConfig().Labels = map[string]string{}
1199+
config.UpdateGlobal(func(conf *config.Config) {
1200+
conf.Labels = map[string]string{}
1201+
})
12001202
}
12011203

12021204
func TestSetLabelsConcurrentWithGetLabel(t *testing.T) {
@@ -1237,5 +1239,7 @@ func TestSetLabelsConcurrentWithGetLabel(t *testing.T) {
12371239
close(done)
12381240

12391241
// reset the global variable
1240-
config.GetGlobalConfig().Labels = map[string]string{}
1242+
config.UpdateGlobal(func(conf *config.Config) {
1243+
conf.Labels = map[string]string{}
1244+
})
12411245
}

0 commit comments

Comments
 (0)