Skip to content

Commit

Permalink
Merge pull request #220 from codecov/scott/bundle-analysis-bucket-name
Browse files Browse the repository at this point in the history
fix: Use updated bundle analysis bucket name function
  • Loading branch information
scott-codecov committed Dec 19, 2023
2 parents c0ba311 + 26384ce commit 0d4ec53
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
https://github.com/codecov/shared/archive/8196e5c30472dc32f52f0c61dce1e3d9aff1fa16.tar.gz#egg=shared
https://github.com/codecov/shared/archive/a8f69f93d4c48f407501bfedf1f12c03d450abf0.tar.gz#egg=shared
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
boto3
celery
Expand Down
6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ requests==2.31.0
respx==0.20.2
# via -r requirements.in
rfc3986[idna2008]==1.4.0
# via
# httpx
# rfc3986
# via httpx
rsa==4.7.2
# via google-auth
s3transfer==0.3.4
Expand All @@ -344,7 +342,7 @@ screen==1.0.1
# via excel-base
sentry-sdk==1.19.1
# via -r requirements.in
shared @ https://github.com/codecov/shared/archive/8196e5c30472dc32f52f0c61dce1e3d9aff1fa16.tar.gz
shared @ https://github.com/codecov/shared/archive/a8f69f93d4c48f407501bfedf1f12c03d450abf0.tar.gz
# via -r requirements.in
six==1.15.0
# via
Expand Down
6 changes: 4 additions & 2 deletions services/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import sentry_sdk
from shared.bundle_analysis import BundleAnalysisReport, BundleAnalysisReportLoader
from shared.bundle_analysis.storage import BUCKET_NAME
from shared.bundle_analysis.storage import get_bucket_name
from shared.reports.enums import UploadState
from shared.storage import get_appropriate_storage_service
from shared.storage.exceptions import FileNotInStorageError
Expand Down Expand Up @@ -116,7 +116,9 @@ def process_upload(self, upload: Upload) -> ProcessingResult:
_, local_path = tempfile.mkstemp()
try:
with open(local_path, "wb") as f:
storage_service.read_file(BUCKET_NAME, upload.storage_path, file_obj=f)
storage_service.read_file(
get_bucket_name(), upload.storage_path, file_obj=f
)

# load the downloaded data into the bundle report
session_id = bundle_report.ingest(local_path)
Expand Down
10 changes: 5 additions & 5 deletions tasks/tests/unit/test_bundle_analysis_processor_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from redis.exceptions import LockError
from shared.bundle_analysis.storage import BUCKET_NAME
from shared.bundle_analysis.storage import get_bucket_name

from database.models import CommitReport
from database.tests.factories import CommitFactory, UploadFactory
Expand All @@ -21,7 +21,7 @@ async def test_bundle_analysis_processor_task(
storage_path = (
f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
)
mock_storage.write_file(BUCKET_NAME, storage_path, "test-content")
mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app)

Expand Down Expand Up @@ -77,7 +77,7 @@ async def test_bundle_analysis_processor_task_error(
storage_path = (
f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
)
mock_storage.write_file(BUCKET_NAME, storage_path, "test-content")
mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app)

Expand Down Expand Up @@ -139,7 +139,7 @@ async def test_bundle_analysis_processor_task_general_error(
storage_path = (
"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
)
mock_storage.write_file(BUCKET_NAME, storage_path, "test-content")
mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app)

Expand Down Expand Up @@ -196,7 +196,7 @@ async def test_bundle_analysis_processor_task_locked(
storage_path = (
f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
)
mock_storage.write_file(BUCKET_NAME, storage_path, "test-content")
mock_storage.write_file(get_bucket_name(), storage_path, "test-content")

mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app)
mock_redis.lock.return_value.__enter__.side_effect = LockError()
Expand Down

0 comments on commit 0d4ec53

Please sign in to comment.