Skip to content

Commit

Permalink
test: sync access to countRun counter in TestRunnerFactory (#42097)
Browse files Browse the repository at this point in the history
countRun is incremented and checked in different goroutines

to avoid race conditions, only mark the workgroup as done after
incrementing the counter
  • Loading branch information
kruskall authored Dec 19, 2024
1 parent 78fe7a5 commit 7411cc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion filebeat/input/v2/compat/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func TestRunnerFactory_CheckConfig(t *testing.T) {
return &inputest.MockInput{
OnTest: func(_ v2.TestContext) error { countTest++; return nil },
OnRun: func(_ v2.Context, _ beat.PipelineConnector) error {
runWG.Done()
countRun++
runWG.Done()
return nil
},
}, nil
Expand Down

0 comments on commit 7411cc4

Please sign in to comment.