Skip to content

Commit

Permalink
update ship_streamer_test to use get_blocks_result_v1 or get_blocks_r…
Browse files Browse the repository at this point in the history
…esult_v0 based on finality_data_history argument
  • Loading branch information
linh2931 committed Mar 28, 2024
1 parent 80c3b22 commit fe71f93
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/ship_streamer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,14 @@ def getLatestSnapshot(nodeId):
block_num = start_block_num
for i in data:
# fork can cause block numbers to be repeated
this_block_num = i['get_blocks_result_v0']['this_block']['block_num']
this_block_num = i['get_blocks_result_v1']['this_block']['block_num'] if args.finality_data_history else i['get_blocks_result_v0']['this_block']['block_num']
if this_block_num < block_num:
block_num = this_block_num
assert block_num == this_block_num, f"{block_num} != {this_block_num}"
assert isinstance(i['get_blocks_result_v0']['block'], str) # verify block in result
if args.finality_data_history:
assert isinstance(i['get_blocks_result_v1']['block'], str) # verify block in result
else:
assert isinstance(i['get_blocks_result_v0']['block'], str) # verify block in result
block_num += 1
assert block_num-1 == end_block_num, f"{block_num-1} != {end_block_num}"

Expand Down Expand Up @@ -268,11 +271,14 @@ def getLatestSnapshot(nodeId):
block_num = start_block_num
for i in data:
# fork can cause block numbers to be repeated
this_block_num = i['get_blocks_result_v0']['this_block']['block_num']
this_block_num = i['get_blocks_result_v1']['this_block']['block_num'] if args.finality_data_history else i['get_blocks_result_v0']['this_block']['block_num']
if this_block_num < block_num:
block_num = this_block_num
assert block_num == this_block_num, f"{block_num} != {this_block_num}"
assert isinstance(i['get_blocks_result_v0']['deltas'], str) # verify deltas in result
if args.finality_data_history:
assert isinstance(i['get_blocks_result_v1']['deltas'], str) # verify deltas in result
else:
assert isinstance(i['get_blocks_result_v0']['deltas'], str) # verify deltas in result
block_num += 1
assert block_num-1 == end_block_num, f"{block_num-1} != {end_block_num}"

Expand Down

0 comments on commit fe71f93

Please sign in to comment.