Skip to content

Commit

Permalink
patch ci (#12)
Browse files Browse the repository at this point in the history
* test: fix lint

* test: split integration tests to 3 parts(unmarked, upgrade, filter)

* test: split integration tests to 3 parts(unmarked, upgrade, filter) - conftest.py

* test: update gomod2nix.toml

* test: Add integration marker

* test: Add integration pytestmark

* test: Skip upgrade test from integration tests

* test: Add debug print

* Revert "test: Add debug print"

This reverts commit 837c399.

* test: Bump up modules for dependency test

* test: Update gomod2nix.toml

* test: Copy test_basic from cronos

* test: Fix flake8

* chore: Update statik.go
  • Loading branch information
dudong2 authored Jul 29, 2024
1 parent ba254fb commit c4c9caa
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 37 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ jobs:

integration_tests:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
# tests: [unmarked, upgrade, filter]
tests: [unmarked, filter]
env:
TESTS_TO_RUN: ${{ matrix.tests }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ test-import:
test-rpc:
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"

# possible values:
# - all: run all integration tests
# - unmarked: run integration tests that are not marked
# - marker1,marker2: markers separated by comma, run integration tests that are marked with any of the markers
TESTS_TO_RUN ?= all

run-integration-tests:
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh

Expand Down
13 changes: 9 additions & 4 deletions app/rapidgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ var (
GenType(&disttypes.MsgWithdrawDelegatorReward{}, &distapi.MsgWithdrawDelegatorReward{}, GenOpts),
GenType(&disttypes.MsgWithdrawValidatorCommission{}, &distapi.MsgWithdrawValidatorCommission{}, GenOpts),
GenType(&disttypes.MsgSetWithdrawAddress{}, &distapi.MsgSetWithdrawAddress{}, GenOpts),
GenType(&disttypes.MsgFundCommunityPool{}, &distapi.MsgFundCommunityPool{}, GenOpts), // nolint:staticcheck // testing legacy code path
GenType(&disttypes.MsgUpdateParams{}, &distapi.MsgUpdateParams{}, GenOpts.WithDisallowNil()),
GenType(&disttypes.MsgCommunityPoolSpend{}, &distapi.MsgCommunityPoolSpend{}, GenOpts), // nolint:staticcheck // testing legacy code path
GenType(&disttypes.MsgDepositValidatorRewardsPool{}, &distapi.MsgDepositValidatorRewardsPool{}, GenOpts),

// distribution - testing legacy code path
GenType(&disttypes.MsgFundCommunityPool{}, &distapi.MsgFundCommunityPool{}, GenOpts), //nolint:staticcheck
GenType(&disttypes.MsgCommunityPoolSpend{}, &distapi.MsgCommunityPoolSpend{}, GenOpts), //nolint:staticcheck

// evidence
GenType(&evidencetypes.MsgSubmitEvidence{}, &evidenceapi.MsgSubmitEvidence{},
GenOpts.WithAnyTypes(&evidenceapi.Equivocation{}).
Expand Down Expand Up @@ -274,10 +276,13 @@ var (

GenType(&stakingtypes.StakeAuthorization{}, &stakingapi.StakeAuthorization{}, GenOpts),

GenType(&upgradetypes.CancelSoftwareUpgradeProposal{}, &upgradeapi.CancelSoftwareUpgradeProposal{}, GenOpts), // nolint:staticcheck // testing legacy code path
GenType(&upgradetypes.SoftwareUpgradeProposal{}, &upgradeapi.SoftwareUpgradeProposal{}, GenOpts.WithDisallowNil()), // nolint:staticcheck // testing legacy code path
// upgrade
GenType(&upgradetypes.Plan{}, &upgradeapi.Plan{}, GenOpts.WithDisallowNil()),

// upgrade - testing legacy code path
GenType(&upgradetypes.CancelSoftwareUpgradeProposal{}, &upgradeapi.CancelSoftwareUpgradeProposal{}, GenOpts), //nolint:staticcheck
GenType(&upgradetypes.SoftwareUpgradeProposal{}, &upgradeapi.SoftwareUpgradeProposal{}, GenOpts.WithDisallowNil()), //nolint:staticcheck

GenType(&vestingtypes.BaseVestingAccount{}, &vestingapi.BaseVestingAccount{}, GenOpts.WithDisallowNil()),
GenType(&vestingtypes.ContinuousVestingAccount{}, &vestingapi.ContinuousVestingAccount{}, GenOpts.WithDisallowNil()),
GenType(&vestingtypes.DelayedVestingAccount{}, &vestingapi.DelayedVestingAccount{}, GenOpts.WithDisallowNil()),
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (app *EthermintApp) RegisterUpgradeHandlers(
baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
app.UpgradeKeeper.SetUpgradeHandler(
planName,
func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

if fromVM, err := app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
github.com/onsi/gomega v1.27.6
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/rs/cors v1.10.1
github.com/rs/cors v1.11.0
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand Down Expand Up @@ -151,7 +151,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.1 // indirect
github.com/hashicorp/go-getter v1.7.5 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY=
github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4=
github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
Expand Down Expand Up @@ -1019,8 +1019,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po=
github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
Expand Down
39 changes: 21 additions & 18 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ schema = 3
version = "v1.36.0"
hash = "sha256-dRKH1NEyAfEpVo5Mma677L7z0JO9Mfd1bv1lr1uFngI="
[mod."cosmossdk.io/api"]
version = "v0.7.4"
hash = "sha256-cjLrTWgntp98FTlxpc6/FEfnt4cH5KZyZZkTFIbNaIk="
version = "v0.7.5"
hash = "sha256-Nuw697sJr56kU3EU7DV1eYNkyI76psznIVqYAV6RfbQ="
[mod."cosmossdk.io/client/v2"]
version = "v2.0.0-beta.1"
hash = "sha256-5o3FSZ9xcYG4KLTOMbVFfPhV4CtlUn4LxjEm3/t1nOU="
Expand Down Expand Up @@ -63,8 +63,8 @@ schema = 3
version = "v0.0.0-20231023160833-026631cd833c"
hash = "sha256-alfgRKpLdGtVkHAlWAwS5QcHUzO/ZI+67eHa6zTZ6Y0="
[mod."cosmossdk.io/x/tx"]
version = "v0.13.2"
hash = "sha256-khDxSUbrrRHwRT7WlShKDGCZHTuvpofQXvuLCKiabGw="
version = "v0.13.3"
hash = "sha256-7xN5da7GZ47oAX2zGaLcIdA5zPCn9VDLfsJWtbm3VFY="
[mod."cosmossdk.io/x/upgrade"]
version = "v0.1.0"
hash = "sha256-G+7fbkBXSOsL1HFrfFDEx9LI53+xc6PLfa9kFhTx2Qo="
Expand Down Expand Up @@ -148,8 +148,8 @@ schema = 3
version = "v1.0.0"
hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0="
[mod."github.com/cometbft/cometbft"]
version = "v0.38.6"
hash = "sha256-2boDIBhWeQM7c9mAKB23cJ7bHYGf1+Dl0QeFDtO8Usk="
version = "v0.38.9"
hash = "sha256-EgSWZ8vQXekZpvUC7m5cFH3t+EO/G5CUEeOLuoh5S0k="
[mod."github.com/cometbft/cometbft-db"]
version = "v0.9.1"
hash = "sha256-ftRdle5ok2aCyqT3u5rYY0jKB8WT8uDus26Pw4Mo1go="
Expand All @@ -163,26 +163,26 @@ schema = 3
version = "v1.0.0-beta.5"
hash = "sha256-Fy/PbsOsd6iq0Njy3DVWK6HqWsogI+MkE8QslHGWyVg="
[mod."github.com/cosmos/cosmos-sdk"]
version = "v0.50.6"
hash = "sha256-uqj+BrNyb2P7Yf/X8SCH1RrlddK9iskyB/T0+xGKqu8="
version = "v0.50.8"
hash = "sha256-rCMvDol4uF+eZR6jmqXXbUCFjdleg9APzm54fNQCivk="
[mod."github.com/cosmos/go-bip39"]
version = "v1.0.0"
hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA="
[mod."github.com/cosmos/gogogateway"]
version = "v1.2.0"
hash = "sha256-Hd19V0RCiMoCL67NsqvWIsvWF8KM3LnuJTbYjWtQkEo="
[mod."github.com/cosmos/gogoproto"]
version = "v1.4.12"
hash = "sha256-e2tbfaZtzLijq+EMnNG9GWKDCG4sBj8wIVnn6/R26iM="
version = "v1.5.0"
hash = "sha256-xfMjGMPy5+Nw4EhmiveFSSRNQXnocyUB7QGTN/ET1m0="
[mod."github.com/cosmos/iavl"]
version = "v1.1.2"
hash = "sha256-fhh5fN1BMDxbF4PobERMQdIb9vIrxaSl0tRXas0WKmc="
version = "v1.1.4"
hash = "sha256-bBU5w5rEMvpCWSzFBIVvnMHnsy2+a+e1DPDkb4hNOwU="
[mod."github.com/cosmos/ibc-go/modules/capability"]
version = "v1.0.0"
hash = "sha256-xOeHJWUj6fTc2EUGiE4dgfY2WkvrqTg/FWewoUvQcvg="
[mod."github.com/cosmos/ibc-go/v8"]
version = "v8.0.0"
hash = "sha256-RBj66/3xB8KTD9wbryv/tpRYYdKIDCJ/4u6u6s1Eeuo="
version = "v8.3.2"
hash = "sha256-uqt1GlZ1sQ7k5b3vGiRxawGp53yeAv0RjOotOIY7Z0E="
[mod."github.com/cosmos/ics23/go"]
version = "v0.10.0"
hash = "sha256-KYEv727BO/ht63JO02xiKFGFAddg41Ve9l2vSSZZBq0="
Expand Down Expand Up @@ -358,8 +358,8 @@ schema = 3
version = "v0.5.2"
hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ="
[mod."github.com/hashicorp/go-getter"]
version = "v1.7.1"
hash = "sha256-szIdn7GPvJ78gKKzQRWlx39X81QRDsXtJKo3P/4oMIg="
version = "v1.7.5"
hash = "sha256-oXUvMoee8GT69MA0E2JHxYm1Q2q8BtmwlfxFshDKXmI="
[mod."github.com/hashicorp/go-hclog"]
version = "v1.5.0"
hash = "sha256-u3Jqg7Qex11IZ7vbk4hRGgLy6e0cF70CCx7ERF0GUHo="
Expand All @@ -381,6 +381,9 @@ schema = 3
[mod."github.com/hashicorp/golang-lru"]
version = "v1.0.2"
hash = "sha256-yy+5botc6T5wXgOe2mfNXJP3wr+MkVlUZ2JBkmmrA48="
[mod."github.com/hashicorp/golang-lru/v2"]
version = "v2.0.7"
hash = "sha256-t1bcXLgrQNOYUVyYEZ0knxcXpsTk4IuJZDjKvyJX75g="
[mod."github.com/hashicorp/hcl"]
version = "v1.0.0"
hash = "sha256-xsRCmYyBfglMxeWUvTZqkaRLSW+V2FvNodEDjTGg1WA="
Expand Down Expand Up @@ -526,8 +529,8 @@ schema = 3
version = "v1.12.0"
hash = "sha256-qvDNCe3l84/LgrA8X4O15e1FeDcazyX91m9LmXGXX6M="
[mod."github.com/rs/cors"]
version = "v1.10.1"
hash = "sha256-um4INJM5/675MLK42npIsDbSQ1/Iy5ZiUNuAFReUfeM="
version = "v1.11.0"
hash = "sha256-hF25bVehtWCQsxiOfLuL4Hv8NKVunEqLPk/Vcuheha0="
[mod."github.com/rs/zerolog"]
version = "v1.32.0"
hash = "sha256-9dZjtsES+wLp1cFiSVMuEUbdeXVFcgT0dgg5ACZkILk="
Expand Down
2 changes: 1 addition & 1 deletion rpc/websockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (s *websocketsServer) Start() {

func (s *websocketsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
upgrader := websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
CheckOrigin: func(_ *http.Request) bool {
return true
},
}
Expand Down
11 changes: 10 additions & 1 deletion scripts/run-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@ cd ../tests/integration_tests/hardhat
HUSKY_SKIP_INSTALL=1 npm install
npm run typechain
cd ..
pytest -vv -s

TESTS_TO_RUN="${TESTS_TO_RUN:-all}"

if [[ "$TESTS_TO_RUN" == "all" ]]; then
echo "run all tests"
pytest -vv -s
else
echo "run tests matching $TESTS_TO_RUN"
pytest -vv -s -m "$TESTS_TO_RUN"
fi
2 changes: 1 addition & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
cmd.Flags().Uint32(server.FlagStateSyncSnapshotKeepRecent, 2, "State sync snapshot to keep")

// support old flags name for backwards compatibility
cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
cmd.Flags().SetNormalizeFunc(func(_ *pflag.FlagSet, name string) pflag.NormalizedName {
if name == "with-tendermint" {
name = srvflags.WithComet
}
Expand Down
16 changes: 13 additions & 3 deletions tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
from .network import setup_ethermint, setup_geth


def pytest_configure(config):
config.addinivalue_line("markers", "unmarked: fallback mark for unmarked tests")
config.addinivalue_line("markers", "upgrade: upgrade tests")
config.addinivalue_line("markers", "filter: filter tests")


def pytest_collection_modifyitems(items, config):
for item in items:
if not any(item.iter_markers()):
item.add_marker("unmarked")


@pytest.fixture(scope="session")
def ethermint(tmp_path_factory):
path = tmp_path_factory.mktemp("ethermint")
Expand All @@ -15,9 +27,7 @@ def geth(tmp_path_factory):
yield from setup_geth(path, 8545)


@pytest.fixture(
scope="session", params=["ethermint", "ethermint-ws"]
)
@pytest.fixture(scope="session", params=["ethermint", "ethermint-ws"])
def ethermint_rpc_ws(request, ethermint):
"""
run on both ethermint and ethermint websocket
Expand Down
4 changes: 3 additions & 1 deletion tests/integration_tests/test_fee_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from web3 import Web3

from .network import setup_ethermint
from .utils import ADDRS, send_transaction
from .utils import ADDRS, send_transaction, w3_wait_for_block


@pytest.fixture(scope="module")
Expand All @@ -29,6 +29,8 @@ def cluster(request, custom_ethermint, geth):

def test_basic(cluster):
w3: Web3 = cluster.w3
# need at least 5 blocks
w3_wait_for_block(w3, 5)
call = w3.provider.make_request
tx = {"to": ADDRS["community"], "value": 10, "gasPrice": w3.eth.gas_price}
send_transaction(w3, tx)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration_tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
w3_wait_for_new_blocks,
)

pytestmark = pytest.mark.filter


@pytest.fixture(scope="module")
def custom_ethermint(tmp_path_factory):
Expand Down
2 changes: 2 additions & 0 deletions tests/integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
wait_for_port,
)

pytestmark = pytest.mark.upgrade


def init_cosmovisor(home):
"""
Expand Down

0 comments on commit c4c9caa

Please sign in to comment.