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
…42129)

countRun is incremented and checked in different goroutines

to avoid race conditions, only mark the workgroup as done after
incrementing the counter

(cherry picked from commit 7411cc4)

Co-authored-by: kruskall <[email protected]>
  • Loading branch information
mergify[bot] and kruskall authored Dec 19, 2024
1 parent 3d2bda9 commit d860478
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 d860478

Please sign in to comment.