Skip to content

Commit

Permalink
fix(jira): Add UI for error message when installing in multiple in re…
Browse files Browse the repository at this point in the history
…gions (#84377)
  • Loading branch information
Christinarlong authored Jan 31, 2025
1 parent bb3eec3 commit 6f4ad69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
11 changes: 3 additions & 8 deletions src/sentry/integrations/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,11 @@ def _finish_pipeline(self, data):
extra={
"organization_id": self.organization.id if self.organization else None,
"provider_key": self.provider.key,
"integration_id": self.integration.id,
},
)
return self._dialog_response(
{
"error": _(
"This integration has already been installed on another Sentry organization "
"which resides in a different region. Installation could not be completed."
)
},
False,
return self.error(
"This integration has already been installed on another Sentry organization which resides in a different region. Installation could not be completed."
)

org_integration = self.integration.add_organization(
Expand Down
16 changes: 7 additions & 9 deletions tests/sentry/integrations/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,15 @@ def test_is_violating_region_restriction_failure(self, *args):
mapping.update(region_name="eu")

self.pipeline.state.data = {"external_id": self.external_id}
with (
override_regions(self.regions),
patch("sentry.integrations.pipeline.IntegrationPipeline._dialog_response") as resp,
):
self.pipeline.finish_pipeline()
data, success = resp.call_args[0]
with override_regions(self.regions):
response = self.pipeline.finish_pipeline()
error_message = "This integration has already been installed on another Sentry organization which resides in a different region. Installation could not be completed."
assert error_message in response.content.decode()

if SiloMode.get_current_mode() == SiloMode.MONOLITH:
assert success
assert error_message not in response.content.decode()
if SiloMode.get_current_mode() == SiloMode.CONTROL:
assert not success
assert "resides in a different region" in str(data)
assert error_message in response.content.decode()

def test_aliased_integration_key(self, *args):
self.provider = AliasedIntegrationProvider
Expand Down

0 comments on commit 6f4ad69

Please sign in to comment.