Skip to content

Commit

Permalink
hc(fix): Fix silo availability error in NotifyEventServiceAction (#58028
Browse files Browse the repository at this point in the history
)

Mark NotifyEventServiceActionTest as stable.
  • Loading branch information
RyanSkonnord authored Oct 12, 2023
1 parent e315bf7 commit b7cb057
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/sentry/rules/actions/notify_event_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from sentry.eventstore.models import GroupEvent
from sentry.incidents.models import AlertRuleTriggerAction, Incident, IncidentStatus
from sentry.integrations.metric_alerts import incident_attachment_info
from sentry.models.integrations.sentry_app import SentryApp
from sentry.plugins.base import plugins
from sentry.rules import EventState
from sentry.rules.actions.base import EventAction
Expand Down Expand Up @@ -149,11 +148,7 @@ def after(
return

plugin = None
app = None
try:
app = SentryApp.objects.get(slug=service)
except SentryApp.DoesNotExist:
pass
app = app_service.get_sentry_app_by_slug(slug=service)

if app:
kwargs = {"sentry_app": app}
Expand Down
8 changes: 5 additions & 3 deletions tests/sentry/rules/actions/test_notify_event_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
from django.utils import timezone

from sentry.rules.actions.notify_event_service import NotifyEventServiceAction
from sentry.silo import SiloMode
from sentry.tasks.sentry_apps import notify_sentry_app
from sentry.testutils.cases import RuleTestCase
from sentry.testutils.silo import region_silo_test
from sentry.testutils.silo import assume_test_silo_mode, region_silo_test
from sentry.testutils.skips import requires_snuba

pytestmark = [requires_snuba]


@region_silo_test
@region_silo_test(stable=True)
class NotifyEventServiceActionTest(RuleTestCase):
rule_cls = NotifyEventServiceAction

Expand Down Expand Up @@ -85,7 +86,8 @@ def test_sentry_app_installed(self):
assert len(results) == 1

self.install.date_deleted = timezone.now()
self.install.save()
with assume_test_silo_mode(SiloMode.CONTROL):
self.install.save()

results = rule.get_services()
assert len(results) == 0

0 comments on commit b7cb057

Please sign in to comment.