Fix flaky test depending on DB ordering (#4907)

See
https://github.com/grafana/oncall/actions/runs/10513279782/job/29128524241
This commit is contained in:
Matias Bordese 2024-08-22 15:56:59 -03:00 committed by GitHub
parent cd5e9955b9
commit 66925366a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
from unittest.mock import patch
from unittest.mock import ANY, patch
import pytest
from django.conf import settings
@ -58,8 +58,8 @@ def test_start_sync_organization_filter(make_organization):
with patch("apps.grafana_plugin.tasks.sync.sync_organization_async.apply_async") as mock_sync:
start_sync_organizations()
assert mock_sync.call_count == 2
mock_sync.assert_any_call((org2.pk,), countdown=0)
mock_sync.assert_any_call((org3.pk,), countdown=1)
mock_sync.assert_any_call((org2.pk,), countdown=ANY)
mock_sync.assert_any_call((org3.pk,), countdown=ANY)
@pytest.mark.django_db