diff --git a/pkg/test/utils.go b/pkg/test/utils.go index 5603fd0ae..b27bdbbab 100644 --- a/pkg/test/utils.go +++ b/pkg/test/utils.go @@ -3,6 +3,7 @@ package test import ( "fmt" "os/exec" + "regexp" "strings" "testing" @@ -43,3 +44,15 @@ func CreateMockCommand(t *testing.T, swappers []*CommandSwapper) func(cmd string return command } } + +func AssertContainsMatch(t *testing.T, strs []string, pattern *regexp.Regexp, message string) { + t.Helper() + + for _, str := range strs { + if pattern.Match([]byte(str)) { + return + } + } + + assert.Fail(t, message) +}