Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit ed73845

Browse files
Remove Impact Analysis from API
I've stubbed out Impact Analysis fields from the API, as it would take a lot of work to remove them from Gazebo first. So, just returning a bunch of dummy values for now.
1 parent 7c058c9 commit ed73845

31 files changed

+47
-1273
lines changed

codecov/settings_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"core",
4141
"graphql_api",
4242
"labelanalysis",
43-
"profiling",
4443
"reports",
4544
"staticanalysis",
4645
"timeseries",

codecov/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
path("webhooks/", include("webhook_handlers.urls")),
2121
path("graphql/", include("graphql_api.urls")),
2222
path("", include("codecov_auth.urls")),
23-
path("profiling/", include("profiling.urls")),
2423
path(f"{settings.DJANGO_ADMIN_URL}/", admin.site.urls),
2524
path("staticanalysis/", include("staticanalysis.urls")),
2625
path("labels/", include("labelanalysis.urls")),

core/commands/repository/interactors/tests/test_get_repository_token.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def setUp(self):
2626
self.user = OwnerFactory(organizations=[self.org.ownerid])
2727
RepositoryTokenFactory(repository=self.active_repo, key="random")
2828

29-
def execute(self, owner, repo, token_type="profiling"):
29+
def execute(self, owner, repo, token_type="upload"):
3030
return GetRepositoryTokenInteractor(owner, "github").execute(
3131
repository=repo, token_type=token_type
3232
)
@@ -44,11 +44,6 @@ async def test_when_repo_has_no_token(self):
4444
assert token is not None
4545
assert len(token) == 40
4646

47-
async def test_get_profiling_token(self):
48-
token = await self.execute(owner=self.user, repo=self.active_repo)
49-
assert token is not None
50-
assert token == "random"
51-
5247
async def test_get_static_analysis_token(self):
5348
token = await self.execute(
5449
owner=self.user, repo=self.active_repo, token_type="static_analysis"

core/commands/repository/interactors/tests/test_regenerate_repository_token.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def execute(self, owner, repo):
3434
return RegenerateRepositoryTokenInteractor(owner, "github").execute(
3535
repo_name=repo.name,
3636
owner_username=self.org.username,
37-
token_type="profiling",
37+
token_type="upload",
3838
)
3939

4040
async def test_when_validation_error_repo_not_active(self):
@@ -44,14 +44,3 @@ async def test_when_validation_error_repo_not_active(self):
4444
async def test_when_validation_error_repo_not_viewable(self):
4545
with pytest.raises(ValidationError):
4646
await self.execute(owner=self.random_user, repo=self.active_repo)
47-
48-
async def test_regenerate_profiling_token_repo_has_no_token(self):
49-
token = await self.execute(owner=self.user, repo=self.repo_with_no_token)
50-
assert token is not None
51-
assert len(token) == 40
52-
53-
async def test_regenerate_profiling_token(self):
54-
token = await self.execute(owner=self.user, repo=self.active_repo)
55-
assert token is not None
56-
assert token != "random"
57-
assert len(token) == 40

graphql_api/tests/mutation/test_regenerate_repository_token.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,6 @@ def test_when_validation_error_repo_not_viewable(self):
6161
== "ValidationError"
6262
)
6363

64-
def test_when_authenticated_regenerate_profiling_token(self):
65-
user = OwnerFactory(
66-
organizations=[self.org.ownerid], permission=[self.repo.repoid]
67-
)
68-
RepositoryTokenFactory(repository=self.repo, key="random")
69-
data = self.gql_request(
70-
query,
71-
owner=user,
72-
variables={
73-
"input": {
74-
"owner": "codecov",
75-
"repoName": "gazebo",
76-
"tokenType": "PROFILING",
77-
}
78-
},
79-
)
80-
newToken = data["regenerateRepositoryToken"]["token"]
81-
assert newToken != "random"
82-
assert len(newToken) == 40
83-
8464
def test_when_authenticated_regenerate_staticanalysis_token(self):
8565
user = OwnerFactory(
8666
organizations=[self.org.ownerid], permission=[self.repo.repoid]

graphql_api/tests/test_branch.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from shared.reports.types import ReportTotals
1212

1313
from services.components import Component
14-
from services.profiling import CriticalFile
1514

1615
from .helper import GraphQLTestHelper
1716

@@ -347,11 +346,8 @@ def test_fetch_path_contents_with_no_report(self, report_mock):
347346
}
348347
}
349348

350-
@patch(
351-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
352-
)
353349
@patch("shared.reports.api_report_service.build_report_from_commit")
354-
def test_fetch_path_contents_with_files(self, report_mock, critical_files):
350+
def test_fetch_path_contents_with_files(self, report_mock):
355351
variables = {
356352
"org": self.org.username,
357353
"repo": self.repo.name,
@@ -365,7 +361,6 @@ def test_fetch_path_contents_with_files(self, report_mock, critical_files):
365361
},
366362
}
367363
report_mock.return_value = MockReport()
368-
critical_files.return_value = [CriticalFile("fileA.py")]
369364

370365
data = self.gql_request(query_files, variables=variables)
371366
assert data == {
@@ -406,7 +401,7 @@ def test_fetch_path_contents_with_files(self, report_mock, critical_files):
406401
"partials": 0,
407402
"lines": 10,
408403
"percentCovered": 80.0,
409-
"isCriticalFile": True,
404+
"isCriticalFile": False,
410405
},
411406
],
412407
}
@@ -416,12 +411,10 @@ def test_fetch_path_contents_with_files(self, report_mock, critical_files):
416411
}
417412
}
418413

419-
@patch(
420-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
421-
)
422414
@patch("shared.reports.api_report_service.build_report_from_commit")
423415
def test_fetch_path_contents_with_files_and_path_prefix(
424-
self, report_mock, critical_files
416+
self,
417+
report_mock,
425418
):
426419
variables = {
427420
"org": self.org.username,
@@ -436,7 +429,6 @@ def test_fetch_path_contents_with_files_and_path_prefix(
436429
},
437430
}
438431
report_mock.return_value = MockReport()
439-
critical_files.return_value = [CriticalFile("folder/fileB.py")]
440432

441433
data = self.gql_request(query_files, variables=variables)
442434

@@ -457,7 +449,7 @@ def test_fetch_path_contents_with_files_and_path_prefix(
457449
"partials": 0,
458450
"lines": 10,
459451
"percentCovered": 80.0,
460-
"isCriticalFile": True,
452+
"isCriticalFile": False,
461453
},
462454
{
463455
"__typename": "PathContentDir",
@@ -477,12 +469,10 @@ def test_fetch_path_contents_with_files_and_path_prefix(
477469
}
478470
}
479471

480-
@patch(
481-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
482-
)
483472
@patch("shared.reports.api_report_service.build_report_from_commit")
484473
def test_fetch_path_contents_with_files_and_search_value_case_insensitive(
485-
self, report_mock, critical_files
474+
self,
475+
report_mock,
486476
):
487477
variables = {
488478
"org": self.org.username,
@@ -494,7 +484,6 @@ def test_fetch_path_contents_with_files_and_search_value_case_insensitive(
494484
},
495485
}
496486
report_mock.return_value = MockReport()
497-
critical_files.return_value = [CriticalFile("folder/fileB.py")]
498487

499488
data = self.gql_request(query_files, variables=variables)
500489

@@ -526,7 +515,7 @@ def test_fetch_path_contents_with_files_and_search_value_case_insensitive(
526515
"partials": 0,
527516
"lines": 10,
528517
"percentCovered": 80.0,
529-
"isCriticalFile": True,
518+
"isCriticalFile": False,
530519
},
531520
],
532521
}
@@ -1147,13 +1136,9 @@ def test_fetch_path_contents_component_flags_filters(
11471136
}
11481137
}
11491138

1150-
@patch(
1151-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
1152-
)
11531139
@patch("shared.reports.api_report_service.build_report_from_commit")
1154-
def test_fetch_path_contents_deprecated(self, report_mock, critical_files_mock):
1140+
def test_fetch_path_contents_deprecated(self, report_mock):
11551141
report_mock.return_value = MockReport()
1156-
critical_files_mock.return_value = []
11571142

11581143
variables = {
11591144
"org": self.org.username,
@@ -1212,15 +1197,12 @@ def test_fetch_path_contents_deprecated(self, report_mock, critical_files_mock):
12121197
}
12131198
}
12141199

1215-
@patch(
1216-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
1217-
)
12181200
@patch("shared.reports.api_report_service.build_report_from_commit")
12191201
def test_fetch_path_contents_deprecated_paginated(
1220-
self, report_mock, critical_files_mock
1202+
self,
1203+
report_mock,
12211204
):
12221205
report_mock.return_value = MockReport()
1223-
critical_files_mock.return_value = []
12241206

12251207
variables = {
12261208
"org": self.org.username,

graphql_api/tests/test_commit.py

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
)
3434
from services.comparison import MissingComparisonReport
3535
from services.components import Component
36-
from services.profiling import CriticalFile
3736

3837
from .helper import GraphQLTestHelper, paginate_connection
3938

@@ -523,13 +522,10 @@ def test_fetch_commit_yaml_call_the_command(self, command_mock):
523522
commit = data["owner"]["repository"]["commit"]
524523
assert commit["yaml"] == yaml.dump(fake_config)
525524

526-
@patch(
527-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
528-
)
529525
@patch("core.commands.commit.commit.CommitCommands.get_file_content")
530526
@patch("shared.reports.api_report_service.build_report_from_commit")
531527
def test_fetch_commit_coverage_file_call_the_command(
532-
self, report_mock, content_mock, critical_files
528+
self, report_mock, content_mock
533529
):
534530
query = (
535531
query_commit
@@ -551,7 +547,6 @@ def test_fetch_commit_coverage_file_call_the_command(
551547
"totals": {"percentCovered": 83.0},
552548
}
553549
content_mock.return_value = "file content"
554-
critical_files.return_value = [CriticalFile("path")]
555550

556551
report_mock.return_value = MockReport()
557552
data = self.gql_request(query, variables=variables)
@@ -561,7 +556,7 @@ def test_fetch_commit_coverage_file_call_the_command(
561556
assert coverageFile["content"] == fake_coverage["content"]
562557
assert coverageFile["coverage"] == fake_coverage["coverage"]
563558
assert coverageFile["totals"] == fake_coverage["totals"]
564-
assert coverageFile["isCriticalFile"] == True
559+
assert coverageFile["isCriticalFile"] == False
565560
assert coverageFile["hashedPath"] == hashlib.md5("path".encode()).hexdigest()
566561

567562
@patch("services.components.component_filtered_report")
@@ -648,13 +643,12 @@ def test_fetch_commit_coverage_file_with_components(
648643
}
649644
}
650645

651-
@patch(
652-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
653-
)
654646
@patch("core.commands.commit.commit.CommitCommands.get_file_content")
655647
@patch("shared.reports.api_report_service.build_report_from_commit")
656648
def test_fetch_commit_with_no_coverage_data(
657-
self, report_mock, content_mock, critical_files
649+
self,
650+
report_mock,
651+
content_mock,
658652
):
659653
query = (
660654
query_commit
@@ -668,7 +662,6 @@ def test_fetch_commit_with_no_coverage_data(
668662
}
669663
fake_coverage = {"content": "file content", "coverage": [], "totals": None}
670664
content_mock.return_value = "file content"
671-
critical_files.return_value = []
672665

673666
report_mock.return_value = EmptyReport()
674667
data = self.gql_request(query, variables=variables)
@@ -2201,30 +2194,6 @@ def test_compare_with_parent_missing_change_coverage(self):
22012194
commit = data["owner"]["repository"]["commit"]
22022195
assert commit["compareWithParent"]["changeCoverage"] is None
22032196

2204-
@patch(
2205-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
2206-
)
2207-
def test_commit_critical_files(self, critical_files):
2208-
critical_files.return_value = [
2209-
CriticalFile("one"),
2210-
CriticalFile("two"),
2211-
CriticalFile("three"),
2212-
]
2213-
2214-
query = query_commit % "criticalFiles { name }"
2215-
variables = {
2216-
"org": self.org.username,
2217-
"repo": self.repo.name,
2218-
"commit": self.commit.commitid,
2219-
}
2220-
data = self.gql_request(query, variables=variables)
2221-
commit = data["owner"]["repository"]["commit"]
2222-
assert commit["criticalFiles"] == [
2223-
{"name": "one"},
2224-
{"name": "two"},
2225-
{"name": "three"},
2226-
]
2227-
22282197
def test_commit_yaml_errors(self):
22292198
CommitErrorFactory(commit=self.commit, error_code="invalid_yaml")
22302199
CommitErrorFactory(commit=self.commit, error_code="yaml_client_error")
@@ -2649,13 +2618,12 @@ def test_coverage_totals(self):
26492618
commit = data["owner"]["repository"]["commit"]
26502619
assert commit["coverageAnalytics"]["totals"]["percentCovered"] == 12
26512620

2652-
@patch(
2653-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
2654-
)
26552621
@patch("core.commands.commit.commit.CommitCommands.get_file_content")
26562622
@patch("shared.reports.api_report_service.build_report_from_commit")
26572623
def test_fetch_commit_coverage_coverage_file(
2658-
self, report_mock, content_mock, critical_files
2624+
self,
2625+
report_mock,
2626+
content_mock,
26592627
):
26602628
query = (
26612629
query_commit
@@ -2677,7 +2645,6 @@ def test_fetch_commit_coverage_coverage_file(
26772645
"totals": {"percentCovered": 83.0},
26782646
}
26792647
content_mock.return_value = "file content"
2680-
critical_files.return_value = [CriticalFile("path")]
26812648

26822649
report_mock.return_value = MockReport()
26832650
data = self.gql_request(query, variables=variables)
@@ -2687,7 +2654,7 @@ def test_fetch_commit_coverage_coverage_file(
26872654
assert coverageFile["content"] == fake_coverage["content"]
26882655
assert coverageFile["coverage"] == fake_coverage["coverage"]
26892656
assert coverageFile["totals"] == fake_coverage["totals"]
2690-
assert coverageFile["isCriticalFile"] == True
2657+
assert coverageFile["isCriticalFile"] == False
26912658
assert coverageFile["hashedPath"] == hashlib.md5("path".encode()).hexdigest()
26922659

26932660
@patch("services.components.component_filtered_report")
@@ -2774,13 +2741,12 @@ def test_fetch_commit_coverage_coverage_file_with_components(
27742741
}
27752742
}
27762743

2777-
@patch(
2778-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
2779-
)
27802744
@patch("core.commands.commit.commit.CommitCommands.get_file_content")
27812745
@patch("shared.reports.api_report_service.build_report_from_commit")
27822746
def test_fetch_commit_coverage_with_no_coverage_data(
2783-
self, report_mock, content_mock, critical_files
2747+
self,
2748+
report_mock,
2749+
content_mock,
27842750
):
27852751
query = (
27862752
query_commit
@@ -2794,7 +2760,6 @@ def test_fetch_commit_coverage_with_no_coverage_data(
27942760
}
27952761
fake_coverage = {"content": "file content", "coverage": [], "totals": None}
27962762
content_mock.return_value = "file content"
2797-
critical_files.return_value = []
27982763

27992764
report_mock.return_value = EmptyReport()
28002765
data = self.gql_request(query, variables=variables)

0 commit comments

Comments
 (0)