1
0
mirror of https://github.com/docker/cli.git synced 2025-04-18 19:24:03 +03:00

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:
Sebastiaan van Stijn 2025-04-10 11:47:53 +02:00
parent 1ed3859879
commit 56c2fa6c0e
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -42,7 +42,8 @@ func TestGlobalHelp(t *testing.T) {
`Invalid Plugins:`,
`\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)
assert.Equal(t, len(matches), 1, "Did not find expected number of matches for %q in `docker help` output", expected)
}