|
@@ -31,15 +31,16 @@ from sentry.models import (
|
|
|
UserOption,
|
|
|
)
|
|
|
from sentry.models.groupinbox import GroupInboxReason, add_group_to_inbox
|
|
|
+from sentry.silo import SiloMode
|
|
|
from sentry.testutils import APITestCase, SnubaTestCase
|
|
|
from sentry.testutils.helpers import parse_link_header
|
|
|
from sentry.testutils.helpers.datetime import before_now, iso_format
|
|
|
-from sentry.testutils.silo import region_silo_test
|
|
|
+from sentry.testutils.silo import assume_test_silo_mode, region_silo_test
|
|
|
from sentry.types.activity import ActivityType
|
|
|
from sentry.utils import json
|
|
|
|
|
|
|
|
|
-@region_silo_test
|
|
|
+@region_silo_test(stable=True)
|
|
|
class GroupListTest(APITestCase, SnubaTestCase):
|
|
|
def setUp(self):
|
|
|
super().setUp()
|
|
@@ -338,7 +339,8 @@ class GroupListTest(APITestCase, SnubaTestCase):
|
|
|
assert len(response.data) == 0
|
|
|
|
|
|
def test_token_auth(self):
|
|
|
- token = ApiToken.objects.create(user=self.user, scopes=256)
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ token = ApiToken.objects.create(user=self.user, scopes=256)
|
|
|
response = self.client.get(
|
|
|
self.path, format="json", HTTP_AUTHORIZATION=f"Bearer {token.token}"
|
|
|
)
|
|
@@ -356,7 +358,7 @@ class GroupListTest(APITestCase, SnubaTestCase):
|
|
|
assert [int(r["id"]) for r in response.data] == [event.group.id]
|
|
|
|
|
|
|
|
|
-@region_silo_test
|
|
|
+@region_silo_test(stable=True)
|
|
|
class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
def setUp(self):
|
|
|
super().setUp()
|
|
@@ -440,21 +442,23 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
|
|
|
org = self.organization
|
|
|
|
|
|
- integration = Integration.objects.create(provider="example", name="Example")
|
|
|
- integration.add_organization(org, self.user)
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ integration = Integration.objects.create(provider="example", name="Example")
|
|
|
+ integration.add_organization(org, self.user)
|
|
|
group = self.create_group(status=GroupStatus.UNRESOLVED)
|
|
|
|
|
|
- OrganizationIntegration.objects.filter(
|
|
|
- integration_id=integration.id, organization_id=group.organization.id
|
|
|
- ).update(
|
|
|
- config={
|
|
|
- "sync_comments": True,
|
|
|
- "sync_status_outbound": True,
|
|
|
- "sync_status_inbound": True,
|
|
|
- "sync_assignee_outbound": True,
|
|
|
- "sync_assignee_inbound": True,
|
|
|
- }
|
|
|
- )
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ OrganizationIntegration.objects.filter(
|
|
|
+ integration_id=integration.id, organization_id=group.organization.id
|
|
|
+ ).update(
|
|
|
+ config={
|
|
|
+ "sync_comments": True,
|
|
|
+ "sync_status_outbound": True,
|
|
|
+ "sync_status_inbound": True,
|
|
|
+ "sync_assignee_outbound": True,
|
|
|
+ "sync_assignee_inbound": True,
|
|
|
+ }
|
|
|
+ )
|
|
|
external_issue = ExternalIssue.objects.get_or_create(
|
|
|
organization_id=org.id, integration_id=integration.id, key="APP-%s" % group.id
|
|
|
)[0]
|
|
@@ -496,19 +500,20 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
release = self.create_release(project=self.project, version="abc")
|
|
|
group = self.create_group(status=GroupStatus.RESOLVED)
|
|
|
org = self.organization
|
|
|
- integration = Integration.objects.create(provider="example", name="Example")
|
|
|
- integration.add_organization(org, self.user)
|
|
|
- OrganizationIntegration.objects.filter(
|
|
|
- integration_id=integration.id, organization_id=group.organization.id
|
|
|
- ).update(
|
|
|
- config={
|
|
|
- "sync_comments": True,
|
|
|
- "sync_status_outbound": True,
|
|
|
- "sync_status_inbound": True,
|
|
|
- "sync_assignee_outbound": True,
|
|
|
- "sync_assignee_inbound": True,
|
|
|
- }
|
|
|
- )
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ integration = Integration.objects.create(provider="example", name="Example")
|
|
|
+ integration.add_organization(org, self.user)
|
|
|
+ OrganizationIntegration.objects.filter(
|
|
|
+ integration_id=integration.id, organization_id=group.organization.id
|
|
|
+ ).update(
|
|
|
+ config={
|
|
|
+ "sync_comments": True,
|
|
|
+ "sync_status_outbound": True,
|
|
|
+ "sync_status_inbound": True,
|
|
|
+ "sync_assignee_outbound": True,
|
|
|
+ "sync_assignee_inbound": True,
|
|
|
+ }
|
|
|
+ )
|
|
|
GroupResolution.objects.create(group=group, release=release)
|
|
|
external_issue = ExternalIssue.objects.get_or_create(
|
|
|
organization_id=org.id, integration_id=integration.id, key="APP-%s" % group.id
|
|
@@ -548,9 +553,10 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
group = self.create_group(status=GroupStatus.UNRESOLVED)
|
|
|
user = self.user
|
|
|
|
|
|
- uo1 = UserOption.objects.create(
|
|
|
- key="self_assign_issue", value="1", project_id=None, user=user
|
|
|
- )
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ uo1 = UserOption.objects.create(
|
|
|
+ key="self_assign_issue", value="1", project_id=None, user=user
|
|
|
+ )
|
|
|
|
|
|
self.login_as(user=user)
|
|
|
url = f"{self.path}?id={group.id}"
|
|
@@ -567,7 +573,8 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
user_id=user.id, group=group, is_active=True
|
|
|
).exists()
|
|
|
|
|
|
- uo1.delete()
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ uo1.delete()
|
|
|
|
|
|
def test_self_assign_issue_next_release(self):
|
|
|
release = Release.objects.create(organization_id=self.project.organization_id, version="a")
|
|
@@ -575,9 +582,10 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
|
|
|
group = self.create_group(status=GroupStatus.UNRESOLVED)
|
|
|
|
|
|
- uo1 = UserOption.objects.create(
|
|
|
- key="self_assign_issue", value="1", project_id=None, user=self.user
|
|
|
- )
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ uo1 = UserOption.objects.create(
|
|
|
+ key="self_assign_issue", value="1", project_id=None, user=self.user
|
|
|
+ )
|
|
|
|
|
|
self.login_as(user=self.user)
|
|
|
|
|
@@ -602,7 +610,8 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
|
|
|
)
|
|
|
assert activity.data["version"] == ""
|
|
|
- uo1.delete()
|
|
|
+ with assume_test_silo_mode(SiloMode.CONTROL):
|
|
|
+ uo1.delete()
|
|
|
|
|
|
def test_selective_status_update(self):
|
|
|
group1 = self.create_group(status=GroupStatus.RESOLVED)
|
|
@@ -1347,7 +1356,7 @@ class GroupUpdateTest(APITestCase, SnubaTestCase):
|
|
|
assert Group.objects.filter(id=group1.id).exists()
|
|
|
|
|
|
|
|
|
-@region_silo_test
|
|
|
+@region_silo_test(stable=True)
|
|
|
class GroupDeleteTest(APITestCase, SnubaTestCase):
|
|
|
@cached_property
|
|
|
def path(self):
|