From 04b3545992e37d4e5341e9e5a63cf29c4d61e7e8 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Tue, 21 Mar 2023 19:48:46 -0700 Subject: [PATCH] Fix integration coverage (#111) * fix integration coverage * upload code coverage * fix formatting * forgot one --- .github/workflows/tokenvm-unit-tests.yml | 10 ++++++++++ .gitignore | 1 + examples/tokenvm/scripts/tests.integration.sh | 14 +++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tokenvm-unit-tests.yml b/.github/workflows/tokenvm-unit-tests.yml index 94e71deeaa..4d83ffa99b 100644 --- a/.github/workflows/tokenvm-unit-tests.yml +++ b/.github/workflows/tokenvm-unit-tests.yml @@ -30,6 +30,16 @@ jobs: working-directory: ./examples/tokenvm shell: bash run: scripts/tests.integration.sh + - name: Archive code coverage results (text) + uses: actions/upload-artifact@v3 + with: + name: code-coverage-out + path: ./examples/tokenvm/integration.coverage.out + - name: Archive code coverage results (html) + uses: actions/upload-artifact@v3 + with: + name: code-coverage-html + path: ./examples/tokenvm/integration.coverage.html - name: Run e2e tests working-directory: ./examples/tokenvm shell: bash diff --git a/.gitignore b/.gitignore index f58c9e714f..f491a759c2 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ dist/ *.pk tmp-storage-testing .token-cli* +*.html diff --git a/examples/tokenvm/scripts/tests.integration.sh b/examples/tokenvm/scripts/tests.integration.sh index 0348a0a24f..336e36d1d9 100755 --- a/examples/tokenvm/scripts/tests.integration.sh +++ b/examples/tokenvm/scripts/tests.integration.sh @@ -15,6 +15,10 @@ if ! [[ "$0" =~ scripts/tests.integration.sh ]]; then exit 255 fi +# remove previous coverage reports +rm -f integration.coverage.out +rm -f integration.coverage.html + # to install the ginkgo binary (required for test build and run) go install -v github.com/onsi/ginkgo/v2/ginkgo@v2.0.0-rc2 || true @@ -23,9 +27,13 @@ ACK_GINKGO_RC=true ginkgo \ run \ -v \ --fail-fast \ ---cover \ ---coverpkg github.com/ava-labs/hypersdk/examples/tokenvm/chain,github.com/ava-labs/hypersdk/examples/tokenvm/vm \ +-cover \ +-covermode=atomic \ +-coverpkg=github.com/ava-labs/hypersdk/... \ +-coverprofile=integration.coverage.out \ ./tests/integration \ --- \ --vms 3 \ --min-price 1 + +# output generate coverage html +go tool cover -html=integration.coverage.out -o=integration.coverage.html