mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 23:14:37 +00:00
Partial fix for #5291. For details, see [README.md](https://github.com/tendermint/tendermint/blob/erik/e2e-tests/test/e2e/README.md) and [RFC-001](https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-001-end-to-end-testing.md). This only includes a single test case under `test/e2e/tests/`, as a proof of concept - additional test cases will be submitted separately. A randomized testnet generator will also be submitted separately, there a currently just a handful of static testnets under `test/e2e/networks/`. This will eventually replace the current P2P tests and run in CI.
36 lines
678 B
Go
36 lines
678 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
|
|
)
|
|
|
|
// Cleanup removes the Docker Compose containers and testnet directory.
|
|
func Cleanup(testnet *e2e.Testnet) error {
|
|
if testnet.Dir == "" {
|
|
return errors.New("no directory set")
|
|
}
|
|
_, err := os.Stat(testnet.Dir)
|
|
if os.IsNotExist(err) {
|
|
return nil
|
|
} else if err != nil {
|
|
return err
|
|
}
|
|
|
|
logger.Info("Removing Docker containers and networks")
|
|
err = execCompose(testnet.Dir, "down")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
logger.Info(fmt.Sprintf("Removing testnet directory %q", testnet.Dir))
|
|
err = os.RemoveAll(testnet.Dir)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|