Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preCleanup for integrationtest #435

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions v2/integrationtest/it_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
// The contents of above steps will depend on given options.
func (itr *IntegrationTestRunner) Run() error {
if err := itr.preSetup(); err != nil {
_ = itr.preCleanup()

Check warning on line 78 in v2/integrationtest/it_runner.go

View check run for this annotation

Elisa-Codecov / codecov/patch

v2/integrationtest/it_runner.go#L78

Added line #L78 was not covered by tests
return err
}

Expand Down Expand Up @@ -102,7 +103,7 @@

func (itr *IntegrationTestRunner) buildAndRunBin() error {
if err := itr.binHandler.Build(); err != nil {
return fmt.Errorf("building applicfunc Teation failed: %w", err)
return fmt.Errorf("building application failed: %w", err)

Check warning on line 106 in v2/integrationtest/it_runner.go

View check run for this annotation

Elisa-Codecov / codecov/patch

v2/integrationtest/it_runner.go#L106

Added line #L106 was not covered by tests
}

if err := itr.binHandler.Start(); err != nil {
Expand All @@ -112,16 +113,25 @@
return itr.ready()
}

func (itr *IntegrationTestRunner) preCleanup() error {
var result error
for i := len(itr.preHandlers) - 1; i >= 0; i-- {
if err := itr.preHandlers[i].Stop(); err != nil {
result = multierror.Append(result, err)
}

Check warning on line 121 in v2/integrationtest/it_runner.go

View check run for this annotation

Elisa-Codecov / codecov/patch

v2/integrationtest/it_runner.go#L120-L121

Added lines #L120 - L121 were not covered by tests
}

return result
}

func (itr *IntegrationTestRunner) cleanup() error {
var result error
if err := itr.binHandler.Stop(); err != nil {
result = multierror.Append(result, fmt.Errorf("running application failed: %w", err))
}

for i := len(itr.preHandlers) - 1; i >= 0; i-- {
if err := itr.preHandlers[i].Stop(); err != nil {
result = multierror.Append(result, err)
}
if err := itr.preCleanup(); err != nil {
result = multierror.Append(result, err)

Check warning on line 134 in v2/integrationtest/it_runner.go

View check run for this annotation

Elisa-Codecov / codecov/patch

v2/integrationtest/it_runner.go#L134

Added line #L134 was not covered by tests
}

return result
Expand Down
Loading