Skip to content

Commit

Permalink
chore(hybrid-cloud): Mark Bitbucket webhook endpoint as region silo (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dashed authored and armenzg committed Jul 24, 2023
1 parent 335dd96 commit 8a51f74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/sentry/integrations/bitbucket/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from rest_framework.request import Request

from sentry.api.base import Endpoint, region_silo_endpoint
from sentry.integrations.bitbucket.constants import BITBUCKET_IP_RANGES, BITBUCKET_IPS
from sentry.models import Commit, CommitAuthor, Organization, Repository
from sentry.plugins.providers import IntegrationRepositoryProvider
Expand Down Expand Up @@ -105,7 +105,9 @@ def __call__(self, organization, event):
pass


class BitbucketWebhookEndpoint(View):
@region_silo_endpoint
class BitbucketWebhookEndpoint(Endpoint):
permission_classes = ()
_handlers = {"repo:push": PushEventWebhook}

def get_handler(self, event_type):
Expand Down
5 changes: 4 additions & 1 deletion tests/sentry/integrations/bitbucket/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
BITBUCKET_IP = "34.198.178.64"


@region_silo_test(stable=True)
class WebhookBaseTest(APITestCase):
endpoint = "sentry-extensions-bitbucket-webhook"

Expand Down Expand Up @@ -67,11 +68,13 @@ def create_repository(self, **kwargs: Any) -> Repository:
)


@region_silo_test(stable=True)
class WebhookGetTest(WebhookBaseTest):
def test_get_request_fails(self):
self.get_error_response(self.organization_id, status_code=405)


@region_silo_test(stable=True)
class WebhookTest(WebhookBaseTest):
method = "post"

Expand Down Expand Up @@ -107,7 +110,7 @@ def test_invalid_signature_ip(self):
)


@region_silo_test
@region_silo_test(stable=True)
class PushEventWebhookTest(WebhookBaseTest):
method = "post"

Expand Down

0 comments on commit 8a51f74

Please sign in to comment.