diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index 2898bdef..af9ce4b1 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -29,7 +29,9 @@ jobs: run: scripts/tests.integration.sh - name: Run e2e tests shell: bash - run: scripts/tests.e2e.sh 1.7.3 + run: scripts/run.sh 1.7.3 + env: + E2E: true - name: Run GoReleaser for cross-platform builds uses: goreleaser/goreleaser-action@v2 with: diff --git a/README.md b/README.md index 356c22d9..a440228e 100644 --- a/README.md +++ b/README.md @@ -32,18 +32,18 @@ At its core, the Avalanche protocol still maintains the immutable ordered sequen ## Run `quarkvm` with local network -[`scripts/tests.e2e.sh`](scripts/tests.e2e.sh) automatically installs [avalanchego](https://github.com/ava-labs/avalanchego) to set up a local network, creates `quarkvm` genesis file, and run e2e tests. +[`scripts/run.sh`](scripts/run.sh) automatically installs [avalanchego](https://github.com/ava-labs/avalanchego) to set up a local networkand creates a `quarkvm` genesis file. To build and run E2E tests, you need to set the variable `E2E` before it: `E2E=true ./scripts/run.sh 1.7.3` See [`tests/e2e`](tests/e2e) and [`tests/runner`](tests/runner) to see how it's set up and how its client requests are made: ```bash -# to run full e2e tests and shut down cluster afterwards +# to startup a cluster cd ${HOME}/go/src/github.com/ava-labs/quarkvm -./scripts/tests.e2e.sh 1.7.3 +./scripts/run.sh 1.7.3 -# to run full e2e tests and keep the cluster alive +# to run full e2e tests and shut down cluster afterwards cd ${HOME}/go/src/github.com/ava-labs/quarkvm -SHUTDOWN=false ./scripts/tests.e2e.sh 1.7.3 +E2E=true ./scripts/run.sh 1.7.3 ``` ```bash diff --git a/scripts/tests.e2e.sh b/scripts/run.sh similarity index 75% rename from scripts/tests.e2e.sh rename to scripts/run.sh index d1ef59de..de57c362 100755 --- a/scripts/tests.e2e.sh +++ b/scripts/run.sh @@ -2,11 +2,14 @@ set -e # e.g., -# ./scripts/tests.e2e.sh 1.7.3 +# ./scripts/run.sh 1.7.3 # -# to keep the cluster alive -# SHUTDOWN=false ./scripts/tests.e2e.sh 1.7.3 -if ! [[ "$0" =~ scripts/tests.e2e.sh ]]; then +# to shut the cluster down +# SHUTDOWN=false ./scripts/run.sh 1.7.3 + +# to run E2E tests +# E2E=true ./scripts/run.sh 1.7.3 +if ! [[ "$0" =~ scripts/run.sh ]]; then echo "must be run from repository root" exit 255 fi @@ -18,8 +21,9 @@ if [[ -z "${VERSION}" ]]; then exit 255 fi -SHUTDOWN=${SHUTDOWN:-true} -if [[ ${SHUTDOWN} == true ]]; then +SHUTDOWN=${SHUTDOWN:-false} +E2E=${E2E:-false} +if [[ ${SHUTDOWN} == true || ${E2E} == true ]]; then _SHUTDOWN_FLAG="--shutdown" else _SHUTDOWN_FLAG="" @@ -70,11 +74,13 @@ pushd ./tests/runner go build -v -o /tmp/runner . popd -echo "building e2e.test" -# to install the ginkgo binary (required for test build and run) -go install -v github.com/onsi/ginkgo/v2/ginkgo@v2.0.0-rc2 -ACK_GINKGO_RC=true ginkgo build ./tests/e2e -./tests/e2e/e2e.test --help +if [[ ${E2E} == true ]]; then + echo "building e2e.test" + # to install the ginkgo binary (required for test build and run) + go install -v github.com/onsi/ginkgo/v2/ginkgo@v2.0.0-rc2 + ACK_GINKGO_RC=true ginkgo build ./tests/e2e + ./tests/e2e/e2e.test --help +fi echo "launch local test cluster in the background" /tmp/runner \ @@ -103,10 +109,12 @@ else exit 255 fi -echo "running e2e tests against the local cluster with shutdown flag '${_SHUTDOWN_FLAG}'" -./tests/e2e/e2e.test \ ---ginkgo.v \ ---cluster-info-path /tmp/avalanchego-v${VERSION}/output.yaml \ -${_SHUTDOWN_FLAG} +if [[ ${E2E} == true ]]; then + echo "running e2e tests against the local cluster with shutdown flag '${_SHUTDOWN_FLAG}'" + ./tests/e2e/e2e.test \ + --ginkgo.v \ + --cluster-info-path /tmp/avalanchego-v${VERSION}/output.yaml \ + ${_SHUTDOWN_FLAG} -echo "ALL SUCCESS!" + echo "ALL SUCCESS!" +fi diff --git a/tests/runner/main.go b/tests/runner/main.go index 4790af27..d5c40029 100644 --- a/tests/runner/main.go +++ b/tests/runner/main.go @@ -195,6 +195,7 @@ func newLocalNetwork( "network-peer-list-gossip-frequency":"250ms", "network-max-reconnect-delay":"1s", "public-ip":"0.0.0.0", + "http-host":"", "health-check-frequency":"2s", "api-admin-enabled":true, "api-ipcs-enabled":true,