Skip to content

Commit

Permalink
[chore] Fix a data race in the tests of healthcheckextension (open-te…
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored and RoryCrispin committed Nov 24, 2023
1 parent 6259a56 commit 7ff2aae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions extension/healthcheckextension/healthcheckextension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
},
{
step: func(hcExt *healthCheckExtension) error {
hcExt.exporter.mu.Lock()
defer hcExt.exporter.mu.Unlock()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, viewData())
return hcExt.Ready()
},
Expand All @@ -207,6 +209,8 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
},
{
step: func(hcExt *healthCheckExtension) error {
hcExt.exporter.mu.Lock()
defer hcExt.exporter.mu.Unlock()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, viewData())
return hcExt.Ready()
},
Expand All @@ -233,6 +237,8 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
},
{
step: func(hcExt *healthCheckExtension) error {
hcExt.exporter.mu.Lock()
defer hcExt.exporter.mu.Unlock()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, viewData())
return hcExt.Ready()
},
Expand All @@ -244,6 +250,8 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
},
{
step: func(hcExt *healthCheckExtension) error {
hcExt.exporter.mu.Lock()
defer hcExt.exporter.mu.Unlock()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, viewData())
return hcExt.Ready()
},
Expand Down Expand Up @@ -272,6 +280,8 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
},
{
step: func(hcExt *healthCheckExtension) error {
hcExt.exporter.mu.Lock()
defer hcExt.exporter.mu.Unlock()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, viewData())
return hcExt.Ready()
},
Expand All @@ -285,6 +295,8 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
},
{
step: func(hcExt *healthCheckExtension) error {
hcExt.exporter.mu.Lock()
defer hcExt.exporter.mu.Unlock()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, viewData())
return hcExt.Ready()
},
Expand Down

0 comments on commit 7ff2aae

Please sign in to comment.