@@ -303,6 +303,74 @@ func Test_textAnalyze(t *testing.T) {
303303 "text-collector-2/cfile-3.txt" : []byte ("Yes it all succeeded" ),
304304 },
305305 },
306+ {
307+ name : "case insensitive failure case 1" , // regexes are not case insensitive by default
308+ analyzer : troubleshootv1beta2.TextAnalyze {
309+ Outcomes : []* troubleshootv1beta2.Outcome {
310+ {
311+ Pass : & troubleshootv1beta2.SingleOutcome {
312+ Message : "pass" ,
313+ },
314+ },
315+ {
316+ Fail : & troubleshootv1beta2.SingleOutcome {
317+ Message : "fail" ,
318+ },
319+ },
320+ },
321+ CollectorName : "text-collector-1" ,
322+ FileName : "cfile-1.txt" ,
323+ RegexPattern : "succeeded" ,
324+ },
325+ expectResult : []AnalyzeResult {
326+ {
327+ IsPass : false ,
328+ IsWarn : false ,
329+ IsFail : true ,
330+ Title : "text-collector-1" ,
331+ Message : "fail" ,
332+ IconKey : "kubernetes_text_analyze" ,
333+ IconURI : "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg" ,
334+ },
335+ },
336+ files : map [string ][]byte {
337+ "text-collector-1/cfile-1.txt" : []byte ("Yes it all SUCCEEDED" ),
338+ },
339+ },
340+ {
341+ name : "case insensitive success case 1" ,
342+ analyzer : troubleshootv1beta2.TextAnalyze {
343+ Outcomes : []* troubleshootv1beta2.Outcome {
344+ {
345+ Pass : & troubleshootv1beta2.SingleOutcome {
346+ Message : "pass" ,
347+ },
348+ },
349+ {
350+ Fail : & troubleshootv1beta2.SingleOutcome {
351+ Message : "fail" ,
352+ },
353+ },
354+ },
355+ CollectorName : "text-collector-1" ,
356+ FileName : "cfile-1.txt" ,
357+ RegexPattern : "(?i)succeeded" ,
358+ },
359+ expectResult : []AnalyzeResult {
360+ {
361+ IsPass : true ,
362+ IsWarn : false ,
363+ IsFail : false ,
364+ Title : "text-collector-1" ,
365+ Message : "pass" ,
366+ IconKey : "kubernetes_text_analyze" ,
367+ IconURI : "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg" ,
368+ },
369+ },
370+ files : map [string ][]byte {
371+ "text-collector-1/cfile-1.txt" : []byte ("Yes it all SUCCEEDED" ),
372+ },
373+ },
306374 }
307375
308376 for _ , test := range tests {
0 commit comments