From 754249a87a7f21167071f51c1ab379561770dcdc Mon Sep 17 00:00:00 2001 From: Arpad Borsos <arpad.borsos@sentry.io> Date: Mon, 2 Sep 2024 13:53:26 +0200 Subject: [PATCH] Stop writing `UploadLevelTotals` I believe these are completely unused. They were still being created/updated though. --- database/tests/factories/core.py | 15 -------- services/report/__init__.py | 25 ------------- services/tests/test_report.py | 61 -------------------------------- 3 files changed, 101 deletions(-) diff --git a/database/tests/factories/core.py b/database/tests/factories/core.py index a70b36c07..88dd46696 100644 --- a/database/tests/factories/core.py +++ b/database/tests/factories/core.py @@ -233,21 +233,6 @@ class Meta: created_at = datetime.now() -class UploadLevelTotalsFactory(Factory): - class Meta: - model = models.UploadLevelTotals - - upload = factory.SubFactory(UploadFactory) - branches = 0 - coverage = 0.00 - hits = 0 - lines = 0 - methods = 0 - misses = 0 - partials = 0 - files = 0 - - class RepositoryFlagFactory(Factory): class Meta: model = models.RepositoryFlag diff --git a/services/report/__init__.py b/services/report/__init__.py index 106435d22..612257cf6 100644 --- a/services/report/__init__.py +++ b/services/report/__init__.py @@ -34,7 +34,6 @@ ReportDetails, ReportLevelTotals, RepositoryFlag, - UploadLevelTotals, ) from helpers.environment import Environment, get_current_env from helpers.exceptions import ( @@ -1095,24 +1094,6 @@ def update_upload_with_processing_result( upload_obj.state_id = UploadState.PROCESSED.db_id upload_obj.state = "processed" upload_obj.order_number = session.id - upload_totals = upload_obj.totals - if upload_totals is None: - upload_totals = UploadLevelTotals( - upload_id=upload_obj.id, - branches=0, - coverage=0, - hits=0, - lines=0, - methods=0, - misses=0, - partials=0, - files=0, - ) - db_session.add(upload_totals) - if session.totals is not None: - upload_totals.update_from_totals( - session.totals, precision=precision, rounding=rounding - ) else: error = processing_result.error upload_obj.state = "error" @@ -1252,12 +1233,6 @@ def save_full_report( db_session.add(upload) db_session.flush() self._attach_flags_to_upload(upload, session.flags if session.flags else []) - if session.totals is not None: - upload_totals = UploadLevelTotals(upload_id=upload.id_) - db_session.add(upload_totals) - upload_totals.update_from_totals( - session.totals, precision=precision, rounding=rounding - ) return res @sentry_sdk.trace diff --git a/services/tests/test_report.py b/services/tests/test_report.py index a3a1793cc..f1d15f3cd 100644 --- a/services/tests/test_report.py +++ b/services/tests/test_report.py @@ -18,7 +18,6 @@ ReportLevelTotalsFactory, RepositoryFlagFactory, UploadFactory, - UploadLevelTotalsFactory, ) from helpers.exceptions import RepositoryWithoutValidBotError from services.archive import ArchiveService @@ -477,18 +476,6 @@ def test_build_report_from_commit(self, dbsession, mock_storage): upload = UploadFactory(report=report, order_number=0, upload_type="upload") dbsession.add(upload) - upload_totals = UploadLevelTotalsFactory( - upload=upload, - files=3, - lines=20, - hits=17, - misses=3, - partials=0, - coverage=85.0, - branches=0, - methods=0, - ) - dbsession.add(upload_totals) dbsession.commit() dbsession.flush() @@ -606,54 +593,18 @@ def test_build_report_from_commit_with_flags(self, dbsession, mock_storage): report=report, flags=[flag1], order_number=0, upload_type="upload" ) dbsession.add(upload1) - upload_totals1 = UploadLevelTotalsFactory( - upload=upload1, - files=3, - lines=20, - hits=17, - misses=3, - partials=0, - coverage=85.0, - branches=0, - methods=0, - ) - dbsession.add(upload_totals1) dbsession.commit() upload2 = UploadFactory( report=report, flags=[flag1], order_number=1, upload_type="carriedforward" ) dbsession.add(upload2) - upload_totals2 = UploadLevelTotalsFactory( - upload=upload2, - files=3, - lines=20, - hits=20, - misses=0, - partials=0, - coverage=100.0, - branches=0, - methods=0, - ) - dbsession.add(upload_totals2) dbsession.commit() upload3 = UploadFactory( report=report, flags=[flag2], order_number=2, upload_type="carriedforward" ) dbsession.add(upload3) - upload_totals3 = UploadLevelTotalsFactory( - upload=upload3, - files=3, - lines=20, - hits=20, - misses=0, - partials=0, - coverage=100.0, - branches=0, - methods=0, - ) - dbsession.add(upload_totals3) dbsession.commit() dbsession.flush() @@ -661,18 +612,6 @@ def test_build_report_from_commit_with_flags(self, dbsession, mock_storage): report=report, flags=[flag3], order_number=3, upload_type="upload" ) dbsession.add(upload4) - upload_totals4 = UploadLevelTotalsFactory( - upload=upload4, - files=3, - lines=20, - hits=20, - misses=0, - partials=0, - coverage=100.0, - branches=0, - methods=0, - ) - dbsession.add(upload_totals4) dbsession.commit() dbsession.flush()