diff --git a/cmd/otk-resolve-containers/main_test.go b/cmd/otk-resolve-containers/main_test.go index eef001e1e5..a62d341e65 100644 --- a/cmd/otk-resolve-containers/main_test.go +++ b/cmd/otk-resolve-containers/main_test.go @@ -18,12 +18,6 @@ import ( resolver "github.com/osbuild/images/cmd/otk-resolve-containers" ) -const rootLayer = `H4sIAAAJbogA/+SWUYqDMBCG53lP4V5g9x8dzRX2Bvtc0VIhEIhKe/wSKxgU6ktjC/O9hMzAQDL8 -/8yltdb9DLeB0gEGKhHCg/UJsBAL54zKFBAC54ZzyrCUSMfYDydPgHfu6R/s5VePilOfzF/of/bv -vG2+lqhyFNGPddP53yjyegCBKcuNROZ77AmBoP+CmbIyqpEM5fqf+3/ubJtsCuz7P1b+L1Du/4f5 -v+vrsVPu/Vq9P3ANk//d+x/MZv8TKNf/Qfqf9v9v5fLXK3/lKEc5ypm4AwAA//8DAE6E6nIAEgAA -` - const ( owner = "osbuild" reponame = "testcontainer" @@ -39,7 +33,7 @@ func createTestRegistry() (*testregistry.Registry, []string) { refs := make([]string, 10) for idx := 0; idx < len(refs); idx++ { checksum := repo.AddImage( - []testregistry.Blob{testregistry.NewDataBlobFromBase64(rootLayer)}, + []testregistry.Blob{testregistry.NewDataBlobFromBase64(testregistry.RootLayer)}, []string{"amd64", "ppc64le"}, fmt.Sprintf("image %d", idx), time.Time{}) diff --git a/internal/testregistry/testregistry.go b/internal/testregistry/testregistry.go index abc9205cde..e1ef065934 100644 --- a/internal/testregistry/testregistry.go +++ b/internal/testregistry/testregistry.go @@ -22,6 +22,22 @@ import ( "github.com/osbuild/images/pkg/container" ) +/* +A base64 encoded gzipped tarball with the following contents: + + -rw-r--r-- root/root 12 2021-09-17 12:32 hello.txt (Contents: "Hello World") + drwxr-xr-x root/root 0 1970-01-01 01:00 subdir/ + -rw-r--r-- root/root 8 2021-09-17 12:32 subdir/file.txt (Contents: "osbuild") + -rw-r--r-- root/root 7 2021-09-17 12:32 world.txt (Contents: "hello!") + +Can be used with [NewDataBlobFromBase64] to create a data blob for [Repo.AddImage]. +*/ +const RootLayer = `H4sIAAAJbogA/+SWUYqDMBCG53lP4V5g9x8dzRX2Bvtc0VIhEIhKe/wSKxgU6ktjC/O9hMzAQDL8 +/8yltdb9DLeB0gEGKhHCg/UJsBAL54zKFBAC54ZzyrCUSMfYDydPgHfu6R/s5VePilOfzF/of/bv +vG2+lqhyFNGPddP53yjyegCBKcuNROZ77AmBoP+CmbIyqpEM5fqf+3/ubJtsCuz7P1b+L1Du/4f5 +v+vrsVPu/Vq9P3ANk//d+x/MZv8TKNf/Qfqf9v9v5fLXK3/lKEc5ypm4AwAA//8DAE6E6nIAEgAA +` + // The following code implements a toy container registry to test with // Blob interface diff --git a/pkg/container/client_test.go b/pkg/container/client_test.go index 678a963859..0db80f3c4f 100644 --- a/pkg/container/client_test.go +++ b/pkg/container/client_test.go @@ -22,7 +22,7 @@ func TestClientResolve(t *testing.T) { repo := registry.AddRepo("library/osbuild") listDigest := repo.AddImage( - []testregistry.Blob{testregistry.NewDataBlobFromBase64(rootLayer)}, + []testregistry.Blob{testregistry.NewDataBlobFromBase64(testregistry.RootLayer)}, []string{"amd64", "ppc64le"}, "cool container", time.Time{}) diff --git a/pkg/container/resolver_test.go b/pkg/container/resolver_test.go index b14d2d2cb8..6f1fd2fecd 100644 --- a/pkg/container/resolver_test.go +++ b/pkg/container/resolver_test.go @@ -17,12 +17,6 @@ import ( "github.com/osbuild/images/pkg/container" ) -const rootLayer = `H4sIAAAJbogA/+SWUYqDMBCG53lP4V5g9x8dzRX2Bvtc0VIhEIhKe/wSKxgU6ktjC/O9hMzAQDL8 -/8yltdb9DLeB0gEGKhHCg/UJsBAL54zKFBAC54ZzyrCUSMfYDydPgHfu6R/s5VePilOfzF/of/bv -vG2+lqhyFNGPddP53yjyegCBKcuNROZ77AmBoP+CmbIyqpEM5fqf+3/ubJtsCuz7P1b+L1Du/4f5 -v+vrsVPu/Vq9P3ANk//d+x/MZv8TKNf/Qfqf9v9v5fLXK3/lKEc5ypm4AwAA//8DAE6E6nIAEgAA -` - var forceLocal = flag.Bool( "force-local-resolver", false, @@ -39,7 +33,7 @@ func TestResolver(t *testing.T) { refs := make([]string, 10) for i := 0; i < len(refs); i++ { checksum := repo.AddImage( - []testregistry.Blob{testregistry.NewDataBlobFromBase64(rootLayer)}, + []testregistry.Blob{testregistry.NewDataBlobFromBase64(testregistry.RootLayer)}, []string{"amd64", "ppc64le"}, fmt.Sprintf("image %d", i), time.Time{})