mirror of
https://github.com/moby/buildkit.git
synced 2026-08-08 08:40:45 +00:00
Render parsed source identifiers back to their canonical SourceOp form before source policy evaluation. This lets Git subdir cleanup use the existing source parser and avoids policy-specific Git parsing. Add String methods for source identifiers and cover them with unit tests, plus a client integration regression for canonical Git subdir policy matching. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
20 lines
524 B
Go
20 lines
524 B
Go
package containerimage
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestImageIdentifierString(t *testing.T) {
|
|
id, err := NewImageIdentifier("docker.io/library/busybox:latest")
|
|
require.NoError(t, err)
|
|
require.Equal(t, "docker-image://docker.io/library/busybox:latest", id.String())
|
|
}
|
|
|
|
func TestOCIIdentifierString(t *testing.T) {
|
|
id, err := NewOCIIdentifier("example.com/repo/layout:latest")
|
|
require.NoError(t, err)
|
|
require.Equal(t, "oci-layout://example.com/repo/layout:latest", id.String())
|
|
}
|