From 3b1d7d4786c8a68bd784f8c99f19e2e5a3daca5f Mon Sep 17 00:00:00 2001 From: NagaTulasi Date: Fri, 27 Sep 2024 17:12:56 +0530 Subject: [PATCH] fix: sim tests --- .github/workflows/sims.yml | 57 +++++++++++++++++++++++++++++++-- Makefile | 64 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 34 deletions(-) diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index e58f8ea..f8daea4 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -6,7 +6,7 @@ on: push: branches: - main - + concurrency: group: ci-${{ github.ref }}-sims cancel-in-progress: true @@ -23,7 +23,7 @@ jobs: with: go-version: "1.21" check-latest: true - - run: make -C simapp build + - run: make build - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - uses: actions/cache@v3 @@ -49,6 +49,59 @@ jobs: run: | make test-sim-nondeterminism + # test-sim-import-export: + # runs-on: ubuntu-latest + # needs: [build] + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-go@v4 + # with: + # go-version: "1.21" + # check-latest: true + # - uses: actions/cache@v3 + # with: + # path: ~/go/bin + # key: ${{ runner.os }}-go-runsim-binary + # - name: test-sim-import-export + # run: | + # make test-sim-import-export + + # test-sim-after-import: + # runs-on: ubuntu-latest + # needs: [build] + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-go@v4 + # with: + # go-version: "1.21" + # check-latest: true + # - uses: actions/cache@v3 + # with: + # path: ~/go/bin + # key: ${{ runner.os }}-go-runsim-binary + # - name: test-sim-after-import + # run: | + # make test-sim-after-import + + # test-sim-multi-seed-short: + # runs-on: ubuntu-latest + # needs: [build] + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-go@v4 + # with: + # go-version: "1.21" + # check-latest: true + # - uses: actions/cache@v3 + # with: + # path: ~/go/bin + # key: ${{ runner.os }}-go-runsim-binary + # - name: test-sim-multi-seed-short + # run: | + # make test-sim-multi-seed-short + sims-notify-success: needs: [test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export] diff --git a/Makefile b/Makefile index 7837a34..dc38c5f 100644 --- a/Makefile +++ b/Makefile @@ -159,38 +159,38 @@ test-sim-nondeterminism: @cd ${CURRENT_DIR}/simapp/app && go test -mod=readonly -run TestAppStateDeterminism -Enabled=true \ -NumBlocks=20 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h -# test-sim-custom-genesis-fast: -# @echo "Running custom genesis simulation..." -# @echo "By default, ${HOME}/.cada/config/genesis.json will be used." -# @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestFullAppSimulation -Genesis=${HOME}/.cada/config/genesis.json \ -# -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h - -# test-sim-import-export: runsim -# @echo "Running application import/export simulation. This may take several minutes..." -# @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 50 5 TestAppImportExport - -# test-sim-after-import: runsim -# @echo "Running application simulation-after-import. This may take several minutes..." -# @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 50 5 TestAppSimulationAfterImport - -# test-sim-custom-genesis-multi-seed: runsim -# @echo "Running multi-seed custom genesis simulation..." -# @echo "By default, ${HOME}/.cada/config/genesis.json will be used." -# @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Genesis=${HOME}/.cada/config/genesis.json -SimAppPkg=. -ExitOnFail 400 5 TestFullAppSimulation - -# test-sim-multi-seed-long: runsim -# @echo "Running long multi-seed application simulation. This may take awhile!" -# @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 500 50 TestFullAppSimulation - -# test-sim-multi-seed-short: runsim -# @echo "Running short multi-seed application simulation. This may take awhile!" -# @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 50 10 TestFullAppSimulation - -# test-sim-benchmark-invariants: -# @echo "Running simulation invariant benchmarks..." -# cd ${CURRENT_DIR}/simapp && @go test -mod=readonly -benchmem -bench=BenchmarkInvariants -run=^$ \ -# -Enabled=true -NumBlocks=1000 -BlockSize=200 \ -# -Period=1 -Commit=true -Seed=57 -v -timeout 24h +test-sim-custom-genesis-fast: + @echo "Running custom genesis simulation..." + @echo "By default, ${HOME}/.cada/config/genesis.json will be used." + @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestFullAppSimulation -Genesis=${HOME}/.cada/config/genesis.json \ + -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h + +test-sim-import-export: runsim + @echo "Running application import/export simulation. This may take several minutes..." + @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 50 5 TestAppImportExport + +test-sim-after-import: runsim + @echo "Running application simulation-after-import. This may take several minutes..." + @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 50 5 TestAppSimulationAfterImport + +test-sim-custom-genesis-multi-seed: runsim + @echo "Running multi-seed custom genesis simulation..." + @echo "By default, ${HOME}/.cada/config/genesis.json will be used." + @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Genesis=${HOME}/.cada/config/genesis.json -SimAppPkg=. -ExitOnFail 400 5 TestFullAppSimulation + +test-sim-multi-seed-long: runsim + @echo "Running long multi-seed application simulation. This may take awhile!" + @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 500 50 TestFullAppSimulation + +test-sim-multi-seed-short: runsim + @echo "Running short multi-seed application simulation. This may take awhile!" + @cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 50 10 TestFullAppSimulation + +test-sim-benchmark-invariants: + @echo "Running simulation invariant benchmarks..." + cd ${CURRENT_DIR}/simapp && @go test -mod=readonly -benchmem -bench=BenchmarkInvariants -run=^$ \ + -Enabled=true -NumBlocks=1000 -BlockSize=200 \ + -Period=1 -Commit=true -Seed=57 -v -timeout 24h .PHONY: \ test-sim-nondeterminism \