@@ -2676,38 +2676,46 @@ def test_koji_build_end_downstream(
26762676 koji_build_pr_downstream .should_receive ("set_status" ).with_args ("success" ).once ()
26772677 koji_build_pr_downstream .should_receive ("set_build_logs_urls" )
26782678 koji_build_pr_downstream .should_receive ("set_web_url" )
2679- common_payload_no_compose = {
2680- "environments" : [
2681- {
2682- "arch" : "x86_64" ,
2683- "variables" : {
2684- "KOJI_TASK_ID" : "1" ,
2685- },
2686- "artifacts" : [
2687- {
2688- "id" : "1" ,
2689- "type" : "fedora-koji-build" ,
2679+
2680+ def _common_payload (* , with_compose : bool , with_artifact : bool ):
2681+ _payload = {
2682+ "environments" : [
2683+ {
2684+ "arch" : "x86_64" ,
2685+ "variables" : {
2686+ "KOJI_TASK_ID" : "1" ,
26902687 },
2691- ],
2692- "tmt" : {
2693- "context" : {
2694- "distro" : distro ,
2695- "arch" : "x86_64" ,
2696- "trigger" : "commit" ,
2697- "initiator" : "fedora-ci" ,
2698- "dist-git-branch" : "rawhide" ,
2699- ** extra_context ,
2688+ "artifacts" : [],
2689+ "tmt" : {
2690+ "context" : {
2691+ "distro" : distro ,
2692+ "arch" : "x86_64" ,
2693+ "trigger" : "commit" ,
2694+ "initiator" : "fedora-ci" ,
2695+ "dist-git-branch" : "rawhide" ,
2696+ ** extra_context ,
2697+ },
27002698 },
27012699 },
2700+ ],
2701+ "notification" : {
2702+ "webhook" : {
2703+ "url" : "https://stg.packit.dev/api/testing-farm/results" ,
2704+ "token" : "secret token" ,
2705+ },
27022706 },
2703- ],
2704- "notification" : {
2705- "webhook" : {
2706- "url" : "https://stg.packit.dev/api/testing-farm/results" ,
2707- "token" : "secret token" ,
2708- },
2709- },
2710- }
2707+ }
2708+ assert isinstance (_payload ["environments" ], list ) # narrow type
2709+ if with_artifact :
2710+ _payload ["environments" ][0 ]["artifacts" ] = [
2711+ {
2712+ "id" : "1" ,
2713+ "type" : "fedora-koji-build" ,
2714+ }
2715+ ]
2716+ if with_compose :
2717+ _payload ["environments" ][0 ]["os" ] = {"compose" : compose }
2718+ return _payload
27112719
27122720 installability_repo = "https://github.com/fedora-ci/installability-pipeline.git"
27132721 payload_installability = {
@@ -2717,10 +2725,8 @@ def test_koji_build_end_downstream(
27172725 "ref" : "master" ,
27182726 },
27192727 },
2720- ** common_payload_no_compose ,
2728+ ** _common_payload ( with_compose = True , with_artifact = False ) ,
27212729 }
2722- payload_installability = copy .deepcopy (payload_installability )
2723- payload_installability ["environments" ][0 ]["os" ] = {"compose" : compose }
27242730
27252731 rpminspect_repo = "https://github.com/fedora-ci/rpminspect-pipeline.git"
27262732 payload_rpminspect = {
@@ -2730,7 +2736,7 @@ def test_koji_build_end_downstream(
27302736 "ref" : "master" ,
27312737 },
27322738 },
2733- ** common_payload_no_compose ,
2739+ ** _common_payload ( with_compose = False , with_artifact = False ) ,
27342740 }
27352741
27362742 rpmlint_repo = "https://github.com/packit/tmt-plans.git"
@@ -2743,7 +2749,7 @@ def test_koji_build_end_downstream(
27432749 "name" : "/plans/rpmlint" ,
27442750 },
27452751 },
2746- ** common_payload_no_compose ,
2752+ ** _common_payload ( with_compose = False , with_artifact = False ) ,
27472753 }
27482754
27492755 shared_tests_repo = "https://forge.fedoraproject.org/ci/shared-tests"
@@ -2756,7 +2762,7 @@ def test_koji_build_end_downstream(
27562762 "name" : "/rmdepcheck" ,
27572763 },
27582764 },
2759- ** common_payload_no_compose ,
2765+ ** _common_payload ( with_compose = False , with_artifact = False ) ,
27602766 }
27612767
27622768 payload_license_validate = {
@@ -2767,7 +2773,7 @@ def test_koji_build_end_downstream(
27672773 "name" : "/license-validate" ,
27682774 },
27692775 },
2770- ** common_payload_no_compose ,
2776+ ** _common_payload ( with_compose = False , with_artifact = False ) ,
27712777 }
27722778
27732779 payload_custom = {
@@ -2777,37 +2783,7 @@ def test_koji_build_end_downstream(
27772783 "ref" : "0011223344" ,
27782784 },
27792785 },
2780- "environments" : [
2781- {
2782- "arch" : "x86_64" ,
2783- "os" : {"compose" : compose },
2784- "variables" : {
2785- "KOJI_TASK_ID" : "1" ,
2786- },
2787- "artifacts" : [
2788- {
2789- "id" : "1" ,
2790- "type" : "fedora-koji-build" ,
2791- },
2792- ],
2793- "tmt" : {
2794- "context" : {
2795- "distro" : distro ,
2796- "arch" : "x86_64" ,
2797- "trigger" : "commit" ,
2798- "initiator" : "fedora-ci" ,
2799- "dist-git-branch" : "rawhide" ,
2800- ** extra_context ,
2801- },
2802- },
2803- },
2804- ],
2805- "notification" : {
2806- "webhook" : {
2807- "url" : "https://stg.packit.dev/api/testing-farm/results" ,
2808- "token" : "secret token" ,
2809- },
2810- },
2786+ ** _common_payload (with_compose = True , with_artifact = True ),
28112787 }
28122788
28132789 flexmock (aliases ).should_receive ("get_aliases" ).and_return ({"fedora-all" : [], "epel-all" : []})
0 commit comments