Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/sentry/hybridcloud/apigateway/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"sentry-api-0-dsym-files": 90.0,
"sentry-api-0-installable-preprod-artifact-download": 90.0,
"sentry-api-0-project-preprod-artifact-download": 90.0,
"sentry-api-0-project-preprod-artifact-size-analysis-download": 90.0,
"sentry-api-0-organization-preprod-artifact-size-analysis-download": 90.0,
"sentry-api-0-organization-objectstore": 90.0,
}

Expand Down
38 changes: 0 additions & 38 deletions src/sentry/preprod/api/endpoints/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,6 @@
ProjectPreprodArtifactCheckForUpdatesEndpoint.as_view(),
name="sentry-api-0-project-preprod-check-for-updates",
),
# TODO(EME-735): A number of these artifact endpoints are duplicated here and below in preprod_organization_urlpatterns.
# The intention is that once the UI is migrated we remove the project based URLs.
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/files/preprodartifacts/(?P<head_artifact_id>[^/]+)/size-analysis/$",
ProjectPreprodArtifactSizeAnalysisDownloadEndpoint.as_view(),
name="sentry-api-0-project-preprod-artifact-size-analysis-download",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprodartifacts/(?P<head_artifact_id>[^/]+)/build-details/$",
ProjectPreprodBuildDetailsEndpoint.as_view(),
name="sentry-api-0-project-preprod-artifact-build-details",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprodartifacts/(?P<head_artifact_id>[^/]+)/install-details/$",
ProjectPreprodInstallDetailsEndpoint.as_view(),
name="sentry-api-0-project-preprod-install-details",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprodartifacts/(?P<head_artifact_id>[^/]+)/delete/$",
ProjectPreprodArtifactDeleteEndpoint.as_view(),
name="sentry-api-0-project-preprod-artifact-delete",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/files/installablepreprodartifact/(?P<url_path>[^/]+)/$",
ProjectInstallablePreprodArtifactDownloadEndpoint.as_view(),
Expand All @@ -120,12 +98,6 @@
ProjectPreprodArtifactImageEndpoint.as_view(),
name="sentry-api-0-project-preprod-artifact-image",
),
# Size analysis
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprodartifacts/size-analysis/compare/(?P<head_artifact_id>[^/]+)/(?P<base_artifact_id>[^/]+)/$",
ProjectPreprodArtifactSizeAnalysisCompareEndpoint.as_view(),
name="sentry-api-0-project-preprod-artifact-size-analysis-compare",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprodartifacts/size-analysis/compare/(?P<head_size_metric_id>[^/]+)/(?P<base_size_metric_id>[^/]+)/download/$",
ProjectPreprodArtifactSizeAnalysisCompareDownloadEndpoint.as_view(),
Expand All @@ -137,16 +109,6 @@
ProjectPreprodBuildDistributionLatestEndpoint.as_view(),
name="sentry-api-0-project-preprod-public-builds",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprod-artifact/rerun-analysis/(?P<head_artifact_id>[^/]+)/$",
PreprodArtifactRerunAnalysisEndpoint.as_view(),
name="sentry-api-0-preprod-artifact-rerun-analysis",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/preprod-artifact/rerun-status-checks/(?P<head_artifact_id>[^/]+)/$",
PreprodArtifactRerunStatusChecksEndpoint.as_view(),
name="sentry-api-0-preprod-artifact-rerun-status-checks",
),
]

preprod_organization_urlpatterns = [
Expand Down
7 changes: 0 additions & 7 deletions static/app/utils/api/knownSentryApiUrls.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,6 @@ export type KnownSentryApiUrls =
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/dsyms/unknown/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/images/$imageId/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/installablepreprodartifact/$urlPath/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/preprodartifacts/$headArtifactId/size-analysis/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/preprodartifacts/assemble/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/proguard-artifact-releases'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/files/source-maps/'
Expand Down Expand Up @@ -671,14 +670,8 @@ export type KnownSentryApiUrls =
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/performance/configure/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/plugins/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/plugins/$pluginId/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprod-artifact/rerun-analysis/$headArtifactId/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprod-artifact/rerun-status-checks/$headArtifactId/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/$headArtifactId/build-details/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/$headArtifactId/delete/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/$headArtifactId/install-details/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/build-distribution/latest/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/check-for-updates/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/size-analysis/compare/$headArtifactId/$baseArtifactId/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/size-analysis/compare/$headSizeMetricId/$baseSizeMetricId/download/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/snapshots/'
| '/projects/$organizationIdOrSlug/$projectIdOrSlug/preprodartifacts/snapshots/upload-options/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,3 @@ def test_artifact_from_inactive_project_returns_404(self):
url = self._get_url(self.organization.slug, self.artifact.id)
response = self.client.get(url)
assert response.status_code == 404


class PreprodArtifactEndpointProjectSlugValidationTest(APITestCase):
def setUp(self):
super().setUp()
self.login_as(self.user)
self.artifact = self.create_preprod_artifact(project=self.project)

def _get_url(self, org_slug, project_slug, artifact_id):
return f"/api/0/projects/{org_slug}/{project_slug}/preprodartifacts/{artifact_id}/build-details/"

@with_feature("organizations:preprod-frontend-routes")
def test_project_slug_validation_matches(self):
url = self._get_url(self.organization.slug, self.project.slug, self.artifact.id)
response = self.client.get(url)
assert response.status_code == 200

def test_project_slug_validation_mismatch_returns_404(self):
other_project = self.create_project(organization=self.organization)

url = self._get_url(self.organization.slug, other_project.slug, self.artifact.id)
response = self.client.get(url)
assert response.status_code == 404
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class ProjectPreprodSizeAnalysisCompareTest(APITestCase):
endpoint = "sentry-api-0-project-preprod-artifact-size-analysis-compare"
endpoint = "sentry-api-0-organization-preprod-artifact-size-analysis-compare"
method = "get"

def setUp(self):
Expand Down Expand Up @@ -81,8 +81,8 @@ def _get_url(self, head_artifact_id=None, base_artifact_id=None):
head_artifact_id = head_artifact_id or self.head_artifact.id
base_artifact_id = base_artifact_id or self.base_artifact.id
return reverse(
"sentry-api-0-project-preprod-artifact-size-analysis-compare",
args=[self.organization.slug, self.project.slug, head_artifact_id, base_artifact_id],
"sentry-api-0-organization-preprod-artifact-size-analysis-compare",
args=[self.organization.slug, head_artifact_id, base_artifact_id],
)

@override_settings(SENTRY_FEATURES={"organizations:preprod-frontend-routes": True})
Expand All @@ -99,7 +99,6 @@ def test_get_comparison_success_with_completed_comparison(self):

response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand Down Expand Up @@ -137,7 +136,6 @@ def test_get_comparison_success_with_failed_comparison(self):

response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand All @@ -161,7 +159,6 @@ def test_get_comparison_success_with_pending_comparison(self):

response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand All @@ -186,7 +183,6 @@ def test_get_comparison_success_with_processing_comparison(self):

response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand All @@ -202,7 +198,6 @@ def test_get_comparison_success_with_no_comparison(self):
"""Test GET endpoint returns no comparison when no comparison exists yet"""
response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand Down Expand Up @@ -233,7 +228,6 @@ def test_get_comparison_success_with_no_matching_base_metric(self):

response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand All @@ -254,7 +248,6 @@ def test_get_comparison_head_artifact_not_found(self):
"""Test GET endpoint returns 404 when head artifact doesn't exist"""
response = self.get_error_response(
self.organization.slug,
self.project.slug,
999999,
self.base_artifact.id,
status_code=404,
Expand All @@ -266,16 +259,15 @@ def test_get_comparison_base_artifact_not_found(self):
"""Test GET endpoint returns 404 when base artifact doesn't exist"""
response = self.get_error_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
999999,
status_code=404,
)
assert "The requested base preprod artifact does not exist" in response.data["detail"]

@override_settings(SENTRY_FEATURES={"organizations:preprod-frontend-routes": True})
def test_get_comparison_head_artifact_wrong_project(self):
"""Test GET endpoint returns 404 when head artifact belongs to different project"""
def test_get_comparison_artifacts_different_projects(self):
"""Test GET endpoint returns 404 when head and base artifacts belong to different projects"""
other_project = self.create_project(organization=self.organization)
other_artifact = self.create_preprod_artifact(
project=other_project,
Expand All @@ -287,12 +279,11 @@ def test_get_comparison_head_artifact_wrong_project(self):

response = self.get_error_response(
self.organization.slug,
self.project.slug,
other_artifact.id,
self.base_artifact.id,
status_code=404,
)
assert response.data["detail"] == "The requested head preprod artifact does not exist"
assert response.data["detail"] == "The requested base preprod artifact does not exist"

@override_settings(SENTRY_FEATURES={"organizations:preprod-frontend-routes": True})
def test_get_comparison_base_artifact_wrong_project(self):
Expand All @@ -308,7 +299,6 @@ def test_get_comparison_base_artifact_wrong_project(self):

response = self.get_error_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
other_artifact.id,
status_code=404,
Expand All @@ -329,7 +319,6 @@ def test_get_comparison_head_artifact_no_size_metrics(self):

response = self.get_error_response(
self.organization.slug,
self.project.slug,
artifact_no_metrics.id,
self.base_artifact.id,
status_code=404,
Expand All @@ -353,7 +342,6 @@ def test_get_comparison_base_artifact_no_size_metrics(self):

response = self.get_error_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
artifact_no_metrics.id,
status_code=404,
Expand All @@ -368,7 +356,6 @@ def test_get_comparison_feature_disabled(self):
"""Test GET endpoint returns 403 when feature flag is disabled"""
response = self.get_error_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
status_code=403,
Expand Down Expand Up @@ -417,7 +404,6 @@ def test_get_comparison_multiple_metrics(self):

response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand Down Expand Up @@ -445,7 +431,6 @@ def test_post_comparison_success(self, mock_apply_async):
"""Test POST endpoint successfully triggers comparison and creates PENDING records"""
response = self.get_success_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
method="post",
Expand Down Expand Up @@ -487,7 +472,6 @@ def test_post_comparison_head_artifact_not_found(self):
"""Test POST endpoint returns 404 when head artifact doesn't exist"""
response = self.get_error_response(
self.organization.slug,
self.project.slug,
999999,
self.base_artifact.id,
method="post",
Expand All @@ -500,7 +484,6 @@ def test_post_comparison_base_artifact_not_found(self):
"""Test POST endpoint returns 404 when base artifact doesn't exist"""
response = self.get_error_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
999999,
method="post",
Expand Down Expand Up @@ -781,7 +764,6 @@ def test_post_comparison_different_build_configurations(self):
# Head artifact will have None/default, base will have debug config
response = self.get_error_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
method="post",
Expand All @@ -800,7 +782,6 @@ def test_get_returns_404_for_expired_head_artifact(self, mock_cutoff):

response = self.get_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand All @@ -818,7 +799,6 @@ def test_get_returns_404_for_expired_base_artifact(self, mock_cutoff):

response = self.get_response(
self.organization.slug,
self.project.slug,
self.head_artifact.id,
self.base_artifact.id,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
)
class ProjectPreprodArtifactSizeAnalysisDownloadEndpointTest(APITestCase):
endpoint = "sentry-api-0-project-preprod-artifact-size-analysis-download"
endpoint = "sentry-api-0-organization-preprod-artifact-size-analysis-download"

def setUp(self):
super().setUp()
Expand All @@ -31,7 +31,7 @@ def setUp(self):

def test_no_size_metrics_returns_404(self):
"""When no size metrics exist, should return 404"""
response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 404
assert response.data["detail"] == "Size analysis results not available for this artifact"

Expand All @@ -43,7 +43,7 @@ def test_pending_state_returns_200(self):
state=PreprodArtifactSizeMetrics.SizeAnalysisState.PENDING,
)

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 200
assert response.data["state"] == "pending"
assert response.data["message"] == "Size analysis is still processing"
Expand All @@ -56,7 +56,7 @@ def test_processing_state_returns_200(self):
state=PreprodArtifactSizeMetrics.SizeAnalysisState.PROCESSING,
)

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 200
assert response.data["state"] == "processing"
assert response.data["message"] == "Size analysis is still processing"
Expand All @@ -72,7 +72,7 @@ def test_failed_state_returns_422(self):
analysis_file_id=None,
)

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 422
assert response.data["state"] == "failed"
assert response.data["error_code"] == PreprodArtifactSizeMetrics.ErrorCode.PROCESSING_ERROR
Expand All @@ -87,7 +87,7 @@ def test_completed_without_file_returns_500(self):
analysis_file_id=None,
)

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 500
assert response.data["detail"] == "Size analysis completed but results are unavailable"

Expand All @@ -102,7 +102,7 @@ def test_completed_with_missing_file_returns_404(self):
analysis_file_id=deleted_file_id,
)

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 404
assert response.data["detail"] == "Analysis file not found"

Expand All @@ -119,7 +119,7 @@ def test_completed_with_file_returns_200(self):
analysis_file_id=analysis_file.id,
)

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 200
assert response["Content-Type"] == "application/json"
# Read the response content to ensure file is consumed and closed
Expand All @@ -137,6 +137,6 @@ def test_returns_404_for_expired_artifact(self, mock_cutoff):
self.artifact.date_added = timezone.now() - timedelta(days=60)
self.artifact.save()

response = self.get_response(self.organization.slug, self.project.slug, self.artifact.id)
response = self.get_response(self.organization.slug, self.artifact.id)
assert response.status_code == 404
assert response.data["detail"] == "This build's size data has expired."
Loading
Loading