@@ -2744,15 +2744,122 @@ func TestPipelineRunState_GetChildReferences(t *testing.T) {
27442744 }},
27452745 }},
27462746 },
2747+ {
2748+ name : "unresolved-matrixed-custom-task" ,
2749+ state : PipelineRunState {{
2750+ PipelineTask : & v1beta1.PipelineTask {
2751+ Name : "matrixed-task" ,
2752+ TaskRef : & v1beta1.TaskRef {
2753+ Kind : "Example" ,
2754+ APIVersion : "example.dev/v0" ,
2755+ },
2756+ WhenExpressions : []v1beta1.WhenExpression {{
2757+ Input : "foo" ,
2758+ Operator : selection .In ,
2759+ Values : []string {"foo" , "bar" },
2760+ }},
2761+ Matrix : []v1beta1.Param {{
2762+ Name : "foobar" ,
2763+ Value : v1beta1.ArrayOrString {Type : v1beta1 .ParamTypeArray , ArrayVal : []string {"foo" , "bar" }},
2764+ }, {
2765+ Name : "quxbaz" ,
2766+ Value : v1beta1.ArrayOrString {Type : v1beta1 .ParamTypeArray , ArrayVal : []string {"qux" , "baz" }},
2767+ }},
2768+ },
2769+ CustomTask : true ,
2770+ }},
2771+ childRefs : nil ,
2772+ },
2773+ {
2774+ name : "matrixed-custom-task" ,
2775+ state : PipelineRunState {{
2776+ PipelineTask : & v1beta1.PipelineTask {
2777+ Name : "matrixed-task" ,
2778+ TaskRef : & v1beta1.TaskRef {
2779+ APIVersion : "example.dev/v0" ,
2780+ Kind : "Example" ,
2781+ },
2782+ WhenExpressions : []v1beta1.WhenExpression {{
2783+ Input : "foo" ,
2784+ Operator : selection .In ,
2785+ Values : []string {"foo" , "bar" },
2786+ }},
2787+ Matrix : []v1beta1.Param {{
2788+ Name : "foobar" ,
2789+ Value : v1beta1.ArrayOrString {Type : v1beta1 .ParamTypeArray , ArrayVal : []string {"foo" , "bar" }},
2790+ }, {
2791+ Name : "quxbaz" ,
2792+ Value : v1beta1.ArrayOrString {Type : v1beta1 .ParamTypeArray , ArrayVal : []string {"qux" , "baz" }},
2793+ }},
2794+ },
2795+ CustomTask : true ,
2796+ Runs : []* v1alpha1.Run {{
2797+ ObjectMeta : metav1.ObjectMeta {Name : "matrixed-run-0" },
2798+ }, {
2799+ ObjectMeta : metav1.ObjectMeta {Name : "matrixed-run-1" },
2800+ }, {
2801+ ObjectMeta : metav1.ObjectMeta {Name : "matrixed-run-2" },
2802+ }, {
2803+ ObjectMeta : metav1.ObjectMeta {Name : "matrixed-run-3" },
2804+ }},
2805+ }},
2806+ childRefs : []v1beta1.ChildStatusReference {{
2807+ TypeMeta : runtime.TypeMeta {
2808+ APIVersion : "tekton.dev/v1alpha1" ,
2809+ Kind : "Run" ,
2810+ },
2811+ Name : "matrixed-task-run-0" ,
2812+ PipelineTaskName : "matrixed-task" ,
2813+ WhenExpressions : []v1beta1.WhenExpression {{
2814+ Input : "foo" ,
2815+ Operator : selection .In ,
2816+ Values : []string {"foo" , "bar" },
2817+ }},
2818+ }, {
2819+ TypeMeta : runtime.TypeMeta {
2820+ APIVersion : "tekton.dev/v1alpha1" ,
2821+ Kind : "Run" ,
2822+ },
2823+ Name : "matrixed-task-run-1" ,
2824+ PipelineTaskName : "matrixed-task" ,
2825+ WhenExpressions : []v1beta1.WhenExpression {{
2826+ Input : "foo" ,
2827+ Operator : selection .In ,
2828+ Values : []string {"foo" , "bar" },
2829+ }},
2830+ }, {
2831+ TypeMeta : runtime.TypeMeta {
2832+ APIVersion : "tekton.dev/v1alpha1" ,
2833+ Kind : "Run" ,
2834+ },
2835+ Name : "matrixed-task-run-2" ,
2836+ PipelineTaskName : "matrixed-task" ,
2837+ WhenExpressions : []v1beta1.WhenExpression {{
2838+ Input : "foo" ,
2839+ Operator : selection .In ,
2840+ Values : []string {"foo" , "bar" },
2841+ }},
2842+ }, {
2843+ TypeMeta : runtime.TypeMeta {
2844+ APIVersion : "tekton.dev/v1alpha1" ,
2845+ Kind : "Run" ,
2846+ },
2847+ Name : "matrixed-task-run-3" ,
2848+ PipelineTaskName : "matrixed-task" ,
2849+ WhenExpressions : []v1beta1.WhenExpression {{
2850+ Input : "foo" ,
2851+ Operator : selection .In ,
2852+ Values : []string {"foo" , "bar" },
2853+ }},
2854+ }},
2855+ },
27472856 }
2748-
27492857 for _ , tc := range testCases {
27502858 t .Run (tc .name , func (t * testing.T ) {
27512859 childRefs := tc .state .GetChildReferences ()
27522860 if d := cmp .Diff (tc .childRefs , childRefs ); d != "" {
27532861 t .Errorf ("Didn't get expected child references for %s: %s" , tc .name , diff .PrintWantGot (d ))
27542862 }
2755-
27562863 })
27572864 }
27582865}
0 commit comments