Browse Source

e2e: always preserve failed networks (#6981)

pull/6983/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
e94c418ad9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions
  1. +1
    -1
      test/e2e/run-multiple.sh
  2. +14
    -11
      test/e2e/runner/main.go

+ 1
- 1
test/e2e/run-multiple.sh View File

@ -21,7 +21,7 @@ for MANIFEST in "$@"; do
START=$SECONDS START=$SECONDS
echo "==> Running testnet: $MANIFEST" echo "==> Running testnet: $MANIFEST"
if ! ./build/runner -p -f "$MANIFEST"; then
if ! ./build/runner -f "$MANIFEST"; then
echo "==> Testnet $MANIFEST failed, dumping manifest..." echo "==> Testnet $MANIFEST failed, dumping manifest..."
cat "$MANIFEST" cat "$MANIFEST"


+ 14
- 11
test/e2e/runner/main.go View File

@ -48,18 +48,21 @@ func NewCLI() *CLI {
cli.testnet = testnet cli.testnet = testnet
return nil return nil
}, },
RunE: func(cmd *cobra.Command, args []string) error {
if err := Cleanup(cli.testnet); err != nil {
RunE: func(cmd *cobra.Command, args []string) (err error) {
if err = Cleanup(cli.testnet); err != nil {
return err return err
} }
defer func() { defer func() {
if cli.preserve { if cli.preserve {
logger.Info("Preserving testnet contents because -preserve=true") logger.Info("Preserving testnet contents because -preserve=true")
} else if err != nil {
logger.Info("Preserving testnet that encountered error",
"err", err)
} else if err := Cleanup(cli.testnet); err != nil { } else if err := Cleanup(cli.testnet); err != nil {
logger.Error("Error cleaning up testnet contents", "err", err) logger.Error("Error cleaning up testnet contents", "err", err)
} }
}() }()
if err := Setup(cli.testnet); err != nil {
if err = Setup(cli.testnet); err != nil {
return err return err
} }
@ -73,38 +76,38 @@ func NewCLI() *CLI {
chLoadResult <- Load(lctx, cli.testnet) chLoadResult <- Load(lctx, cli.testnet)
}() }()
if err := Start(ctx, cli.testnet); err != nil {
if err = Start(ctx, cli.testnet); err != nil {
return err return err
} }
if err := Wait(ctx, cli.testnet, 5); err != nil { // allow some txs to go through
if err = Wait(ctx, cli.testnet, 5); err != nil { // allow some txs to go through
return err return err
} }
if cli.testnet.HasPerturbations() { if cli.testnet.HasPerturbations() {
if err := Perturb(ctx, cli.testnet); err != nil {
if err = Perturb(ctx, cli.testnet); err != nil {
return err return err
} }
if err := Wait(ctx, cli.testnet, 5); err != nil { // allow some txs to go through
if err = Wait(ctx, cli.testnet, 5); err != nil { // allow some txs to go through
return err return err
} }
} }
if cli.testnet.Evidence > 0 { if cli.testnet.Evidence > 0 {
if err := InjectEvidence(ctx, cli.testnet, cli.testnet.Evidence); err != nil {
if err = InjectEvidence(ctx, cli.testnet, cli.testnet.Evidence); err != nil {
return err return err
} }
if err := Wait(ctx, cli.testnet, 5); err != nil { // ensure chain progress
if err = Wait(ctx, cli.testnet, 5); err != nil { // ensure chain progress
return err return err
} }
} }
loadCancel() loadCancel()
if err := <-chLoadResult; err != nil {
if err = <-chLoadResult; err != nil {
return fmt.Errorf("transaction load failed: %w", err) return fmt.Errorf("transaction load failed: %w", err)
} }
if err := Wait(ctx, cli.testnet, 5); err != nil { // wait for network to settle before tests
if err = Wait(ctx, cli.testnet, 5); err != nil { // wait for network to settle before tests
return err return err
} }
if err := Test(cli.testnet); err != nil { if err := Test(cli.testnet); err != nil {


Loading…
Cancel
Save