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

Commit a077a2f

Browse files
fix(ta): pass impl_type in finisher (#1187)
1 parent 8729c05 commit a077a2f

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

tasks/test_results_finisher.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ def run_impl(
6262
impl_type: Literal["old", "new", "both"] = "old",
6363
**kwargs,
6464
):
65-
if impl_type == "both":
66-
impl_type = "old"
67-
6865
repoid = int(repoid)
6966

7067
self.extra_dict: dict[str, Any] = {
@@ -119,7 +116,7 @@ def process_impl_within_lock(
119116
commitid: str,
120117
commit_yaml: UserYaml,
121118
chain_result: bool,
122-
impl_type: Literal["old", "new"],
119+
impl_type: Literal["old", "both", "new"],
123120
**kwargs,
124121
) -> FinisherResult:
125122
log.info("Running test results finishers", extra=self.extra_dict)
@@ -131,7 +128,9 @@ def process_impl_within_lock(
131128
assert commit, "commit not found"
132129
repo = commit.repository
133130

134-
return self.old_impl(db_session, repo, commit, chain_result, commit_yaml)
131+
return self.old_impl(
132+
db_session, repo, commit, chain_result, commit_yaml, impl_type
133+
)
135134

136135
def old_impl(
137136
self,
@@ -140,6 +139,7 @@ def old_impl(
140139
commit: Commit,
141140
chain_result: bool,
142141
commit_yaml: UserYaml,
142+
impl_type: Literal["old", "both", "new"],
143143
) -> FinisherResult:
144144
repoid = repo.repoid
145145
commitid = commit.commitid
@@ -152,12 +152,17 @@ def old_impl(
152152
kwargs=dict(
153153
repo_id=repoid,
154154
commit_id=commit.commitid,
155+
impl_type=impl_type,
155156
)
156157
)
157158

158159
if commit.branch is not None:
159160
self.app.tasks[cache_test_rollups_task_name].apply_async(
160-
kwargs=dict(repoid=repoid, branch=commit.branch),
161+
kwargs=dict(
162+
repoid=repoid,
163+
branch=commit.branch,
164+
impl_type=impl_type,
165+
),
161166
)
162167

163168
commit_report = commit.commit_report(ReportType.TEST_RESULTS)

tasks/tests/unit/test_test_results_finisher.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ def test_upload_finisher_task_call(
366366
repoid=repoid,
367367
commitid=commit.commitid,
368368
commit_yaml={"codecov": {"max_report_age": False}},
369+
impl_type="both",
369370
)
370371

371372
expected_result = {
@@ -380,6 +381,7 @@ def test_upload_finisher_task_call(
380381
kwargs={
381382
"repoid": repoid,
382383
"branch": "main",
384+
"impl_type": "both",
383385
},
384386
)
385387

@@ -512,6 +514,7 @@ def test_upload_finisher_task_call_no_failures(
512514
kwargs={
513515
"repoid": repoid,
514516
"branch": "main",
517+
"impl_type": "old",
515518
},
516519
)
517520

@@ -610,6 +613,7 @@ def test_upload_finisher_task_call_no_success(
610613
kwargs={
611614
"repoid": repoid,
612615
"branch": "main",
616+
"impl_type": "old",
613617
},
614618
)
615619

@@ -680,6 +684,7 @@ def test_upload_finisher_task_call_upgrade_comment(
680684
kwargs={
681685
"repoid": repoid,
682686
"branch": "main",
687+
"impl_type": "old",
683688
},
684689
)
685690

@@ -723,6 +728,7 @@ def test_upload_finisher_task_call_existing_comment(
723728
kwargs={
724729
"repoid": repoid,
725730
"branch": "main",
731+
"impl_type": "old",
726732
},
727733
)
728734

@@ -845,6 +851,7 @@ def test_upload_finisher_task_call_comment_fails(
845851
kwargs={
846852
"repoid": repoid,
847853
"branch": "main",
854+
"impl_type": "old",
848855
},
849856
)
850857

@@ -922,6 +929,7 @@ def test_upload_finisher_task_call_with_flaky(
922929
kwargs={
923930
"repoid": repoid,
924931
"branch": "main",
932+
"impl_type": "old",
925933
},
926934
)
927935

@@ -1007,6 +1015,7 @@ def test_upload_finisher_task_call_main_branch(
10071015
kwargs={
10081016
"repo_id": repoid,
10091017
"commit_id": commit.commitid,
1018+
"impl_type": "old",
10101019
},
10111020
)
10121021
test_results_mock_app.tasks[
@@ -1015,6 +1024,7 @@ def test_upload_finisher_task_call_main_branch(
10151024
kwargs={
10161025
"repoid": repoid,
10171026
"branch": "main",
1027+
"impl_type": "old",
10181028
},
10191029
)
10201030

@@ -1188,6 +1198,7 @@ def test_upload_finisher_task_call_main_with_plan(
11881198
kwargs={
11891199
"repo_id": repoid,
11901200
"commit_id": commit.commitid,
1201+
"impl_type": "old",
11911202
},
11921203
)
11931204
else:

0 commit comments

Comments
 (0)