Skip to content

Commit

Permalink
Try and reduce flakiness of number of test call asserts (#46276)
Browse files Browse the repository at this point in the history
  • Loading branch information
amoghrajesh authored Jan 30, 2025
1 parent dc4ce65 commit 1b43499
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions providers/tests/dbt/cloud/operators/test_dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ def fake_sleep(seconds):
else:
# When the job run status is not in a terminal status or "Success", the operator will
# continue to call ``get_job_run()`` until a ``timeout`` number of seconds has passed
# (3 seconds for this test). Therefore, there should be 4 calls of this function: one
# initially and 3 for each check done at a 1 second interval.
assert mock_get_job_run.call_count == 4
assert mock_get_job_run.call_count >= 1

# To make it more dynamic, try and calculate number of calls
max_number_of_calls = timeout // self.config["check_interval"] + 1
assert mock_get_job_run.call_count <= max_number_of_calls

@patch.object(DbtCloudHook, "trigger_job_run")
@pytest.mark.parametrize(
Expand Down

0 comments on commit 1b43499

Please sign in to comment.