mirror of
https://github.com/moby/buildkit.git
synced 2026-08-09 01:01:08 +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
483 B
Go
20 lines
483 B
Go
package http
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestHTTPIdentifierString(t *testing.T) {
|
|
id, err := NewHTTPIdentifier("example.com/file.tar.gz", false)
|
|
require.NoError(t, err)
|
|
require.Equal(t, "http://example.com/file.tar.gz", id.String())
|
|
}
|
|
|
|
func TestHTTPSIdentifierString(t *testing.T) {
|
|
id, err := NewHTTPIdentifier("example.com/file.tar.gz", true)
|
|
require.NoError(t, err)
|
|
require.Equal(t, "https://example.com/file.tar.gz", id.String())
|
|
}
|