@@ -814,22 +814,25 @@ func (s *testSuite) TestGetInputArguments() {
814814
815815func (s * testSuite ) TestComputePolicyArguments () {
816816 cases := []struct {
817- name string
818- inputs []* v12.PolicyInput
819- args map [string ]string
820- bindings map [string ]string
821- expected map [string ]string
822- expectErr bool
823- errMsg string
817+ name string
818+ policyName string
819+ inputs []* v12.PolicyInput
820+ args map [string ]string
821+ bindings map [string ]string
822+ expected map [string ]string
823+ expectErr bool
824+ errMsg string
824825 }{
825826 {
826- name : "all args passed when no inputs present" ,
827- inputs : nil ,
828- args : map [string ]string {"arg1" : "value1" , "arg2" : "value2" },
829- expected : map [string ]string {"arg1" : "value1" , "arg2" : "value2" },
827+ name : "all args passed when no inputs present" ,
828+ policyName : "test-policy" ,
829+ inputs : nil ,
830+ args : map [string ]string {"arg1" : "value1" , "arg2" : "value2" },
831+ expected : map [string ]string {"arg1" : "value1" , "arg2" : "value2" },
830832 },
831833 {
832- name : "required inputs" ,
834+ name : "required inputs" ,
835+ policyName : "test-policy" ,
833836 inputs : []* v12.PolicyInput {{
834837 Name : "arg1" ,
835838 Required : true ,
@@ -839,7 +842,8 @@ func (s *testSuite) TestComputePolicyArguments() {
839842 errMsg : "missing required input \" arg1\" " ,
840843 },
841844 {
842- name : "default values are set" ,
845+ name : "default values are set" ,
846+ policyName : "test-policy" ,
843847 inputs : []* v12.PolicyInput {{
844848 Name : "arg1" ,
845849 Default : "value1" ,
@@ -851,7 +855,8 @@ func (s *testSuite) TestComputePolicyArguments() {
851855 expected : map [string ]string {"arg1" : "value1" , "arg2" : "value2" },
852856 },
853857 {
854- name : "unexpected arguments are ignored" ,
858+ name : "unexpected arguments are ignored" ,
859+ policyName : "test-policy" ,
855860 inputs : []* v12.PolicyInput {{
856861 Name : "arg1" ,
857862 Default : "value1" ,
@@ -862,7 +867,8 @@ func (s *testSuite) TestComputePolicyArguments() {
862867 expected : map [string ]string {"arg1" : "value1" },
863868 },
864869 {
865- name : "expected arguments with values are respected" ,
870+ name : "expected arguments with values are respected" ,
871+ policyName : "test-policy" ,
866872 inputs : []* v12.PolicyInput {{
867873 Name : "arg1" ,
868874 Default : "value1" ,
@@ -873,7 +879,8 @@ func (s *testSuite) TestComputePolicyArguments() {
873879 expected : map [string ]string {"arg1" : "value1" , "arg2" : "value2" },
874880 },
875881 {
876- name : "simple bindings" ,
882+ name : "simple bindings" ,
883+ policyName : "test-policy" ,
877884 inputs : []* v12.PolicyInput {{
878885 Name : "arg1" ,
879886 }},
@@ -882,7 +889,8 @@ func (s *testSuite) TestComputePolicyArguments() {
882889 expected : map [string ]string {"arg1" : "Hello world" },
883890 },
884891 {
885- name : "multiple bindings" ,
892+ name : "multiple bindings" ,
893+ policyName : "test-policy" ,
886894 inputs : []* v12.PolicyInput {{
887895 Name : "arg1" ,
888896 }, {
@@ -893,7 +901,8 @@ func (s *testSuite) TestComputePolicyArguments() {
893901 expected : map [string ]string {"arg1" : "Hello world template" , "arg2" : "Bye template" },
894902 },
895903 {
896- name : "no variable found in bindings, renders zero value" ,
904+ name : "no variable found in bindings, renders zero value" ,
905+ policyName : "test-policy" ,
897906 inputs : []* v12.PolicyInput {{
898907 Name : "arg1" ,
899908 }},
@@ -902,7 +911,8 @@ func (s *testSuite) TestComputePolicyArguments() {
902911 expected : map [string ]string {"arg1" : "Hello " },
903912 },
904913 {
905- name : "no interpolation needed" ,
914+ name : "no interpolation needed" ,
915+ policyName : "test-policy" ,
906916 inputs : []* v12.PolicyInput {{
907917 Name : "arg1" ,
908918 }},
@@ -911,7 +921,8 @@ func (s *testSuite) TestComputePolicyArguments() {
911921 expected : map [string ]string {"arg1" : "Hello world" },
912922 },
913923 {
914- name : "required and default is illegal" ,
924+ name : "required and default is illegal" ,
925+ policyName : "test-policy" ,
915926 inputs : []* v12.PolicyInput {{
916927 Name : "arg1" ,
917928 Required : true ,
@@ -922,7 +933,8 @@ func (s *testSuite) TestComputePolicyArguments() {
922933 errMsg : "input arg1 can not be required and have a default at the same time" ,
923934 },
924935 {
925- name : "inputs prefix without dot" ,
936+ name : "inputs prefix without dot" ,
937+ policyName : "test-policy" ,
926938 inputs : []* v12.PolicyInput {{
927939 Name : "arg1" ,
928940 }, {
@@ -933,7 +945,8 @@ func (s *testSuite) TestComputePolicyArguments() {
933945 expected : map [string ]string {"arg1" : "Hello world template" , "arg2" : "Bye template" },
934946 },
935947 {
936- name : "required input with missing binding" ,
948+ name : "required input with missing binding" ,
949+ policyName : "test-policy" ,
937950 inputs : []* v12.PolicyInput {{
938951 Name : "arg1" ,
939952 Required : true ,
@@ -945,7 +958,7 @@ func (s *testSuite) TestComputePolicyArguments() {
945958
946959 for _ , tc := range cases {
947960 s .Run (tc .name , func () {
948- computed , err := ComputeArguments (tc .inputs , tc .args , tc .bindings , & s .logger )
961+ computed , err := ComputeArguments (tc .policyName , tc . inputs , tc .args , tc .bindings , & s .logger )
949962 if tc .expectErr {
950963 s .Error (err )
951964 s .Contains (err .Error (), tc .errMsg )
0 commit comments