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