Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully replace services.archive by shared #1006

Merged
merged 1 commit into from
Nov 29, 2024
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 graphql_api/dataloader/bundle_analysis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Union

from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis import (
BundleAnalysisReportLoader,
MissingBaseReportError,
Expand All @@ -10,7 +11,6 @@
from core.models import Commit
from graphql_api.types.comparison.comparison import MissingBaseReport, MissingHeadReport
from reports.models import CommitReport
from services.archive import ArchiveService
from services.bundle_analysis import BundleAnalysisComparison, BundleAnalysisReport


Expand Down
6 changes: 2 additions & 4 deletions graphql_api/tests/test_bundle_analysis_measurements.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import patch

from django.test import TransactionTestCase
from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis import StoragePaths
from shared.bundle_analysis.storage import get_bucket_name
from shared.django_apps.core.tests.factories import (
Expand All @@ -11,10 +12,7 @@
from shared.storage.memory import MemoryStorageService

from reports.models import CommitReport
from reports.tests.factories import (
CommitReportFactory,
)
from services.archive import ArchiveService
from reports.tests.factories import CommitReportFactory
from timeseries.tests.factories import MeasurementFactory

from .helper import GraphQLTestHelper
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/tests/test_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import yaml
from django.test import TransactionTestCase
from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis import StoragePaths
from shared.bundle_analysis.storage import get_bucket_name
from shared.django_apps.core.tests.factories import (
Expand All @@ -30,7 +31,6 @@
UploadFactory,
UploadFlagMembershipFactory,
)
from services.archive import ArchiveService
from services.comparison import MissingComparisonReport
from services.components import Component
from services.profiling import CriticalFile
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/tests/test_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from django.test import TransactionTestCase
from freezegun import freeze_time
from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis import StoragePaths
from shared.bundle_analysis.storage import get_bucket_name
from shared.django_apps.core.tests.factories import (
Expand All @@ -18,7 +19,6 @@
from core.models import Commit
from reports.models import CommitReport
from reports.tests.factories import CommitReportFactory, ReportLevelTotalsFactory
from services.archive import ArchiveService

from .helper import GraphQLTestHelper, paginate_connection

Expand Down
2 changes: 1 addition & 1 deletion profiling/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from rest_framework import serializers
from shared.api_archive.archive import ArchiveService

from profiling.models import ProfilingCommit, ProfilingUpload
from services.archive import ArchiveService


class CreatableProfilingCommitRelatedField(serializers.SlugRelatedField):
Expand Down
4 changes: 2 additions & 2 deletions profiling/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

from django.urls import reverse
from rest_framework.test import APIClient
from shared.api_archive.archive import ArchiveService
from shared.django_apps.core.tests.factories import (
RepositoryFactory,
RepositoryTokenFactory,
)

from profiling.models import ProfilingCommit, ProfilingUpload
from services.archive import ArchiveService
from services.task import TaskService


def test_simple_profiling_apicall(db, mocker):
mocked_call = mocker.patch.object(TaskService, "normalize_profiling_upload")
mocker.patch(
"services.archive.StorageService.create_presigned_put",
"shared.api_archive.archive.StorageService.create_presigned_put",
return_value="banana.txt",
)
repo = RepositoryFactory.create(active=True)
Expand Down
2 changes: 1 addition & 1 deletion profiling/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

from rest_framework.generics import CreateAPIView
from rest_framework.permissions import BasePermission
from shared.api_archive.archive import ArchiveService, MinioEndpoints

from codecov_auth.authentication.repo_auth import RepositoryTokenAuthentication
from profiling.models import ProfilingCommit
from profiling.serializers import ProfilingCommitSerializer, ProfilingUploadSerializer
from services.archive import ArchiveService, MinioEndpoints
from services.task import TaskService

log = logging.getLogger(__name__)
Expand Down
125 changes: 0 additions & 125 deletions services/archive.py

This file was deleted.

2 changes: 1 addition & 1 deletion services/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import sentry_sdk
from django.utils.functional import cached_property
from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis import AssetReport as SharedAssetReport
from shared.bundle_analysis import (
BundleAnalysisComparison as SharedBundleAnalysisComparison,
Expand All @@ -25,7 +26,6 @@
measurements_last_uploaded_before_start_date,
)
from reports.models import CommitReport
from services.archive import ArchiveService
from timeseries.helpers import fill_sparse_measurements
from timeseries.models import Interval, MeasurementName

Expand Down
2 changes: 1 addition & 1 deletion services/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import regex
import shared.reports.api_report_service as report_service
from django.utils.functional import cached_property
from shared.api_archive.archive import ArchiveService
from shared.profiling import ProfilingSummaryDataAnalyzer
from shared.yaml import UserYaml

from core.models import Commit, Repository
from profiling.models import ProfilingCommit
from services.archive import ArchiveService

log = logging.getLogger(__name__)

Expand Down
56 changes: 0 additions & 56 deletions services/storage.py

This file was deleted.

18 changes: 0 additions & 18 deletions services/tests/test_archive.py

This file was deleted.

2 changes: 1 addition & 1 deletion services/tests/test_bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from django.test import TestCase
from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis import BundleAnalysisReport as SharedBundleAnalysisReport
from shared.bundle_analysis import (
BundleAnalysisReportLoader,
Expand All @@ -14,7 +15,6 @@

from reports.models import CommitReport
from reports.tests.factories import CommitReportFactory
from services.archive import ArchiveService
from services.bundle_analysis import (
BundleAnalysisComparison,
BundleAnalysisReport,
Expand Down
4 changes: 2 additions & 2 deletions services/tests/test_profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_summary_data_not_summarized(self):
pc = ProfilingCommitFactory(repository=self.repo)
assert self.service.summary_data(pc) is None

@patch("services.archive.ArchiveService.read_file")
@patch("shared.api_archive.archive.ArchiveService.read_file")
def test_summary_data_not_found(self, read_file):
read_file.side_effect = [
minio.error.S3Error(
Expand All @@ -128,7 +128,7 @@ def test_summary_data_not_found(self, read_file):

assert self.service.summary_data(pc) is None

@patch("services.archive.ArchiveService.read_file")
@patch("shared.api_archive.archive.ArchiveService.read_file")
def test_summary_data(self, read_file):
read_file.return_value = test_summary
pc = ProfilingCommitFactory(
Expand Down
2 changes: 1 addition & 1 deletion staticanalysis/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import math

from rest_framework import exceptions, serializers
from shared.api_archive.archive import ArchiveService, MinioEndpoints

from core.models import Commit
from services.archive import ArchiveService, MinioEndpoints
from staticanalysis.models import (
StaticAnalysisSingleFileSnapshot,
StaticAnalysisSingleFileSnapshotState,
Expand Down
2 changes: 1 addition & 1 deletion staticanalysis/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def test_simple_static_analysis_call_no_uploads_yet(db, mocker):
mocked_task_service = mocker.patch.object(TaskService, "schedule_task")
mocked_presigned_put = mocker.patch(
"services.archive.StorageService.create_presigned_put",
"shared.api_archive.archive.StorageService.create_presigned_put",
return_value="banana.txt",
)
commit = CommitFactory.create(repository__active=True)
Expand Down
Loading
Loading