Simplify TestRead
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
|||||||
pb "github.com/docker/buildx/controller/pb"
|
pb "github.com/docker/buildx/controller/pb"
|
||||||
"github.com/moby/buildkit/client"
|
"github.com/moby/buildkit/client"
|
||||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||||
|
"github.com/pulumi/pulumi-go-provider/infer"
|
||||||
"github.com/regclient/regclient/types/descriptor"
|
"github.com/regclient/regclient/types/descriptor"
|
||||||
"github.com/regclient/regclient/types/platform"
|
"github.com/regclient/regclient/types/platform"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@@ -390,27 +391,21 @@ func TestRead(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
s := newServer(t.Context(), t, client)
|
i := &Image{docker: client}
|
||||||
err := s.Configure(provider.ConfigureRequest{})
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
resp, err := s.Read(provider.ReadRequest{
|
resp, err := i.Read(t.Context(), infer.ReadRequest[ImageArgs, ImageState]{
|
||||||
ID: "my-image",
|
ID: "my-image",
|
||||||
Urn: _fakeURN,
|
State: ImageState{
|
||||||
Properties: property.NewMap(map[string]property.Value{
|
ImageArgs: ImageArgs{
|
||||||
"exports": property.New([]property.Value{
|
Exports: []Export{{Raw: "type=registry"}},
|
||||||
property.New(map[string]property.Value{
|
Tags: []string{tag},
|
||||||
"raw": property.New("type=registry"),
|
},
|
||||||
}),
|
Digest: digest,
|
||||||
}),
|
},
|
||||||
"tags": property.New([]property.Value{
|
|
||||||
property.New(tag),
|
|
||||||
}),
|
|
||||||
"digest": property.New(digest),
|
|
||||||
}),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.NotNil(t, resp.Properties.Get("exports").AsArray().Get(0).AsMap().Get("manifest"))
|
assert.Equal(t, []string{tag}, resp.State.Tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestImageDiff(t *testing.T) {
|
func TestImageDiff(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user