Skip to content

Commit

Permalink
test: fix integration test(broken test - patch file, SyncInfo -> sync…
Browse files Browse the repository at this point in the history
…_info
  • Loading branch information
dudong2 committed Dec 20, 2023
1 parent ae8fb22 commit 2d37695
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions tests/integration_tests/configs/broken-ethermintd.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
diff --git a/app/app.go b/app/app.go
index 158bf7a3..a3b5718c 100644
index acd2c76b..bb6faed3 100644
--- a/app/app.go
+++ b/app/app.go
@@ -681,6 +681,10 @@ func (app *EthermintApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBloc
@@ -907,6 +907,10 @@ func (app *EthermintApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBloc

// EndBlocker updates every end block
func (app *EthermintApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
// BeginBlocker updates every begin block
func (app *EthermintApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) {
+ if ctx.BlockHeight()%10 == 0 {
+ store := ctx.KVStore(app.keys["evm"])
+ store.Set([]byte("hello"), []byte("world"))
+ }
return app.mm.EndBlock(ctx, req)
return app.ModuleManager.BeginBlock(ctx)
}

4 changes: 2 additions & 2 deletions tests/integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ def status(self):
return json.loads(self.raw("status", node=self.node_rpc))

def block_height(self):
return int(self.status()["SyncInfo"]["latest_block_height"])
return int(self.status()["sync_info"]["latest_block_height"])

def block_time(self):
return isoparse(self.status()["SyncInfo"]["latest_block_time"])
return isoparse(self.status()["sync_info"]["latest_block_time"])

def balances(self, addr):
return json.loads(
Expand Down
8 changes: 4 additions & 4 deletions tests/integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def w3_wait_for_new_blocks(w3, n, sleep=0.5):


def wait_for_new_blocks(cli, n, sleep=0.5):
cur_height = begin_height = int((cli.status())["SyncInfo"]["latest_block_height"])
cur_height = begin_height = int((cli.status())["sync_info"]["latest_block_height"])
while cur_height - begin_height < n:
time.sleep(sleep)
cur_height = int((cli.status())["SyncInfo"]["latest_block_height"])
cur_height = int((cli.status())["sync_info"]["latest_block_height"])
return cur_height


Expand All @@ -90,7 +90,7 @@ def wait_for_block(cli, height, timeout=240):
except AssertionError as e:
print(f"get sync status failed: {e}", file=sys.stderr)
else:
current_height = int(status["SyncInfo"]["latest_block_height"])
current_height = int(status["sync_info"]["latest_block_height"])
if current_height >= height:
break
print("current block height", current_height)
Expand All @@ -117,7 +117,7 @@ def w3_wait_for_block(w3, height, timeout=240):
def wait_for_block_time(cli, t):
print("wait for block time", t)
while True:
now = isoparse((cli.status())["SyncInfo"]["latest_block_time"])
now = isoparse((cli.status())["sync_info"]["latest_block_time"])
print("block time now: ", now)
if now >= t:
break
Expand Down

0 comments on commit 2d37695

Please sign in to comment.