Skip to content

Commit

Permalink
[tmpnet] Ensure nodes are stopped in the event of bootstrap failure (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
maru-ava authored Aug 26, 2024
1 parent c359dbb commit 3272f3a
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions tests/fixture/e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,22 @@ func StartNetwork(
) {
require := require.New(tc)

require.NoError(
tmpnet.BootstrapNewNetwork(
tc.DefaultContext(),
tc.GetWriter(),
network,
DefaultNetworkDir,
avalancheGoExecPath,
pluginDir,
),
err := tmpnet.BootstrapNewNetwork(
tc.DefaultContext(),
tc.GetWriter(),
network,
DefaultNetworkDir,
avalancheGoExecPath,
pluginDir,
)
if err != nil {
// Ensure nodes are stopped if bootstrap fails. The network configuration
// will remain on disk to enable troubleshooting.
if stopErr := network.Stop(tc.DefaultContext()); stopErr != nil {
tc.Outf("failed to stop network after bootstrap failure: %v", stopErr)
}
require.FailNow("failed to bootstrap network: %s", err)
}

tc.Outf("{{green}}Successfully started network{{/}}\n")

Expand Down

0 comments on commit 3272f3a

Please sign in to comment.