Browse Source

test: clean up E2E test volumes using a container (#5509)

pull/5510/head
Erik Grinaker 4 years ago
committed by GitHub
parent
commit
b6979e7fbd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions
  1. +1
    -1
      .github/workflows/e2e-nightly.yml
  2. +1
    -1
      .github/workflows/e2e.yml
  3. +19
    -0
      test/e2e/runner/cleanup.go

+ 1
- 1
.github/workflows/e2e-nightly.yml View File

@ -29,7 +29,7 @@ jobs:
- name: Run testnets in group ${{ matrix.group }} - name: Run testnets in group ${{ matrix.group }}
working-directory: test/e2e working-directory: test/e2e
run: sudo ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml
run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml
- name: Notify Slack on failure - name: Notify Slack on failure
uses: rtCamp/action-slack-notify@e9db0ef uses: rtCamp/action-slack-notify@e9db0ef


+ 1
- 1
.github/workflows/e2e.yml View File

@ -29,7 +29,7 @@ jobs:
- name: Run CI testnet - name: Run CI testnet
working-directory: test/e2e working-directory: test/e2e
run: sudo ./build/runner -f networks/ci.toml
run: ./build/runner -f networks/ci.toml
if: "env.GIT_DIFF != ''" if: "env.GIT_DIFF != ''"
- name: Emit logs on failure - name: Emit logs on failure


+ 19
- 0
test/e2e/runner/cleanup.go View File

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"path/filepath"
e2e "github.com/tendermint/tendermint/test/e2e/pkg" e2e "github.com/tendermint/tendermint/test/e2e/pkg"
) )
@ -21,6 +22,24 @@ func Cleanup(testnet *e2e.Testnet) error {
} }
logger.Info("Removing Docker containers and networks") logger.Info("Removing Docker containers and networks")
err = execCompose(testnet.Dir, "stop")
if err != nil {
return err
}
// On Linux, some local files in the volume will be owned by root since Tendermint
// runs as root inside the container, so we need to clean them up from within a
// container running as root too.
absDir, err := filepath.Abs(testnet.Dir)
if err != nil {
return err
}
err = execDocker("run", "--entrypoint", "", "-v", fmt.Sprintf("%v:/network", absDir),
"tendermint/e2e-node", "sh", "-c", "rm -rf /network/*/")
if err != nil {
return err
}
err = execCompose(testnet.Dir, "down") err = execCompose(testnet.Dir, "down")
if err != nil { if err != nil {
return err return err


Loading…
Cancel
Save