From 4b3565fcaa0fe279032574c92ee15f69320548be Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Mon, 5 Oct 2020 12:44:35 +0200 Subject: [PATCH] test: add GitHub action for end-to-end tests (#5452) Partial fix for #5291. --- .github/workflows/e2e.yml | 38 ++++++++++++++++++++++++++++++++++++++ test/e2e/README.md | 2 ++ test/e2e/docker/Dockerfile | 4 ++-- test/e2e/runner/main.go | 8 ++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 000000000..c08107034 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,38 @@ +name: e2e-tests +# Runs the CI end-to-end test network on all pushes to master or release branches +# and every pull request, but only if any Go files have been changed. +on: + pull_request: + push: + branches: + - master + - release/** + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v2 + - uses: technote-space/get-diff-action@v3 + with: + SUFFIX_FILTER: | + .go + .mod + .sum + SET_ENV_NAME_INSERTIONS: 1 + SET_ENV_NAME_LINES: 1 + + - name: Build + working-directory: test/e2e + # Run two make jobs in parallel, since we can't run steps in parallel. + run: make -j2 docker runner + + - name: Run CI testnet + working-directory: test/e2e + run: sudo ./build/runner -f networks/ci.toml + + - name: Emit logs on failure + if: ${{ failure() }} + working-directory: test/e2e + run: ./build/runner -f networks/ci.toml logs diff --git a/test/e2e/README.md b/test/e2e/README.md index 7c4891ce2..a352959c6 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -36,6 +36,8 @@ The test runner has the following stages, which can also be executed explicitly * `logs`: outputs all node logs. +* `tail`: tails (follows) node logs until cancelled. + ## Tests Test cases are written as normal Go tests in `tests/`. They use a `testNode()` helper which executes each test as a parallel subtest for each node in the network. diff --git a/test/e2e/docker/Dockerfile b/test/e2e/docker/Dockerfile index ba0e51be4..273bd07c6 100644 --- a/test/e2e/docker/Dockerfile +++ b/test/e2e/docker/Dockerfile @@ -3,8 +3,8 @@ # instead of spending time compiling them. FROM golang:1.15 -RUN apt-get update -y && apt-get upgrade -y -RUN apt-get install -y libleveldb-dev librocksdb-dev +RUN apt-get -qq update -y && apt-get -qq upgrade -y >/dev/null +RUN apt-get -qq install -y libleveldb-dev librocksdb-dev >/dev/null # Set up build directory /src/tendermint ENV TENDERMINT_BUILD_OPTIONS badgerdb,boltdb,cleveldb,rocksdb diff --git a/test/e2e/runner/main.go b/test/e2e/runner/main.go index b01b208f8..d58305c9b 100644 --- a/test/e2e/runner/main.go +++ b/test/e2e/runner/main.go @@ -167,6 +167,14 @@ func NewCLI() *CLI { cli.root.AddCommand(&cobra.Command{ Use: "logs", Short: "Shows the testnet logs", + RunE: func(cmd *cobra.Command, args []string) error { + return execComposeVerbose(cli.testnet.Dir, "logs") + }, + }) + + cli.root.AddCommand(&cobra.Command{ + Use: "tail", + Short: "Tails the testnet logs", RunE: func(cmd *cobra.Command, args []string) error { return execComposeVerbose(cli.testnet.Dir, "logs", "--follow") },