Skip to content

Commit

Permalink
tests: make integration test more stable (evmos#1488)
Browse files Browse the repository at this point in the history
* wait new blk right before send tx

* larger timeout_commit for priority test

* larger timeout_commit for mempool related test

* mv chain id test to cluster used test

* keep cluster in module scope

* sync gomod2nix

* adjust timeout_commit

* rm prune all in indexer config

* add missing min_gas_multiplier

* wait 1 more blk in upgrade

* only keep 2 validators

* add retry for grpc_eth_call

* wait 1 block before stop

* fix lint

* disable recheck

* bump up upgrade

* sync gomod2nix

* Apply suggestions from code review

* Apply suggestions from code review

* append node log

* fix lint

* expect less gas after ecd7639

* allow retry continue on empty rsp

* update gomod2nix

* fix flake

* mod tidy

* keep grpc only test

* tests(integration): enable recheck tx mode

* update gomod2nix

Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Freddy Caceres <[email protected]>
Co-authored-by: Tom <[email protected]>
  • Loading branch information
4 people committed Mar 8, 2023
1 parent 68b4541 commit f562037
Show file tree
Hide file tree
Showing 19 changed files with 317 additions and 175 deletions.
5 changes: 3 additions & 2 deletions tests/integration_tests/configs/cosmovisor.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ local config = import 'default.jsonnet';

config {
'ethermint_9000-1'+: {
'app-config'+: {
'minimum-gas-prices': '100000000000aphoton',
},
genesis+: {
app_state+: {
feemarket+: {
params+: {
no_base_fee: false,
base_fee:: super.base_fee,
initial_base_fee: super.base_fee,
},
},
},
Expand Down
4 changes: 0 additions & 4 deletions tests/integration_tests/configs/default.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
cmd: 'ethermintd',
'start-flags': '--trace',
config: {
consensus: {
// larger timeout for more stable mempool tests
timeout_commit: '10s',
},
mempool: {
// use v1 mempool to enable tx prioritization
version: 'v1',
Expand Down
13 changes: 9 additions & 4 deletions tests/integration_tests/configs/enable-indexer.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ config {
},
},
'app-config'+: {
pruning: 'everything',
'state-sync'+: {
'snapshot-interval': 0,
},
'json-rpc'+: {
'enable-indexer': true,
},
},
genesis+: {
app_state+: {
feemarket+: {
params+: {
min_gas_multiplier: '0',
},
},
},
},
},
}
11 changes: 11 additions & 0 deletions tests/integration_tests/configs/long_timeout_commit.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local default = import 'default.jsonnet';

default {
'ethermint_9000-1'+: {
config+: {
consensus+: {
timeout_commit: '5s',
},
},
},
}
9 changes: 9 additions & 0 deletions tests/integration_tests/configs/pruned_node.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ config {
'snapshot-interval': 0,
},
},
genesis+: {
app_state+: {
feemarket+: {
params+: {
min_gas_multiplier: '0',
},
},
},
},
},
}
2 changes: 1 addition & 1 deletion tests/integration_tests/configs/rollback-test.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local config = import 'default.jsonnet';

config {
'ethermint_9000-1'+: {
validators: super.validators + [{
validators: super.validators[0:1] + [{
name: 'fullnode',
}],
},
Expand Down
5 changes: 2 additions & 3 deletions tests/integration_tests/configs/upgrade-test-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ let
fetchEthermint = rev: builtins.fetchTarball "https://github.com/evmos/ethermint/archive/${rev}.tar.gz";
released = pkgs.buildGo118Module rec {
name = "ethermintd";
# the commit before https://github.com/evmos/ethermint/pull/943
src = fetchEthermint "f21592ebfe74da7590eb42ed926dae970b2a9a3f";
src = fetchEthermint "d29cdad6e667f6089dfecbedd36bb8d3a2a7d025";
subPackages = [ "cmd/ethermintd" ];
vendorSha256 = "sha256-ABm5t6R/u2S6pThGrgdsqe8n3fH5tIWw7a57kxJPbYw=";
vendorSha256 = "sha256-cQAol54b6hNzsA4Q3MP9mTqFWM1MvR5uMPrYpaoj3SY=";
doCheck = false;
};
current = pkgs.callPackage ../../../. { };
Expand Down
34 changes: 1 addition & 33 deletions tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pathlib import Path

import pytest

from .network import setup_custom_ethermint, setup_ethermint, setup_geth
from .network import setup_ethermint, setup_geth


@pytest.fixture(scope="session")
Expand All @@ -11,42 +9,12 @@ def ethermint(tmp_path_factory):
yield from setup_ethermint(path, 26650)


@pytest.fixture(scope="session")
def ethermint_indexer(tmp_path_factory):
path = tmp_path_factory.mktemp("indexer")
yield from setup_custom_ethermint(
path, 26660, Path(__file__).parent / "configs/enable-indexer.jsonnet"
)


@pytest.fixture(scope="session")
def geth(tmp_path_factory):
path = tmp_path_factory.mktemp("geth")
yield from setup_geth(path, 8545)


@pytest.fixture(
scope="session", params=["ethermint", "geth", "ethermint-ws", "enable-indexer"]
)
def cluster(request, ethermint, ethermint_indexer, geth):
"""
run on both ethermint and geth
"""
provider = request.param
if provider == "ethermint":
yield ethermint
elif provider == "geth":
yield geth
elif provider == "ethermint-ws":
ethermint_ws = ethermint.copy()
ethermint_ws.use_websocket()
yield ethermint_ws
elif provider == "enable-indexer":
yield ethermint_indexer
else:
raise NotImplementedError


@pytest.fixture(
scope="session", params=["ethermint", "ethermint-ws"]
)
Expand Down
8 changes: 5 additions & 3 deletions tests/integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pystarport.utils import build_cli_args_safe, interact

DEFAULT_GAS_PRICE = "5000000000000aphoton"
DEFAULT_GAS = "250000"


class ChainCommand:
Expand Down Expand Up @@ -636,13 +637,14 @@ def edit_validator(
)

def gov_propose(self, proposer, kind, proposal, **kwargs):
method = "submit-proposal"
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
if kind == "software-upgrade":
return json.loads(
self.raw(
"tx",
"gov",
"submit-proposal",
method,
kind,
proposal["name"],
"-y",
Expand All @@ -664,7 +666,7 @@ def gov_propose(self, proposer, kind, proposal, **kwargs):
self.raw(
"tx",
"gov",
"submit-proposal",
method,
kind,
"-y",
from_=proposer,
Expand All @@ -685,7 +687,7 @@ def gov_propose(self, proposer, kind, proposal, **kwargs):
self.raw(
"tx",
"gov",
"submit-proposal",
method,
kind,
fp.name,
"-y",
Expand Down
Loading

0 comments on commit f562037

Please sign in to comment.