Skip to content

Commit

Permalink
test: add parallel destroy test to the conformance suite
Browse files Browse the repository at this point in the history
It verifies that parallel destroy doesn't break underlying state
implementations.

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Jul 25, 2024
1 parent abf3d8f commit 8662514
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/state/conformance/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,32 @@ loop:
}
}

// TestParallelDestroy runs several parallel destroy calls.
func (suite *StateSuite) TestParallelDestroy() {
res := NewPathResource("default", "/")

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

var eg errgroup.Group

err := suite.State.Create(ctx, res)
suite.Require().NoError(err)

for range 10 {
eg.Go(func() error {
err := suite.State.Destroy(ctx, res.Metadata())
if err != nil && !state.IsNotFoundError(err) {
return err
}

return nil
})
}

suite.Require().NoError(eg.Wait())
}

// TestTeardownDestroy verifies finalizers, teardown and destroy.
func (suite *StateSuite) TestTeardownDestroy() {
ns := suite.getNamespace()
Expand Down

0 comments on commit 8662514

Please sign in to comment.