mirror of
https://github.com/containers/podman.git
synced 2025-08-26 21:20:17 +08:00

improve the regex to match only at the beginning of the line. It prevents matching "Copying %s $CHECKSUM" messages returned by the containers/image copy process. Closes: https://github.com/containers/podman/issues/10233 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
18 lines
503 B
Go
18 lines
503 B
Go
package images
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestBuildMatchIID(t *testing.T) {
|
|
assert.True(t, iidRegex.MatchString("a883dafc480d466ee04e0d6da986bd78eb1fdd2178d04693723da3a8f95d42f4"))
|
|
assert.True(t, iidRegex.MatchString("3da3a8f95d42"))
|
|
assert.False(t, iidRegex.MatchString("3da3"))
|
|
}
|
|
|
|
func TestBuildNotMatchStatusMessage(t *testing.T) {
|
|
assert.False(t, iidRegex.MatchString("Copying config a883dafc480d466ee04e0d6da986bd78eb1fdd2178d04693723da3a8f95d42f4"))
|
|
}
|