Skip to content

Commit

Permalink
fix test_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
saratomaz committed Mar 16, 2023
1 parent afb33d7 commit 6fb788f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cardano_node_tests/tests/test_dbsync.py
Expand Up @@ -302,19 +302,18 @@ def test_epoch(self, cluster: clusterlib.ClusterLib):
common.get_test_id(cluster)

current_epoch = cluster.g_query.get_epoch()
epoch = current_epoch - 20 if current_epoch >= 20 else current_epoch

blocks_data_blk_count = 0
blocks_data_tx_count = 0

for b in dbsync_queries.query_blocks(epoch_from=epoch, epoch_to=epoch):
for b in dbsync_queries.query_blocks(epoch_from=current_epoch, epoch_to=current_epoch):
blocks_data_blk_count += 1
blocks_data_tx_count += b.tx_count if b.tx_count else 0

epoch_data_blk_count = 0
epoch_data_tx_count = 0

for e in dbsync_queries.query_epoch(epoch_from=epoch, epoch_to=epoch):
for e in dbsync_queries.query_epoch(epoch_from=current_epoch, epoch_to=current_epoch):
epoch_data_blk_count += e.blk_count
epoch_data_tx_count += e.tx_count

Expand All @@ -323,8 +322,10 @@ def test_epoch(self, cluster: clusterlib.ClusterLib):
except AssertionError:
if blocks_data_blk_count == epoch_data_blk_count + 1:
pytest.xfail("Blocks count don't match between tables, see dbsync issue #1363")
elif current_epoch < 3:
pytest.xfail("See cardano-db-sync issue #1377")
raise

assert (
blocks_data_tx_count == epoch_data_tx_count
), "Transactions count don't match between tables"
), f"Transactions count don't match between tables for epoch {current_epoch}"

0 comments on commit 6fb788f

Please sign in to comment.