Skip to content
Open
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
29 changes: 29 additions & 0 deletions packit_service/worker/helpers/testing_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,35 @@ def _payload_rpmlint(self, distro: str, compose: str) -> dict:
}
return payload

def _get_fedora_ci_payload(self, distro: str, plan: str) -> dict:
# TODO: Gradually move the other tests to use the shared-tests repo
# TODO: Installability migration is blocked because it needs specific compose
# Maybe we can define a specific context that can expand to the appropriate container image
# TODO: Remove the need for specific plan needed here
# https://github.com/packit/packit-service/issues/2915
# TODO: `distro` context can eventually be dropped once the tests migrate to using
# `dist-git-branch`
git_repo = "https://forge.fedoraproject.org/ci/shared-tests"
git_ref = "main" if self.service_config.deployment == Deployment.prod else "stg"
# All tests in ci/shared-tests define their own provision hence `compose=None`
payload = self._get_tf_base_payload(distro, None)
payload["test"] = {
"tmt": {
"url": git_repo,
"ref": git_ref,
"name": plan,
},
}
return payload

@implements_fedora_ci_test("rmdepcheck")
def _payload_rmdepcheck(self, distro: str, compose: str) -> dict:
return self._get_fedora_ci_payload(distro, "/rmdepcheck")

@implements_fedora_ci_test("fedora-review")
def _payload_fedora_review(self, distro: str, compose: str) -> dict:
return self._get_fedora_ci_payload(distro, "/fedora-review")

@staticmethod
def is_fmf_configured(project: GitProject, metadata: EventData) -> bool:
try:
Expand Down
126 changes: 126 additions & 0 deletions tests/integration/test_listen_to_fedmsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2743,6 +2743,30 @@ def test_koji_build_end_downstream(
**common_payload_no_compose,
}

shared_tests_repo = "https://forge.fedoraproject.org/ci/shared-tests"

payload_rmdepcheck = {
"test": {
"tmt": {
"url": shared_tests_repo,
"ref": "stg",
"name": "/rmdepcheck",
},
},
**common_payload_no_compose,
}

payload_fedora_review = {
"test": {
"tmt": {
"url": shared_tests_repo,
"ref": "stg",
"name": "/fedora-review",
},
},
**common_payload_no_compose,
}

payload_custom = {
"test": {
"tmt": {
Expand Down Expand Up @@ -2826,6 +2850,26 @@ def test_koji_build_end_downstream(
json={"id": pipeline_id},
),
).once()
flexmock(TestingFarmClient).should_receive(
"send_testing_farm_request",
).with_args(endpoint="requests", method="POST", data=payload_rmdepcheck).and_return(
RequestResponse(
status_code=200,
ok=True,
content=json.dumps({"id": pipeline_id}).encode(),
json={"id": pipeline_id},
),
).once()
flexmock(TestingFarmClient).should_receive(
"send_testing_farm_request",
).with_args(endpoint="requests", method="POST", data=payload_fedora_review).and_return(
RequestResponse(
status_code=200,
ok=True,
content=json.dumps({"id": pipeline_id}).encode(),
json={"id": pipeline_id},
),
).once()
flexmock(TestingFarmClient).should_receive(
"send_testing_farm_request",
).with_args(endpoint="requests", method="POST", data=payload_custom).and_return(
Expand Down Expand Up @@ -2889,12 +2933,40 @@ def test_koji_build_end_downstream(
.once()
.mock()
)
tft_test_run_model_rmdepcheck = (
flexmock(
id=9,
koji_builds=[koji_build_pr_downstream],
status=TestingFarmResult.new,
target="fedora-rawhide",
data={"fedora_ci_test": "rmdepcheck"},
)
.should_receive("set_pipeline_id")
.with_args(pipeline_id)
.once()
.mock()
)
tft_test_run_model_fedora_review = (
flexmock(
id=10,
koji_builds=[koji_build_pr_downstream],
status=TestingFarmResult.new,
target="fedora-rawhide",
data={"fedora_ci_test": "fedora-review"},
)
.should_receive("set_pipeline_id")
.with_args(pipeline_id)
.once()
.mock()
)
group = flexmock(
grouped_targets=[
tft_test_run_model_installability,
tft_test_run_model_custom,
tft_test_run_model_rpminspect,
tft_test_run_model_rpmlint,
tft_test_run_model_rmdepcheck,
tft_test_run_model_fedora_review,
]
)
flexmock(TFTTestRunGroupModel).should_receive("create").with_args(
Expand Down Expand Up @@ -2953,6 +3025,32 @@ def test_koji_build_end_downstream(
"fedora_ci_test": "rpmlint",
},
).and_return(tft_test_run_model_rpmlint).once()
flexmock(TFTTestRunTargetModel).should_receive("create").with_args(
pipeline_id=None,
identifier=None,
status=TestingFarmResult.new,
target="fedora-rawhide",
web_url=None,
test_run_group=group,
koji_build_targets=[koji_build_pr_downstream],
data={
"base_project_url": "https://src.fedoraproject.org/rpms/packit",
"fedora_ci_test": "rmdepcheck",
},
).and_return(tft_test_run_model_rmdepcheck).once()
flexmock(TFTTestRunTargetModel).should_receive("create").with_args(
pipeline_id=None,
identifier=None,
status=TestingFarmResult.new,
target="fedora-rawhide",
web_url=None,
test_run_group=group,
koji_build_targets=[koji_build_pr_downstream],
data={
"base_project_url": "https://src.fedoraproject.org/rpms/packit",
"fedora_ci_test": "fedora-review",
},
).and_return(tft_test_run_model_fedora_review).once()

# check if packit-service set correct PR statuses
flexmock(StatusReporter).should_receive("set_status").with_args(
Expand Down Expand Up @@ -3018,6 +3116,34 @@ def test_koji_build_end_downstream(
check_name="Packit-stg - rpmlint",
target_branch="rawhide",
).once()
flexmock(StatusReporter).should_receive("set_status").with_args(
state=BaseCommitStatus.running,
description="Submitting the tests ...",
url="https://dashboard.localhost/jobs/testing-farm/9",
check_name="Packit-stg - rmdepcheck",
target_branch="rawhide",
).once()
flexmock(StatusReporter).should_receive("set_status").with_args(
state=BaseCommitStatus.running,
description="Tests have been submitted ...",
url="https://dashboard.localhost/jobs/testing-farm/9",
check_name="Packit-stg - rmdepcheck",
target_branch="rawhide",
).once()
flexmock(StatusReporter).should_receive("set_status").with_args(
state=BaseCommitStatus.running,
description="Submitting the tests ...",
url="https://dashboard.localhost/jobs/testing-farm/10",
check_name="Packit-stg - fedora-review",
target_branch="rawhide",
).once()
flexmock(StatusReporter).should_receive("set_status").with_args(
state=BaseCommitStatus.running,
description="Tests have been submitted ...",
url="https://dashboard.localhost/jobs/testing-farm/10",
check_name="Packit-stg - fedora-review",
target_branch="rawhide",
).once()

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

Expand Down
16 changes: 14 additions & 2 deletions tests/integration/test_pr_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3801,6 +3801,14 @@ def _test_downstream_tf_retrigger_common(
"cafe8a3fb7c24f7534a6157514dda0f3",
"Packit-stg - rpmlint - rawhide [beaf90b]",
),
(
"88ac5f0f7dc0c684f988ec9157fff5b2",
"Packit-stg - rmdepcheck - rawhide [beaf90b]",
),
(
"b1dfb863808dd40ec3aad8ccbe593629",
"Packit-stg - fedora-review - rawhide [beaf90b]",
),
],
id="rawhide target branch",
),
Expand All @@ -3813,6 +3821,8 @@ def _test_downstream_tf_retrigger_common(
),
("d6df09a49152552c196c4d06f286abef", "Packit-stg - rpminspect - f42 [beaf90b]"),
("6901e099dadbb89822e6a64c411ceb8c", "Packit-stg - rpmlint - f42 [beaf90b]"),
("ea75be809952ac2c43a139e80d2cedc1", "Packit-stg - rmdepcheck - f42 [beaf90b]"),
("01208dc0f9bfe5e604ae0d169fde7484", "Packit-stg - fedora-review - f42 [beaf90b]"),
],
id="f42 target branch",
),
Expand All @@ -3828,7 +3838,7 @@ def test_downstream_testing_farm_retrigger_via_dist_git_pr_comment(
target_branch,
flags,
"/packit-ci test",
tests=3,
tests=5,
)


Expand Down Expand Up @@ -3900,8 +3910,10 @@ def test_downstream_testing_farm_retrigger_specific_plan_via_dist_git_pr_comment
("Packit-stg - installability - eln [beaf90b]", "ca546b82b2aeb2fcef8bf12746f0bd06"),
("Packit-stg - rpminspect - eln [beaf90b]", "bb18abcfd81c6e8f66320513e432b4cd"),
("Packit-stg - rpmlint - eln [beaf90b]", "de24b7b63bf38420bdfea804d3bf56d7"),
("Packit-stg - rmdepcheck - eln [beaf90b]", "8ad85bf19e686070b8c8105956ec273a"),
("Packit-stg - fedora-review - eln [beaf90b]", "3f2851131649c410727a289394d51112"),
},
3,
5,
"eln",
id="rpminspect - rawhide branch, eln target",
),
Expand Down
Loading