Browse Source

e2e: cleanup on all errors if preserve not specified (#6950)

If the e2e tests error, they leave all of the e2e state around including containers and networks etc. 
We should clean this up when the tests shuts down, even if it exits in error.
pull/6956/head
William Banfield 3 years ago
committed by GitHub
parent
commit
bf9232e99f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions
  1. +13
    -9
      test/e2e/runner/main.go

+ 13
- 9
test/e2e/runner/main.go View File

@ -52,6 +52,13 @@ func NewCLI() *CLI {
if err := Cleanup(cli.testnet); err != nil {
return err
}
defer func() {
if cli.preserve {
logger.Info("Preserving testnet contents because -preserve=true")
} else if err := Cleanup(cli.testnet); err != nil {
logger.Error("Error cleaning up testnet contents", "err", err)
}
}()
if err := Setup(cli.testnet); err != nil {
return err
}
@ -103,11 +110,6 @@ func NewCLI() *CLI {
if err := Test(cli.testnet); err != nil {
return err
}
if !cli.preserve {
if err := Cleanup(cli.testnet); err != nil {
return err
}
}
return nil
},
}
@ -269,6 +271,12 @@ Does not run any perbutations.
if err := Cleanup(cli.testnet); err != nil {
return err
}
defer func() {
if err := Cleanup(cli.testnet); err != nil {
logger.Error("Error cleaning up testnet contents", "err", err)
}
}()
if err := Setup(cli.testnet); err != nil {
return err
}
@ -302,10 +310,6 @@ Does not run any perbutations.
return err
}
if err := Cleanup(cli.testnet); err != nil {
return err
}
return nil
},
})


Loading…
Cancel
Save