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

e2e: Add bootstrap checks to migrated kurtosis tests #1935

Merged
merged 13 commits into from
Sep 20, 2023
Merged
12 changes: 12 additions & 0 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,15 @@ ginkgo -v ./tests/e2e -- \
```

See the testnet fixture [README](../fixture/testnet/README.md) for more details.

## Skipping bootstrap checks

By default many tests will attempt to bootstrap a new node with the
post-test network state. While this is a valuable activity to perform
in CI, it can add considerable latency to test development. To disable
these bootstrap checks during development, set the
`E2E_SKIP_BOOTSTRAP_CHECKS` env var to a non-empty value:

```bash
E2E_SKIP_BOOTSTRAP_CHECKS=1 ginkgo -v ./tests/e2e ...
```
2 changes: 2 additions & 0 deletions tests/e2e/c/interchain_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,7 @@ var _ = e2e.DescribeCChain("[Interchain Workflow]", func() {
require.NoError(err)
require.Greater(balances[avaxAssetID], uint64(0))
})

e2e.CheckBootstrapIsPossible(e2e.Env.GetNetwork())
})
})
17 changes: 17 additions & 0 deletions tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"math/big"
"math/rand"
"os"
"strings"
"time"

Expand Down Expand Up @@ -53,6 +54,11 @@ const (
// Interval appropriate for network operations that should be
// retried periodically but not too often.
DefaultPollingInterval = 500 * time.Millisecond

// Setting this env will disable post-test bootstrap
// checks. Useful for speeding up iteration during test
// development.
SkipBootstrapChecksEnvName = "E2E_SKIP_BOOTSTRAP_CHECKS"
)

// Env is used to access shared test fixture. Intended to be
Expand Down Expand Up @@ -247,3 +253,14 @@ func WithSuggestedGasPrice(ethClient ethclient.Client) common.Option {
baseFee := SuggestGasPrice(ethClient)
return common.WithBaseFee(baseFee)
}

// Verifies that the state of the network is compatible with bootstrapping a new node.
StephenButtolph marked this conversation as resolved.
Show resolved Hide resolved
func CheckBootstrapIsPossible(network testnet.Network) {
if len(os.Getenv(SkipBootstrapChecksEnvName)) > 0 {
tests.Outf("{{yellow}}Skipping bootstrap check due to the %s env var being set", SkipBootstrapChecksEnvName)
return
}
ginkgo.By("checking if bootstrap is possible with the current network state")
node := AddEphemeralNode(network, testnet.FlagsMap{})
WaitForHealthy(node)
}
2 changes: 2 additions & 0 deletions tests/e2e/faultinjection/duplicate_node_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ var _ = ginkgo.Describe("Duplicate node handling", func() {

ginkgo.By("checking that the second new node is connected to its peers")
checkConnectedPeers(nodes, node2)

// An bootstrap check was already performed by the second node.
StephenButtolph marked this conversation as resolved.
Show resolved Hide resolved
})
})

Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/x/interchain_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,7 @@ var _ = e2e.DescribeXChain("[Interchain Workflow]", func() {
require.NoError(err)
require.Greater(balances[avaxAssetID], uint64(0))
})

e2e.CheckBootstrapIsPossible(e2e.Env.GetNetwork())
})
})
10 changes: 3 additions & 7 deletions wallet/chain/p/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package p

import (
"errors"
"fmt"
"time"

"github.com/ava-labs/avalanchego/ids"
Expand All @@ -17,11 +17,7 @@ import (
"github.com/ava-labs/avalanchego/wallet/subnet/primary/common"
)

var (
errNotCommitted = errors.New("not committed")

_ Wallet = (*wallet)(nil)
)
var _ Wallet = (*wallet)(nil)

type Wallet interface {
Context
Expand Down Expand Up @@ -507,7 +503,7 @@ func (w *wallet) IssueTx(
}

if txStatus.Status != status.Committed {
return errNotCommitted
return fmt.Errorf("not committed: %s", txStatus.Reason)
}
return nil
}
Loading