Skip to content

Commit

Permalink
test upgrade fix
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Jan 24, 2025
1 parent eb9564b commit d4fc2ec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
wait_for_block,
wait_for_block_time,
wait_for_port,
find_log_event_attrs,

Check failure on line 22 in tests/integration_tests/test_upgrade.py

View workflow job for this annotation

GitHub Actions / Run flake8 on python integration tests

./tests/integration_tests/test_upgrade.py:22:1: I001 isort found an import in the wrong position
)

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'parse_events' is not used.


Expand Down Expand Up @@ -117,12 +118,24 @@ def test_cosmovisor_upgrade(custom_ethermint: Ethermint):
},
)
assert rsp["code"] == 0, rsp["raw_log"]

print("Rsp: ", rsp)
# get proposal_id
ev = parse_events(rsp["logs"])["submit_proposal"]

rsp = cli.event_query_tx_for(rsp["txhash"])

Check failure on line 124 in tests/integration_tests/test_upgrade.py

View workflow job for this annotation

GitHub Actions / integration_tests

test_cosmovisor_upgrade AssertionError: (/tmp/pytest-of-runner/pytest-0/upgrade0/upgrades/genesis/bin/ethermintd query event-query-tx-for F475C132989F06794287066DBEE0A7DC94BC93B465B3A02F5D081D1ACE88DBA3 -y --home /tmp/pytest-of-runner/pytest-0/upgrade0/ethermint_9000-1/node0)
print("Rsp: ", rsp)

def cb(attrs):
return "proposal_id" in attrs

ev = find_log_event_attrs(rsp["events"], "submit_proposal", cb)

print("Ev: ", rsp)

proposal_id = ev["proposal_id"]

rsp = cli.gov_vote("validator", proposal_id, "yes")
print("Rsp: ", rsp)

assert rsp["code"] == 0, rsp["raw_log"]
# rsp = custom_ethermint.cosmos_cli(1).gov_vote("validator", proposal_id, "yes")
# assert rsp["code"] == 0, rsp["raw_log"]
Expand Down
7 changes: 7 additions & 0 deletions tests/integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ def parse_events(logs):
for ev in logs[0]["events"]
}

def find_log_event_attrs(events, ev_type, cond=None):

Check failure on line 252 in tests/integration_tests/utils.py

View workflow job for this annotation

GitHub Actions / Run flake8 on python integration tests

./tests/integration_tests/utils.py:252:1: E302 expected 2 blank lines, found 1
for ev in events:
if ev["type"] == ev_type:
attrs = {attr["key"]: attr["value"] for attr in ev["attributes"]}
if cond is None or cond(attrs):
return attrs
return None

def derive_new_account(n=1):

Check failure on line 260 in tests/integration_tests/utils.py

View workflow job for this annotation

GitHub Actions / Run flake8 on python integration tests

./tests/integration_tests/utils.py:260:1: E302 expected 2 blank lines, found 1
# derive a new address
Expand Down

0 comments on commit d4fc2ec

Please sign in to comment.