e2e/cli-plugins: use regexp.Compile to prevent panic in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
1ed3859879
commit
56c2fa6c0e
@ -42,7 +42,8 @@ func TestGlobalHelp(t *testing.T) {
|
|||||||
`Invalid Plugins:`,
|
`Invalid Plugins:`,
|
||||||
`\s+badmeta\s+invalid metadata: invalid character 'i' looking for beginning of object key string`,
|
`\s+badmeta\s+invalid metadata: invalid character 'i' looking for beginning of object key string`,
|
||||||
} {
|
} {
|
||||||
expected := regexp.MustCompile(`(?m)^` + s + `$`)
|
expected, err := regexp.Compile(`(?m)^` + s + `$`)
|
||||||
|
assert.NilError(t, err)
|
||||||
matches := expected.FindAllString(output, -1)
|
matches := expected.FindAllString(output, -1)
|
||||||
assert.Equal(t, len(matches), 1, "Did not find expected number of matches for %q in `docker help` output", expected)
|
assert.Equal(t, len(matches), 1, "Did not find expected number of matches for %q in `docker help` output", expected)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user