Skip to content

Commit fd35858

Browse files
committed
chore: added adtional wait
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent 497cdb4 commit fd35858

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

tests/integration/fee_estimate_query_e2e_test.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
_fee_estimation_error: Exception | None = None
2121

2222

23+
# Wait until the mirror_node FeeEstimationService can return a good mock query.
2324
def wait_for_fee_estimation_service_ready(env):
24-
"""
25-
Wait until the FeeEstimationService is ready with a timeout.
26-
"""
25+
"""Wait until the FeeEstimationService is ready."""
2726
global _fee_estimation_ready, _fee_estimation_error
2827

2928
if _fee_estimation_ready:
@@ -64,13 +63,19 @@ def wait_for_fee_estimation_service_ready(env):
6463
raise _fee_estimation_error
6564

6665

66+
def wait_for_sync():
67+
"""Additional wait to ensure the mirror_node sync."""
68+
time.sleep(2.0)
69+
70+
6771
@pytest.mark.integration
6872
def test_can_execute_fee_estimation_query(env):
6973
"""
7074
Integration test that verifies a fee estimation query executes successfully and returns a non-null result.
7175
"""
7276
wait_for_fee_estimation_service_ready(env)
7377
tx = AccountCreateTransaction().set_key_without_alias(PrivateKey.generate_ed25519()).set_initial_balance(1)
78+
wait_for_sync()
7479

7580
query = FeeEstimateQuery().set_transaction(tx)
7681
result = query.execute(env.client)
@@ -85,6 +90,7 @@ def test_can_execute_fee_estimation_query2(env):
8590
"""
8691
wait_for_fee_estimation_service_ready(env)
8792
tx = AccountCreateTransaction().set_key_without_alias(PrivateKey.generate_ed25519()).set_initial_balance(1)
93+
wait_for_sync()
8894

8995
query = FeeEstimateQuery().set_mode(FeeEstimateMode.STATE).set_transaction(tx)
9096
result = query.execute(env.client)
@@ -99,8 +105,9 @@ def test__fee_estimation_query_chunk_tx_can_execute(env):
99105
"""
100106
wait_for_fee_estimation_service_ready(env)
101107
tx = FileAppendTransaction().set_file_id(FileId(0, 0, 2)).set_chunk_size(10).set_contents("s" * 33) # 4 chunks
102-
103108
tx.freeze_with(env.client)
109+
wait_for_sync()
110+
104111
query = FeeEstimateQuery().set_mode(FeeEstimateMode.STATE).set_transaction(tx)
105112
result = query.execute(env.client)
106113

@@ -116,8 +123,9 @@ def test_can_execute_fee_estimation_query_chunk_tx(env):
116123
tx = (
117124
TopicMessageSubmitTransaction().set_topic_id(TopicId(0, 0, 2)).set_chunk_size(10).set_message("s" * 20)
118125
) # 2 chunks
119-
120126
tx.freeze_with(env.client)
127+
wait_for_sync()
128+
121129
query = FeeEstimateQuery().set_mode(FeeEstimateMode.STATE).set_transaction(tx)
122130
result = query.execute(env.client)
123131

0 commit comments

Comments
 (0)