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

Remove znet environment on integration test failure #213

Closed
wants to merge 2 commits into from
Closed
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
15 changes: 9 additions & 6 deletions build/bridge/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func RunAllIntegrationTests(ctx context.Context, deps types.DepsFunc) error {

// RunIntegrationTests returns function running integration tests.
func RunIntegrationTests(name string) types.CommandFunc {
return func(ctx context.Context, deps types.DepsFunc) error {
return func(ctx context.Context, deps types.DepsFunc) (retErr error) {
deps(BuildRelayerDockerImage, BuildSmartContract, tools.EnsureBridgeXRPLWASM,
coreum.BuildCoredLocally, coreum.BuildCoredDockerImage)

Expand All @@ -64,20 +64,23 @@ func RunIntegrationTests(name string) types.CommandFunc {
if err := znet.Remove(ctx, znetConfig); err != nil {
return err
}
defer func() {
if err := znet.Remove(ctx, znetConfig); retErr == nil {
retErr = err
}
}()

if err := znet.Start(ctx, znetConfig); err != nil {
return err
}
if err := golang.RunTests(ctx, deps, golang.TestConfig{
return golang.RunTests(ctx, deps, golang.TestConfig{
PackagePath: filepath.Join(testsDir, name),
Flags: []string{
"-timeout=30m",
"-tags=integrationtests",
fmt.Sprintf("-parallel=%d", 2*runtime.NumCPU()),
},
}); err != nil {
return err
}
return znet.Remove(ctx, znetConfig)
})
}
}

Expand Down
Loading