Skip to content

Commit

Permalink
Merge branch 'dev' into version-bump-v1.10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Jul 19, 2023
2 parents 33d4adf + 79e59d2 commit a1a86a6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
3 changes: 0 additions & 3 deletions scripts/install_anr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ AVALANCHE_PATH=$(
cd .. && pwd
)

# Load the constants
source "$AVALANCHE_PATH"/scripts/constants.sh

#################################
# download avalanche-network-runner
# https://github.com/ava-labs/avalanche-network-runner
Expand Down
6 changes: 6 additions & 0 deletions scripts/tests.e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ echo "installing avalanche-network-runner"
ANR_WORKDIR="/tmp"
./scripts/install_anr.sh

# Sourcing constants.sh ensures that the necessary CGO flags are set to
# build the portable version of BLST. Without this, ginkgo may fail to
# build the test binary if run on a host (e.g. github worker) that lacks
# the instructions to build non-portable BLST.
source ./scripts/constants.sh

#################################
echo "building e2e.test"
# to install the ginkgo binary (required for test build and run)
Expand Down
6 changes: 6 additions & 0 deletions scripts/tests.upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ echo "installing avalanche-network-runner"
ANR_WORKDIR="/tmp"
./scripts/install_anr.sh

# Sourcing constants.sh ensures that the necessary CGO flags are set to
# build the portable version of BLST. Without this, ginkgo may fail to
# build the test binary if run on a host (e.g. github worker) that lacks
# the instructions to build non-portable BLST.
source ./scripts/constants.sh

#################################
echo "building upgrade.test"
# to install the ginkgo binary (required for test build and run)
Expand Down
23 changes: 10 additions & 13 deletions tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
// Enough for test/custom networks.
DefaultConfirmTxTimeout = 20 * time.Second

DefaultShutdownTimeout = 2 * time.Minute
DefaultTimeout = 2 * time.Minute
)

// Env is the global struct containing all we need to test
Expand Down Expand Up @@ -116,7 +116,7 @@ func (te *TestEnvironment) ConfigCluster(
return fmt.Errorf("could not setup network-runner client: %w", err)
}

ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
presp, err := te.GetRunnerClient().Ping(ctx)
cancel()
if err != nil {
Expand Down Expand Up @@ -156,7 +156,7 @@ func (te *TestEnvironment) StartCluster() error {
switch te.clusterType {
case StandAlone:
tests.Outf("{{magenta}}starting network-runner with %q{{/}}\n", te.avalancheGoExecPath)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
resp, err := te.GetRunnerClient().Start(ctx, te.avalancheGoExecPath,
runner_sdk.WithNumNodes(5),
runner_sdk.WithGlobalNodeConfig(fmt.Sprintf(`{"log-level":"%s"}`, te.avalancheGoLogLevel)),
Expand All @@ -167,10 +167,7 @@ func (te *TestEnvironment) StartCluster() error {
}
tests.Outf("{{green}}successfully started network-runner: {{/}} %+v\n", resp.ClusterInfo.NodeNames)

// start is async, so wait some time for cluster health
time.Sleep(time.Minute)

ctx, cancel = context.WithTimeout(context.Background(), 2*time.Minute)
ctx, cancel = context.WithTimeout(context.Background(), DefaultTimeout)
_, err = te.GetRunnerClient().Health(ctx)
cancel()
if err != nil {
Expand All @@ -188,7 +185,7 @@ func (te *TestEnvironment) StartCluster() error {
}

func (te *TestEnvironment) refreshURIs() error {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
uriSlice, err := te.GetRunnerClient().URIs(ctx)
cancel()
if err != nil {
Expand Down Expand Up @@ -284,7 +281,7 @@ func (te *TestEnvironment) ShutdownCluster() error {
}

tests.Outf("{{red}}shutting down network-runner cluster{{/}}\n")
ctx, cancel := context.WithTimeout(context.Background(), DefaultShutdownTimeout)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
_, err := runnerCli.Stop(ctx)
cancel()
if err != nil {
Expand All @@ -303,7 +300,7 @@ func (te *TestEnvironment) SnapInitialState() error {
return nil // initial state snapshot already captured
}

ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
_, err := te.runnerCli.SaveSnapshot(ctx, te.snapshotName)
cancel()
if err != nil {
Expand All @@ -318,21 +315,21 @@ func (te *TestEnvironment) RestoreInitialState(switchOffNetworkFirst bool) error
defer te.snapMu.Unlock()

if switchOffNetworkFirst {
ctx, cancel := context.WithTimeout(context.Background(), DefaultShutdownTimeout)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
_, err := te.GetRunnerClient().Stop(ctx)
cancel()
gomega.Expect(err).Should(gomega.BeNil())
}

ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
_, err := te.GetRunnerClient().LoadSnapshot(ctx, te.snapshotName)
cancel()
if err != nil {
return err
}

// make sure cluster goes back to health before moving on
ctx, cancel = context.WithTimeout(context.Background(), DefaultShutdownTimeout)
ctx, cancel = context.WithTimeout(context.Background(), DefaultTimeout)
_, err = te.GetRunnerClient().Health(ctx)
cancel()
if err != nil {
Expand Down

0 comments on commit a1a86a6

Please sign in to comment.