Skip to content

Commit 81da94a

Browse files
committed
Add rmdepcheck and license-validate tests
Signed-off-by: Cristian Le <git@lecris.dev>
1 parent ed30e1b commit 81da94a

3 files changed

Lines changed: 189 additions & 2 deletions

File tree

packit_service/worker/helpers/testing_farm.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,6 +1603,41 @@ def _payload_rpmlint(self, distro: str, compose: str) -> dict:
16031603
}
16041604
return payload
16051605

1606+
def _get_fedora_ci_payload(self, distro: str, plan: str) -> dict:
1607+
# TODO: Gradually move the other tests to use the shared-tests repo
1608+
# TODO: Installability migration is blocked because it needs specific compose
1609+
# Maybe we can define a specific context that can expand to the appropriate container image
1610+
# TODO: Remove the need for specific plan needed here
1611+
# https://github.com/packit/packit-service/issues/2915
1612+
# TODO: `distro` context can eventually be dropped once the tests migrate to using
1613+
# `dist-git-branch`
1614+
git_repo = "https://forge.fedoraproject.org/ci/shared-tests"
1615+
git_ref = "main" if self.service_config.deployment == Deployment.prod else "stg"
1616+
# All tests in ci/shared-tests define their own provision hence `compose=None`
1617+
payload = self._get_tf_base_payload(distro, None)
1618+
payload["test"] = {
1619+
"tmt": {
1620+
"url": git_repo,
1621+
"ref": git_ref,
1622+
"name": plan,
1623+
},
1624+
}
1625+
return payload
1626+
1627+
@implements_fedora_ci_test(
1628+
"rmdepcheck",
1629+
checkers=[IsProjectOutsideOfTestsNamespace],
1630+
)
1631+
def _payload_rmdepcheck(self, distro: str, compose: str) -> dict:
1632+
return self._get_fedora_ci_payload(distro, "/rmdepcheck")
1633+
1634+
@implements_fedora_ci_test(
1635+
"license-validate",
1636+
checkers=[IsProjectOutsideOfTestsNamespace],
1637+
)
1638+
def _payload_fedora_review(self, distro: str, compose: str) -> dict:
1639+
return self._get_fedora_ci_payload(distro, "/license-validate")
1640+
16061641
@implements_fedora_ci_test(
16071642
"custom",
16081643
checkers=[IsFMFConfigPresent],

tests/integration/test_listen_to_fedmsg.py

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,30 @@ def test_koji_build_end_downstream(
27652765
**common_payload_no_compose,
27662766
}
27672767

2768+
shared_tests_repo = "https://forge.fedoraproject.org/ci/shared-tests"
2769+
2770+
payload_rmdepcheck = {
2771+
"test": {
2772+
"tmt": {
2773+
"url": shared_tests_repo,
2774+
"ref": "stg",
2775+
"name": "/rmdepcheck",
2776+
},
2777+
},
2778+
**common_payload_no_compose,
2779+
}
2780+
2781+
payload_license_validate = {
2782+
"test": {
2783+
"tmt": {
2784+
"url": shared_tests_repo,
2785+
"ref": "stg",
2786+
"name": "/license-validate",
2787+
},
2788+
},
2789+
**common_payload_no_compose,
2790+
}
2791+
27682792
payload_custom = {
27692793
"test": {
27702794
"tmt": {
@@ -2849,6 +2873,26 @@ def test_koji_build_end_downstream(
28492873
json={"id": pipeline_id},
28502874
),
28512875
).once()
2876+
flexmock(TestingFarmClient).should_receive(
2877+
"send_testing_farm_request",
2878+
).with_args(endpoint="requests", method="POST", data=payload_rmdepcheck).and_return(
2879+
RequestResponse(
2880+
status_code=200,
2881+
ok=True,
2882+
content=json.dumps({"id": pipeline_id}).encode(),
2883+
json={"id": pipeline_id},
2884+
),
2885+
).once()
2886+
flexmock(TestingFarmClient).should_receive(
2887+
"send_testing_farm_request",
2888+
).with_args(endpoint="requests", method="POST", data=payload_license_validate).and_return(
2889+
RequestResponse(
2890+
status_code=200,
2891+
ok=True,
2892+
content=json.dumps({"id": pipeline_id}).encode(),
2893+
json={"id": pipeline_id},
2894+
),
2895+
).once()
28522896
flexmock(TestingFarmClient).should_receive(
28532897
"send_testing_farm_request",
28542898
).with_args(endpoint="requests", method="POST", data=payload_custom).and_return(
@@ -2928,12 +2972,48 @@ def test_koji_build_end_downstream(
29282972
.once()
29292973
.mock()
29302974
)
2975+
tft_test_run_model_rmdepcheck = (
2976+
flexmock(
2977+
id=9,
2978+
koji_builds=[koji_build_pr_downstream],
2979+
status=TestingFarmResult.new,
2980+
target=distro,
2981+
data={"fedora_ci_test": "rmdepcheck"},
2982+
)
2983+
.should_receive("set_pipeline_id")
2984+
.with_args(pipeline_id)
2985+
.once()
2986+
.mock()
2987+
.should_receive("set_status")
2988+
.with_args(TestingFarmResult.queued)
2989+
.once()
2990+
.mock()
2991+
)
2992+
tft_test_run_model_license_validate = (
2993+
flexmock(
2994+
id=10,
2995+
koji_builds=[koji_build_pr_downstream],
2996+
status=TestingFarmResult.new,
2997+
target=distro,
2998+
data={"fedora_ci_test": "license-validate"},
2999+
)
3000+
.should_receive("set_pipeline_id")
3001+
.with_args(pipeline_id)
3002+
.once()
3003+
.mock()
3004+
.should_receive("set_status")
3005+
.with_args(TestingFarmResult.queued)
3006+
.once()
3007+
.mock()
3008+
)
29313009
group = flexmock(
29323010
grouped_targets=[
29333011
tft_test_run_model_installability,
29343012
tft_test_run_model_custom,
29353013
tft_test_run_model_rpminspect,
29363014
tft_test_run_model_rpmlint,
3015+
tft_test_run_model_rmdepcheck,
3016+
tft_test_run_model_license_validate,
29373017
]
29383018
)
29393019
flexmock(TFTTestRunGroupModel).should_receive("create").with_args(
@@ -2992,6 +3072,32 @@ def test_koji_build_end_downstream(
29923072
"fedora_ci_test": "rpmlint",
29933073
},
29943074
).and_return(tft_test_run_model_rpmlint).once()
3075+
flexmock(TFTTestRunTargetModel).should_receive("create").with_args(
3076+
pipeline_id=None,
3077+
identifier=None,
3078+
status=TestingFarmResult.new,
3079+
target=distro,
3080+
web_url=None,
3081+
test_run_group=group,
3082+
koji_build_targets=[koji_build_pr_downstream],
3083+
data={
3084+
"base_project_url": "https://src.fedoraproject.org/rpms/packit",
3085+
"fedora_ci_test": "rmdepcheck",
3086+
},
3087+
).and_return(tft_test_run_model_rmdepcheck).once()
3088+
flexmock(TFTTestRunTargetModel).should_receive("create").with_args(
3089+
pipeline_id=None,
3090+
identifier=None,
3091+
status=TestingFarmResult.new,
3092+
target=distro,
3093+
web_url=None,
3094+
test_run_group=group,
3095+
koji_build_targets=[koji_build_pr_downstream],
3096+
data={
3097+
"base_project_url": "https://src.fedoraproject.org/rpms/packit",
3098+
"fedora_ci_test": "license-validate",
3099+
},
3100+
).and_return(tft_test_run_model_license_validate).once()
29953101

29963102
# check if packit-service set correct PR statuses
29973103
flexmock(StatusReporter).should_receive("set_status").with_args(
@@ -3057,6 +3163,34 @@ def test_koji_build_end_downstream(
30573163
check_name="Packit-stg - rpmlint",
30583164
target_branch=koji_target,
30593165
).once()
3166+
flexmock(StatusReporter).should_receive("set_status").with_args(
3167+
state=BaseCommitStatus.running,
3168+
description="Submitting the tests ...",
3169+
url="https://dashboard.localhost/jobs/testing-farm/9",
3170+
check_name="Packit-stg - rmdepcheck",
3171+
target_branch=koji_target,
3172+
).once()
3173+
flexmock(StatusReporter).should_receive("set_status").with_args(
3174+
state=BaseCommitStatus.running,
3175+
description="Tests have been submitted ...",
3176+
url="https://dashboard.localhost/jobs/testing-farm/9",
3177+
check_name="Packit-stg - rmdepcheck",
3178+
target_branch=koji_target,
3179+
).once()
3180+
flexmock(StatusReporter).should_receive("set_status").with_args(
3181+
state=BaseCommitStatus.running,
3182+
description="Submitting the tests ...",
3183+
url="https://dashboard.localhost/jobs/testing-farm/10",
3184+
check_name="Packit-stg - license-validate",
3185+
target_branch=koji_target,
3186+
).once()
3187+
flexmock(StatusReporter).should_receive("set_status").with_args(
3188+
state=BaseCommitStatus.running,
3189+
description="Tests have been submitted ...",
3190+
url="https://dashboard.localhost/jobs/testing-farm/10",
3191+
check_name="Packit-stg - license-validate",
3192+
target_branch=koji_target,
3193+
).once()
30603194

30613195
urls.DASHBOARD_URL = "https://dashboard.localhost"
30623196

tests/integration/test_pr_comment.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3872,6 +3872,14 @@ def _test_downstream_tf_retrigger_common(
38723872
"cafe8a3fb7c24f7534a6157514dda0f3",
38733873
"Packit-stg - rpmlint - rawhide [beaf90b]",
38743874
),
3875+
(
3876+
"88ac5f0f7dc0c684f988ec9157fff5b2",
3877+
"Packit-stg - rmdepcheck - rawhide [beaf90b]",
3878+
),
3879+
(
3880+
"325199098ce9f37cc790405f4fa300cf",
3881+
"Packit-stg - license-validate - rawhide [beaf90b]",
3882+
),
38753883
],
38763884
id="rawhide target branch",
38773885
),
@@ -3884,6 +3892,11 @@ def _test_downstream_tf_retrigger_common(
38843892
),
38853893
("d6df09a49152552c196c4d06f286abef", "Packit-stg - rpminspect - f42 [beaf90b]"),
38863894
("6901e099dadbb89822e6a64c411ceb8c", "Packit-stg - rpmlint - f42 [beaf90b]"),
3895+
("ea75be809952ac2c43a139e80d2cedc1", "Packit-stg - rmdepcheck - f42 [beaf90b]"),
3896+
(
3897+
"e3cceaaad50a791b999c00aba2973653",
3898+
"Packit-stg - license-validate - f42 [beaf90b]",
3899+
),
38873900
],
38883901
id="f42 target branch",
38893902
),
@@ -3899,7 +3912,7 @@ def test_downstream_testing_farm_retrigger_via_dist_git_pr_comment(
38993912
target_branch,
39003913
flags,
39013914
"/packit-ci test",
3902-
tests=3,
3915+
tests=5,
39033916
)
39043917

39053918

@@ -3971,8 +3984,13 @@ def test_downstream_testing_farm_retrigger_specific_plan_via_dist_git_pr_comment
39713984
("Packit-stg - installability - eln [beaf90b]", "ca546b82b2aeb2fcef8bf12746f0bd06"),
39723985
("Packit-stg - rpminspect - eln [beaf90b]", "bb18abcfd81c6e8f66320513e432b4cd"),
39733986
("Packit-stg - rpmlint - eln [beaf90b]", "de24b7b63bf38420bdfea804d3bf56d7"),
3987+
("Packit-stg - rmdepcheck - eln [beaf90b]", "8ad85bf19e686070b8c8105956ec273a"),
3988+
(
3989+
"Packit-stg - license-validate - eln [beaf90b]",
3990+
"54f936fa395a5b11c0595cde0de3571d",
3991+
),
39743992
},
3975-
3,
3993+
5,
39763994
"eln",
39773995
id="rpminspect - rawhide branch, eln target",
39783996
),

0 commit comments

Comments
 (0)