Skip to content
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
16 changes: 15 additions & 1 deletion tests/sentry/models/test_team.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.db import connection
from django.test import override_settings

from sentry.deletions.tasks.hybrid_cloud import schedule_hybrid_cloud_foreign_key_jobs_control
Expand Down Expand Up @@ -60,8 +61,21 @@ def test_get_projects(self) -> None:
def test_without_snowflake(self) -> None:
user = self.create_user()
org = self.create_organization(owner=user)

with connection.cursor() as cursor:
cursor.execute("SELECT last_value FROM sentry_team_id_seq")
id_before = cursor.fetchone()[0]

team = self.create_team(organization=org)
assert team.id < 1_000_000_000

with connection.cursor() as cursor:
cursor.execute("SELECT last_value FROM sentry_team_id_seq")
id_after = cursor.fetchone()[0]

# When snowflake is disabled, the ID should advance by exactly 1
# (Tests that we used regular auto-increment, not snowflake generation)
assert id_after == id_before + 1
assert team.id == id_after
assert Team.objects.filter(id=team.id).exists()


Expand Down
Loading