From 1bbaea29507db5346c6977d8c5a761799ce83490 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 8 Jul 2022 07:48:53 +0200 Subject: [PATCH] wip --- .github/workflows/legacy-test.yml | 8 +++----- .github/workflows/test-race.yml | 2 +- .github/workflows/test.yml | 2 +- contrib/test_cover.sh | 2 +- scripts/module-tests.sh | 2 +- testutil/network/network.go | 7 +++++++ 6 files changed, 14 insertions(+), 9 deletions(-) mode change 100644 => 100755 scripts/module-tests.sh diff --git a/.github/workflows/legacy-test.yml b/.github/workflows/legacy-test.yml index 2a779c342ae0..243183585266 100644 --- a/.github/workflows/legacy-test.yml +++ b/.github/workflows/legacy-test.yml @@ -100,7 +100,7 @@ jobs: if: env.GIT_DIFF - name: test & coverage report creation run: | - cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='legacy_simapp norace ledger test_ledger_mock' + cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 15m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='legacy_simapp norace ledger test_ledger_mock' if: env.GIT_DIFF - uses: actions/upload-artifact@v3 with: @@ -108,8 +108,7 @@ jobs: path: ./${{ matrix.part }}profile.out sims-notify-success: - needs: - [tests] + needs: [tests] runs-on: ubuntu-latest if: ${{ success() }} steps: @@ -135,8 +134,7 @@ jobs: SLACK_FOOTER: "" sims-notify-failure: - needs: - [tests] + needs: [tests] runs-on: ubuntu-latest if: ${{ failure() }} steps: diff --git a/.github/workflows/test-race.yml b/.github/workflows/test-race.yml index 6ac7404df2cb..cd96ad8c1de1 100644 --- a/.github/workflows/test-race.yml +++ b/.github/workflows/test-race.yml @@ -130,7 +130,7 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -v -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock' + xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -timeout 15m -race -tags='cgo ledger test_ledger_mock' - uses: actions/upload-artifact@v3 if: env.GIT_DIFF with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c0b448770c1..c51f58344f78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -155,7 +155,7 @@ jobs: if: env.GIT_DIFF - name: test & coverage report creation run: | - cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='norace ledger test_ledger_mock' + cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 15m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='norace ledger test_ledger_mock' if: env.GIT_DIFF - uses: actions/upload-artifact@v3 with: diff --git a/contrib/test_cover.sh b/contrib/test_cover.sh index 24f7804b5162..5c83475315ab 100644 --- a/contrib/test_cover.sh +++ b/contrib/test_cover.sh @@ -6,7 +6,7 @@ PKGS=$(go list ./... | grep -v '/simapp') set -e echo "mode: atomic" > coverage.txt for pkg in ${PKGS[@]}; do - go test -v -timeout 30m -race -coverprofile=profile.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" + go test -v -timeout 15m -race -coverprofile=profile.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" if [ -f profile.out ]; then tail -n +2 profile.out >> coverage.txt; rm profile.out diff --git a/scripts/module-tests.sh b/scripts/module-tests.sh old mode 100644 new mode 100755 index b6be64240e3b..ab1f93d8365c --- a/scripts/module-tests.sh +++ b/scripts/module-tests.sh @@ -21,7 +21,7 @@ execute_mod_tests() { echo ">>> running $go_mod tests" cd $mod_dir; - go test -mod=readonly -timeout 30m -coverprofile=${root_dir}/${coverage_file}.tmp -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + go test -mod=readonly -timeout 15m -coverprofile=${root_dir}/${coverage_file}.tmp -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... local ret=$? echo "test return: " $ret; cd -; diff --git a/testutil/network/network.go b/testutil/network/network.go index 19f2b0fc66c7..2c45e069f8e3 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "fmt" + "log" "net/http" "net/url" "os" @@ -50,6 +51,8 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + _ "net/http/pprof" ) // package-wide network lock to only allow one test network at a time @@ -260,6 +263,10 @@ func NewCLILogger(cmd *cobra.Command) CLILogger { // New creates a new Network for integration tests or in-process testnets run via the CLI func New(l Logger, baseDir string, cfg Config) (*Network, error) { + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() + // only one caller/test can create and use a network at a time l.Log("acquiring test network lock") lock.Lock()