@@ -184,22 +184,22 @@ func TestHelmNICTemplateNegative(t *testing.T) {
184184expectedErrorMsgs : []string {"missing properties 'port', 'path'" , "port is required" },
185185},
186186"globalConfigInvalidFormat" : {
187- valuesFile : "testdata/global-config-invalid-format.yaml" ,
188- releaseName : "global-config-invalid-format" ,
189- namespace : "default" ,
190- expectedErrorMsg : "globalConfiguration.customName must contain exactly one '/' separator" ,
187+ valuesFile : "testdata/global-config-invalid-format.yaml" ,
188+ releaseName : "global-config-invalid-format" ,
189+ namespace : "default" ,
190+ expectedErrorMsgs : [] string { "globalConfiguration.customName must contain exactly one '/' separator" } ,
191191},
192192"globalConfigMultipleSlashes" : {
193- valuesFile : "testdata/global-config-multiple-slashes.yaml" ,
194- releaseName : "global-config-multiple-slashes" ,
195- namespace : "default" ,
196- expectedErrorMsg : "globalConfiguration.customName must contain exactly one '/' separator" ,
193+ valuesFile : "testdata/global-config-multiple-slashes.yaml" ,
194+ releaseName : "global-config-multiple-slashes" ,
195+ namespace : "default" ,
196+ expectedErrorMsgs : [] string { "globalConfiguration.customName must contain exactly one '/' separator" } ,
197197},
198198"globalConfigEmptyName" : {
199- valuesFile : "testdata/global-config-empty-name.yaml" ,
200- releaseName : "global-config-empty-name" ,
201- namespace : "default" ,
202- expectedErrorMsg : "globalConfiguration.customName namespace and name parts cannot be empty" ,
199+ valuesFile : "testdata/global-config-empty-name.yaml" ,
200+ releaseName : "global-config-empty-name" ,
201+ namespace : "default" ,
202+ expectedErrorMsgs : [] string { "globalConfiguration.customName namespace and name parts cannot be empty" } ,
203203},
204204}
205205
@@ -224,11 +224,19 @@ func TestHelmNICTemplateNegative(t *testing.T) {
224224t .Fatalf ("Expected helm template to fail for invalid configuration, but it succeeded" )
225225}
226226
227+ << << << < HEAD
227228errMsg := err .Error ()
228229for _ , expected := range tc .expectedErrorMsgs {
229230if strings .Contains (errMsg , expected ) {
230231t .Logf ("Expected failure occurred: %s" , errMsg )
231232return
233+ == == == =
234+ if len (tc .expectedErrorMsgs ) > 0 {
235+ for _ , expectedMsg := range tc .expectedErrorMsgs {
236+ if ! strings .Contains (err .Error (), expectedMsg ) {
237+ t .Fatalf ("Expected error to contain '%s', but got: %s" , expectedMsg , err .Error ())
238+ }
239+ >> >> >> > c8cf19e89 (fixing copilot mentioned error )
232240}
233241}
234242
0 commit comments