Skip to content

Commit ca2b49b

Browse files
Provide dashboard URL when submitting tests (#2918)
Provide dashboard URL when submitting tests Related to packit/packit#2668 RELEASE NOTES BEGIN When submitting the tests, we are now providing the URL to the dashboard test job (this should result in better UX especially for GitLab integration). RELEASE NOTES END Reviewed-by: gemini-code-assist[bot] Reviewed-by: Nikola Forró Reviewed-by: Maja Massarini
2 parents 1fc2892 + a4d8a72 commit ca2b49b

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

packit_service/worker/helpers/testing_farm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ def run_testing_farm(
784784
state=BaseCommitStatus.running,
785785
description=f"{'Build succeeded. ' if not self.skip_build else ''}"
786786
f"Submitting the tests ...",
787+
url=get_testing_farm_info_url(test_run.id),
787788
target=test_run.target,
788789
)
789790

@@ -1373,6 +1374,7 @@ def run_testing_farm(
13731374
test_run=test_run,
13741375
state=BaseCommitStatus.running,
13751376
description="Submitting the tests ...",
1377+
url=get_testing_farm_info_url(test_run.id),
13761378
)
13771379

13781380
return self.prepare_and_send_tf_request(test_run)

tests/integration/test_listen_to_fedmsg.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
get_copr_build_info_url,
4949
get_koji_build_info_url,
5050
get_srpm_build_info_url,
51+
get_testing_farm_info_url,
5152
)
5253
from packit_service.worker.handlers import CoprBuildEndHandler
5354
from packit_service.worker.handlers.bodhi import BodhiUpdateFromSidetagHandler
@@ -745,7 +746,7 @@ def test_copr_build_end_testing_farm(copr_build_end, copr_build_pr):
745746
state=BaseCommitStatus.running,
746747
description="Build succeeded. Submitting the tests ...",
747748
check_names=EXPECTED_TESTING_FARM_CHECK_NAME,
748-
url="",
749+
url=get_testing_farm_info_url(5),
749750
markdown_content=None,
750751
links_to_external_services=None,
751752
update_feedback_time=object,
@@ -2008,6 +2009,7 @@ def test_copr_build_end_failed_testing_farm(copr_build_end, copr_build_pr):
20082009

20092010
test = (
20102011
flexmock(
2012+
id=1,
20112013
status=TestingFarmResult.new,
20122014
copr_builds=[copr_build_pr],
20132015
target="fedora-rawhide-x86_64",
@@ -2044,7 +2046,7 @@ def test_copr_build_end_failed_testing_farm(copr_build_end, copr_build_pr):
20442046
state=BaseCommitStatus.running,
20452047
description="Build succeeded. Submitting the tests ...",
20462048
check_names=EXPECTED_TESTING_FARM_CHECK_NAME,
2047-
url="",
2049+
url=get_testing_farm_info_url(1),
20482050
markdown_content=None,
20492051
links_to_external_services=None,
20502052
update_feedback_time=object,
@@ -2199,6 +2201,7 @@ def test_copr_build_end_failed_testing_farm_no_json(copr_build_end, copr_build_p
21992201

22002202
test = (
22012203
flexmock(
2204+
id=1,
22022205
status=TestingFarmResult.new,
22032206
copr_builds=[copr_build_pr],
22042207
target="fedora-rawhide-x86_64",
@@ -2236,7 +2239,7 @@ def test_copr_build_end_failed_testing_farm_no_json(copr_build_end, copr_build_p
22362239
state=BaseCommitStatus.running,
22372240
description="Build succeeded. Submitting the tests ...",
22382241
check_names=EXPECTED_TESTING_FARM_CHECK_NAME,
2239-
url="",
2242+
url=get_testing_farm_info_url(1),
22402243
markdown_content=None,
22412244
links_to_external_services=None,
22422245
update_feedback_time=object,
@@ -2936,7 +2939,7 @@ def test_koji_build_end_downstream(
29362939
flexmock(StatusReporter).should_receive("set_status").with_args(
29372940
state=BaseCommitStatus.running,
29382941
description="Submitting the tests ...",
2939-
url="",
2942+
url="https://dashboard.localhost/jobs/testing-farm/5",
29402943
check_name="Packit - installability test(s)",
29412944
target_branch="rawhide",
29422945
).once()
@@ -2950,7 +2953,7 @@ def test_koji_build_end_downstream(
29502953
flexmock(StatusReporter).should_receive("set_status").with_args(
29512954
state=BaseCommitStatus.running,
29522955
description="Submitting the tests ...",
2953-
url="",
2956+
url="https://dashboard.localhost/jobs/testing-farm/6",
29542957
check_name="Packit - custom test(s)",
29552958
target_branch="rawhide",
29562959
).once()
@@ -2964,7 +2967,7 @@ def test_koji_build_end_downstream(
29642967
flexmock(StatusReporter).should_receive("set_status").with_args(
29652968
state=BaseCommitStatus.running,
29662969
description="Submitting the tests ...",
2967-
url="",
2970+
url="https://dashboard.localhost/jobs/testing-farm/7",
29682971
check_name="Packit - rpminspect test(s)",
29692972
target_branch="rawhide",
29702973
).once()
@@ -2978,7 +2981,7 @@ def test_koji_build_end_downstream(
29782981
flexmock(StatusReporter).should_receive("set_status").with_args(
29792982
state=BaseCommitStatus.running,
29802983
description="Submitting the tests ...",
2981-
url="",
2984+
url="https://dashboard.localhost/jobs/testing-farm/8",
29822985
check_name="Packit - rpmlint test(s)",
29832986
target_branch="rawhide",
29842987
).once()

tests/integration/test_pr_comment.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
TFTTestRunTargetModel,
6868
)
6969
from packit_service.service.db_project_events import AddPullRequestEventToDb
70+
from packit_service.service.urls import get_testing_farm_info_url
7071
from packit_service.utils import (
7172
get_packit_commands_from_comment,
7273
)
@@ -920,6 +921,7 @@ def test_pr_test_command_handler_retries(
920921
"https://api.dev.testing-farm.io/v0.1/"
921922
)
922923
ServiceConfig.get_service_config().testing_farm_secret = "secret-token"
924+
urls.DASHBOARD_URL = "https://dashboard.localhost"
923925

924926
flexmock(LocalProject, refresh_the_arguments=lambda: None)
925927
flexmock(Allowlist, check_and_report=True)
@@ -1004,7 +1006,7 @@ def test_pr_test_command_handler_retries(
10041006
state=BaseCommitStatus.running,
10051007
description="Submitting the tests ...",
10061008
check_name="testing-farm:fedora-rawhide-x86_64",
1007-
url="",
1009+
url=get_testing_farm_info_url(1),
10081010
markdown_content=None,
10091011
links_to_external_services=None,
10101012
).once()
@@ -1036,11 +1038,11 @@ def test_pr_test_command_handler_retries(
10361038
if retry_number == 2:
10371039
flexmock(test_run).should_receive("set_status").with_args(
10381040
TestingFarmResult.error,
1039-
)
1041+
).once()
10401042
else:
10411043
flexmock(test_run).should_receive("set_status").with_args(
10421044
TestingFarmResult.retry,
1043-
)
1045+
).once()
10441046

10451047
flexmock(StatusReporterGithubChecks).should_receive("set_status").with_args(
10461048
state=status,
@@ -1209,7 +1211,7 @@ def test_pr_test_command_handler_skip_build_option(
12091211
state=BaseCommitStatus.running,
12101212
description="Submitting the tests ...",
12111213
check_names="testing-farm:fedora-rawhide-x86_64",
1212-
url="",
1214+
url=get_testing_farm_info_url(5),
12131215
markdown_content=None,
12141216
links_to_external_services=None,
12151217
update_feedback_time=object,
@@ -1354,7 +1356,7 @@ def test_pr_test_command_handler_compose_not_present(
13541356
state=BaseCommitStatus.running,
13551357
description="Submitting the tests ...",
13561358
check_names="testing-farm:fedora-rawhide-x86_64",
1357-
url="",
1359+
url=get_testing_farm_info_url(1),
13581360
markdown_content=None,
13591361
links_to_external_services=None,
13601362
update_feedback_time=object,
@@ -1482,7 +1484,7 @@ def test_pr_test_command_handler_composes_not_available(
14821484
state=BaseCommitStatus.running,
14831485
description="Submitting the tests ...",
14841486
check_names="testing-farm:fedora-rawhide-x86_64",
1485-
url="",
1487+
url=get_testing_farm_info_url(1),
14861488
markdown_content=None,
14871489
links_to_external_services=None,
14881490
update_feedback_time=object,
@@ -1912,7 +1914,7 @@ def test_pr_test_command_handler_skip_build_option_no_fmf_metadata(
19121914
state=BaseCommitStatus.running,
19131915
description="Submitting the tests ...",
19141916
check_names="testing-farm:fedora-rawhide-x86_64",
1915-
url="",
1917+
url=get_testing_farm_info_url(1),
19161918
markdown_content=None,
19171919
links_to_external_services=None,
19181920
update_feedback_time=object,
@@ -2192,7 +2194,7 @@ def test_pr_test_command_handler_multiple_builds(
21922194
state=BaseCommitStatus.running,
21932195
description="Build succeeded. Submitting the tests ...",
21942196
check_names="testing-farm:fedora-rawhide-x86_64",
2195-
url="",
2197+
url=get_testing_farm_info_url(5),
21962198
markdown_content=None,
21972199
links_to_external_services=None,
21982200
update_feedback_time=object,

0 commit comments

Comments
 (0)