Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try and reduce flakiness of number of test call asserts #46276

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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