latest changes

This commit is contained in:
Bryce Lampe
2025-05-02 11:10:53 -07:00
parent d0b0f01ea3
commit a998be8014
7 changed files with 130 additions and 130 deletions

2
go.mod
View File

@@ -16,7 +16,7 @@ require (
github.com/otiai10/copy v1.14.0 github.com/otiai10/copy v1.14.0
github.com/pulumi/providertest v0.3.1 github.com/pulumi/providertest v0.3.1
github.com/pulumi/pulumi-dotnet/pulumi-language-dotnet v0.0.0-20241219213128-b19d8c8da35b github.com/pulumi/pulumi-dotnet/pulumi-language-dotnet v0.0.0-20241219213128-b19d8c8da35b
github.com/pulumi/pulumi-go-provider v0.25.1-0.20250430161409-af6aefddbb27 github.com/pulumi/pulumi-go-provider v0.25.1-0.20250501172612-76ede73bcfee
github.com/pulumi/pulumi-java/pkg v1.10.1-0.20250430211204-978569a2545c github.com/pulumi/pulumi-java/pkg v1.10.1-0.20250430211204-978569a2545c
github.com/pulumi/pulumi-yaml v1.17.0 github.com/pulumi/pulumi-yaml v1.17.0
github.com/pulumi/pulumi/pkg/v3 v3.165.0 github.com/pulumi/pulumi/pkg/v3 v3.165.0

4
go.sum
View File

@@ -950,8 +950,8 @@ github.com/pulumi/providertest v0.3.1 h1:vlftr7TZlObh81mL88IhhF0/9ZbLrZZos4NAvR4
github.com/pulumi/providertest v0.3.1/go.mod h1:fFHUP4/9DRyYnHWiRnwcynMtM/a7hHR/QcJfcuZKO3A= github.com/pulumi/providertest v0.3.1/go.mod h1:fFHUP4/9DRyYnHWiRnwcynMtM/a7hHR/QcJfcuZKO3A=
github.com/pulumi/pulumi-dotnet/pulumi-language-dotnet v0.0.0-20241219213128-b19d8c8da35b h1:pyYHkDsogl5q4dorkTKVk4/87l+fFUEIIVuwBqKJMHM= github.com/pulumi/pulumi-dotnet/pulumi-language-dotnet v0.0.0-20241219213128-b19d8c8da35b h1:pyYHkDsogl5q4dorkTKVk4/87l+fFUEIIVuwBqKJMHM=
github.com/pulumi/pulumi-dotnet/pulumi-language-dotnet v0.0.0-20241219213128-b19d8c8da35b/go.mod h1:5LjEUmPDpUyXzFbQCy3s1oFgeU9K3gVA6tX+xn1Xvbo= github.com/pulumi/pulumi-dotnet/pulumi-language-dotnet v0.0.0-20241219213128-b19d8c8da35b/go.mod h1:5LjEUmPDpUyXzFbQCy3s1oFgeU9K3gVA6tX+xn1Xvbo=
github.com/pulumi/pulumi-go-provider v0.25.1-0.20250430161409-af6aefddbb27 h1:a6Y6T66wAl+cGOBN/n0I/pWhbQCVq1BBWnQX0joiANE= github.com/pulumi/pulumi-go-provider v0.25.1-0.20250501172612-76ede73bcfee h1:W/TG5TuN0F0JRRtJ7e588T1nzDM6OZfQZpX1NP3FEds=
github.com/pulumi/pulumi-go-provider v0.25.1-0.20250430161409-af6aefddbb27/go.mod h1:4WYnu61f4I8EvmNzxftRtXznAfe7SdgtFMvxqoygGCg= github.com/pulumi/pulumi-go-provider v0.25.1-0.20250501172612-76ede73bcfee/go.mod h1:4WYnu61f4I8EvmNzxftRtXznAfe7SdgtFMvxqoygGCg=
github.com/pulumi/pulumi-java/pkg v1.10.1-0.20250430211204-978569a2545c h1:S0EGaFRWVXhVvRJ2cx3xb64Bzraga45tojsavqLsAHI= github.com/pulumi/pulumi-java/pkg v1.10.1-0.20250430211204-978569a2545c h1:S0EGaFRWVXhVvRJ2cx3xb64Bzraga45tojsavqLsAHI=
github.com/pulumi/pulumi-java/pkg v1.10.1-0.20250430211204-978569a2545c/go.mod h1:fE/A/3U2rpqpQKG0RrmmHjf0q+7shjsSfi74mhmLF6g= github.com/pulumi/pulumi-java/pkg v1.10.1-0.20250430211204-978569a2545c/go.mod h1:fE/A/3U2rpqpQKG0RrmmHjf0q+7shjsSfi74mhmLF6g=
github.com/pulumi/pulumi-yaml v1.17.0 h1:ebzggygqBcQrtmdBUqi28B1L/fAyHCFVIt0dS5re8Oc= github.com/pulumi/pulumi-yaml v1.17.0 h1:ebzggygqBcQrtmdBUqi28B1L/fAyHCFVIt0dS5re8Oc=

View File

@@ -784,7 +784,7 @@ func (i *Image) Update(
req infer.UpdateRequest[ImageArgs, ImageState], req infer.UpdateRequest[ImageArgs, ImageState],
) (infer.UpdateResponse[ImageState], error) { ) (infer.UpdateResponse[ImageState], error) {
resp, err := i.Create(ctx, resp, err := i.Create(ctx,
infer.CreateRequest[ImageArgs]{Name: req.ID, Inputs: req.News, Preview: req.Preview}, infer.CreateRequest[ImageArgs]{Name: req.ID, Inputs: req.Inputs, Preview: req.Preview},
) )
return infer.UpdateResponse[ImageState]{Output: resp.Output}, err return infer.UpdateResponse[ImageState]{Output: resp.Output}, err
} }
@@ -910,7 +910,7 @@ func (*Image) Diff(
_ context.Context, _ context.Context,
req infer.DiffRequest[ImageArgs, ImageState], req infer.DiffRequest[ImageArgs, ImageState],
) (provider.DiffResponse, error) { ) (provider.DiffResponse, error) {
olds, news := req.Olds, req.News olds, news := req.State, req.Inputs
diff := map[string]provider.PropertyDiff{} diff := map[string]provider.PropertyDiff{}
update := provider.PropertyDiff{Kind: provider.Update} update := provider.PropertyDiff{Kind: provider.Update}

View File

@@ -431,21 +431,21 @@ func TestImageDiff(t *testing.T) {
} }
tests := []struct { tests := []struct {
name string name string
olds func(*testing.T, ImageState) ImageState state func(*testing.T, ImageState) ImageState
news func(*testing.T, ImageArgs) ImageArgs inputs func(*testing.T, ImageArgs) ImageArgs
wantChanges bool wantChanges bool
}{ }{
{ {
name: "no diff if build context is unchanged", name: "no diff if build context is unchanged",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(*testing.T, ImageArgs) ImageArgs { return baseArgs }, inputs: func(*testing.T, ImageArgs) ImageArgs { return baseArgs },
wantChanges: false, wantChanges: false,
}, },
{ {
name: "no diff if registry password changes", name: "no diff if registry password changes",
olds: func(_ *testing.T, s ImageState) ImageState { state: func(_ *testing.T, s ImageState) ImageState {
s.Registries = []Registry{{ s.Registries = []Registry{{
Address: "foo", Address: "foo",
Username: "foo", Username: "foo",
@@ -453,7 +453,7 @@ func TestImageDiff(t *testing.T) {
}} }}
return s return s
}, },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Registries = []Registry{{ a.Registries = []Registry{{
Address: "foo", Address: "foo",
Username: "foo", Username: "foo",
@@ -465,11 +465,11 @@ func TestImageDiff(t *testing.T) {
}, },
{ {
name: "no diff if pull=true but no exports", name: "no diff if pull=true but no exports",
olds: func(_ *testing.T, is ImageState) ImageState { state: func(_ *testing.T, is ImageState) ImageState {
is.Pull = true is.Pull = true
return is return is
}, },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.Pull = true ia.Pull = true
return ia return ia
}, },
@@ -477,12 +477,12 @@ func TestImageDiff(t *testing.T) {
}, },
{ {
name: "diff if pull=true with exports", name: "diff if pull=true with exports",
olds: func(_ *testing.T, is ImageState) ImageState { state: func(_ *testing.T, is ImageState) ImageState {
is.Pull = true is.Pull = true
is.Load = true is.Load = true
return is return is
}, },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.Pull = true ia.Pull = true
ia.Load = true ia.Load = true
return ia return ia
@@ -490,9 +490,9 @@ func TestImageDiff(t *testing.T) {
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if build context changes", name: "diff if build context changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, a ImageArgs) ImageArgs { inputs: func(t *testing.T, a ImageArgs) ImageArgs {
tmp := filepath.Join(a.Context.Location, "tmp") tmp := filepath.Join(a.Context.Location, "tmp")
err := os.WriteFile(tmp, []byte{}, 0o600) err := os.WriteFile(tmp, []byte{}, 0o600)
require.NoError(t, err) require.NoError(t, err)
@@ -502,9 +502,9 @@ func TestImageDiff(t *testing.T) {
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if registry added", name: "diff if registry added",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Registries = []Registry{{}} a.Registries = []Registry{{}}
return a return a
}, },
@@ -512,7 +512,7 @@ func TestImageDiff(t *testing.T) {
}, },
{ {
name: "diff if registry user changes", name: "diff if registry user changes",
olds: func(_ *testing.T, s ImageState) ImageState { state: func(_ *testing.T, s ImageState) ImageState {
s.Registries = []Registry{{ s.Registries = []Registry{{
Address: "foo", Address: "foo",
Username: "foo", Username: "foo",
@@ -520,7 +520,7 @@ func TestImageDiff(t *testing.T) {
}} }}
return s return s
}, },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Registries = []Registry{{ a.Registries = []Registry{{
Address: "DIFFERENT USER", Address: "DIFFERENT USER",
Username: "foo", Username: "foo",
@@ -531,9 +531,9 @@ func TestImageDiff(t *testing.T) {
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if buildArgs changes", name: "diff if buildArgs changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.BuildArgs = map[string]string{ a.BuildArgs = map[string]string{
"foo": "bar", "foo": "bar",
} }
@@ -542,36 +542,36 @@ func TestImageDiff(t *testing.T) {
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if pull changes", name: "diff if pull changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.Pull = true ia.Pull = true
return ia return ia
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if load changes", name: "diff if load changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.Load = true ia.Load = true
return ia return ia
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if push changes", name: "diff if push changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.Push = true ia.Push = true
return ia return ia
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if buildOnPreview doesn't change", name: "diff if buildOnPreview doesn't change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
val := true val := true
ia.BuildOnPreview = &val ia.BuildOnPreview = &val
return ia return ia
@@ -579,9 +579,9 @@ func TestImageDiff(t *testing.T) {
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if buildOnPreview changes", name: "diff if buildOnPreview changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
val := false val := false
ia.BuildOnPreview = &val ia.BuildOnPreview = &val
return ia return ia
@@ -589,171 +589,171 @@ func TestImageDiff(t *testing.T) {
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if ssh changes", name: "diff if ssh changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.SSH = []SSH{{ID: "default"}} ia.SSH = []SSH{{ID: "default"}}
return ia return ia
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if hosts change", name: "diff if hosts change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs { inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
ia.AddHosts = []string{"localhost"} ia.AddHosts = []string{"localhost"}
return ia return ia
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if cacheFrom changes", name: "diff if cacheFrom changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.CacheFrom = []CacheFrom{{Raw: "a"}} a.CacheFrom = []CacheFrom{{Raw: "a"}}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if cacheTo changes", name: "diff if cacheTo changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.CacheTo = []CacheTo{{Raw: "a"}} a.CacheTo = []CacheTo{{Raw: "a"}}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if context changes", name: "diff if context changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Context = &BuildContext{Context: Context{Location: "testdata/ignores"}} a.Context = &BuildContext{Context: Context{Location: "testdata/ignores"}}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if named context changes", name: "diff if named context changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Context = &BuildContext{Named: NamedContexts{"foo": Context{Location: "bar"}}} a.Context = &BuildContext{Named: NamedContexts{"foo": Context{Location: "bar"}}}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if network changes", name: "diff if network changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Network = &host a.Network = &host
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if dockerfile location changes", name: "diff if dockerfile location changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Dockerfile = &Dockerfile{Location: "testdata/ignores/basedir/Dockerfile"} a.Dockerfile = &Dockerfile{Location: "testdata/ignores/basedir/Dockerfile"}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if dockerfile inline changes", name: "diff if dockerfile inline changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Dockerfile = &Dockerfile{Inline: "FROM scratch"} a.Dockerfile = &Dockerfile{Inline: "FROM scratch"}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if platforms change", name: "diff if platforms change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Platforms = []Platform{"linux/amd64"} a.Platforms = []Platform{"linux/amd64"}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if pull changes", name: "diff if pull changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Pull = true a.Pull = true
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if builder changes", name: "diff if builder changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Builder = &BuilderConfig{Name: "foo"} a.Builder = &BuilderConfig{Name: "foo"}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if tags change", name: "diff if tags change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Tags = []string{"foo"} a.Tags = []string{"foo"}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if exports change", name: "diff if exports change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Exports = []Export{{Raw: "foo"}} a.Exports = []Export{{Raw: "foo"}}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if target changes", name: "diff if target changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Target = "foo" a.Target = "foo"
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if pulling", name: "diff if pulling",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Pull = true a.Pull = true
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if noCache changes", name: "diff if noCache changes",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.NoCache = true a.NoCache = true
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if labels change", name: "diff if labels change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Labels = map[string]string{"foo": "bar"} a.Labels = map[string]string{"foo": "bar"}
return a return a
}, },
wantChanges: true, wantChanges: true,
}, },
{ {
name: "diff if secrets change", name: "diff if secrets change",
olds: func(*testing.T, ImageState) ImageState { return baseState }, state: func(*testing.T, ImageState) ImageState { return baseState },
news: func(_ *testing.T, a ImageArgs) ImageArgs { inputs: func(_ *testing.T, a ImageArgs) ImageArgs {
a.Secrets = map[string]string{"foo": "bar"} a.Secrets = map[string]string{"foo": "bar"}
return a return a
}, },
@@ -761,13 +761,13 @@ func TestImageDiff(t *testing.T) {
}, },
{ {
name: "diff if local export doesn't exist", name: "diff if local export doesn't exist",
olds: func(t *testing.T, state ImageState) ImageState { state: func(t *testing.T, state ImageState) ImageState {
state.Exports = []Export{ state.Exports = []Export{
{Local: &ExportLocal{Dest: "not-real"}}, {Local: &ExportLocal{Dest: "not-real"}},
} }
return state return state
}, },
news: func(_ *testing.T, args ImageArgs) ImageArgs { inputs: func(_ *testing.T, args ImageArgs) ImageArgs {
args.Exports = []Export{ args.Exports = []Export{
{Local: &ExportLocal{Dest: "not-real"}}, {Local: &ExportLocal{Dest: "not-real"}},
} }
@@ -777,13 +777,13 @@ func TestImageDiff(t *testing.T) {
}, },
{ {
name: "diff if tar export doesn't exist", name: "diff if tar export doesn't exist",
olds: func(t *testing.T, state ImageState) ImageState { state: func(t *testing.T, state ImageState) ImageState {
state.Exports = []Export{ state.Exports = []Export{
{Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}}, {Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}},
} }
return state return state
}, },
news: func(_ *testing.T, args ImageArgs) ImageArgs { inputs: func(_ *testing.T, args ImageArgs) ImageArgs {
args.Exports = []Export{ args.Exports = []Export{
{Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}}, {Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}},
} }
@@ -807,9 +807,9 @@ func TestImageDiff(t *testing.T) {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
t.Parallel() t.Parallel()
resp, err := s.Diff(provider.DiffRequest{ resp, err := s.Diff(provider.DiffRequest{
Urn: _fakeURN, Urn: _fakeURN,
Olds: encode(t, tt.olds(t, baseState)), State: encode(t, tt.state(t, baseState)),
News: encode(t, tt.news(t, baseArgs)), Inputs: encode(t, tt.inputs(t, baseArgs)),
}) })
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, tt.wantChanges, resp.HasChanges, resp.DetailedDiff) assert.Equal(t, tt.wantChanges, resp.HasChanges, resp.DetailedDiff)

View File

@@ -136,8 +136,8 @@ func (i *Index) Create(
resp, err := i.Update(ctx, resp, err := i.Update(ctx,
infer.UpdateRequest[IndexArgs, IndexState]{ infer.UpdateRequest[IndexArgs, IndexState]{
ID: req.Name, ID: req.Name,
Olds: IndexState{}, State: IndexState{},
News: req.Inputs, Inputs: req.Inputs,
Preview: req.Preview, Preview: req.Preview,
}, },
) )
@@ -150,7 +150,7 @@ func (i *Index) Update(
ctx context.Context, ctx context.Context,
req infer.UpdateRequest[IndexArgs, IndexState], req infer.UpdateRequest[IndexArgs, IndexState],
) (infer.UpdateResponse[IndexState], error) { ) (infer.UpdateResponse[IndexState], error) {
state, input := req.Olds, req.News state, input := req.State, req.Inputs
state.IndexArgs = input state.IndexArgs = input
state.Ref = input.Tag state.Ref = input.Tag
@@ -309,7 +309,7 @@ func (i *Index) Diff(
_ context.Context, _ context.Context,
req infer.DiffRequest[IndexArgs, IndexState], req infer.DiffRequest[IndexArgs, IndexState],
) (provider.DiffResponse, error) { ) (provider.DiffResponse, error) {
olds, news := req.Olds, req.News olds, news := req.State, req.Inputs
diff := map[string]provider.PropertyDiff{} diff := map[string]provider.PropertyDiff{}
update := provider.PropertyDiff{Kind: provider.Update} update := provider.PropertyDiff{Kind: provider.Update}

View File

@@ -142,22 +142,22 @@ func TestIndexDiff(t *testing.T) {
baseState := IndexState{IndexArgs: baseArgs} baseState := IndexState{IndexArgs: baseArgs}
tests := []struct { tests := []struct {
name string name string
olds func(*testing.T, IndexState) IndexState state func(*testing.T, IndexState) IndexState
news func(*testing.T, IndexArgs) IndexArgs inputs func(*testing.T, IndexArgs) IndexArgs
wantChanges bool wantChanges bool
}{ }{
{ {
name: "no diff if no changes", name: "no diff if no changes",
olds: func(*testing.T, IndexState) IndexState { return baseState }, state: func(*testing.T, IndexState) IndexState { return baseState },
news: func(*testing.T, IndexArgs) IndexArgs { return baseArgs }, inputs: func(*testing.T, IndexArgs) IndexArgs { return baseArgs },
wantChanges: false, wantChanges: false,
}, },
{ {
name: "diff if tag changes", name: "diff if tag changes",
olds: func(*testing.T, IndexState) IndexState { return baseState }, state: func(*testing.T, IndexState) IndexState { return baseState },
news: func(t *testing.T, a IndexArgs) IndexArgs { inputs: func(t *testing.T, a IndexArgs) IndexArgs {
a.Tag = "new-tag" a.Tag = "new-tag"
return a return a
}, },
@@ -165,7 +165,7 @@ func TestIndexDiff(t *testing.T) {
}, },
{ {
name: "no diff if registry password changes", name: "no diff if registry password changes",
olds: func(_ *testing.T, s IndexState) IndexState { state: func(_ *testing.T, s IndexState) IndexState {
s.Registry = &Registry{ s.Registry = &Registry{
Address: "foo", Address: "foo",
Username: "foo", Username: "foo",
@@ -173,7 +173,7 @@ func TestIndexDiff(t *testing.T) {
} }
return s return s
}, },
news: func(_ *testing.T, a IndexArgs) IndexArgs { inputs: func(_ *testing.T, a IndexArgs) IndexArgs {
a.Registry = &Registry{ a.Registry = &Registry{
Address: "foo", Address: "foo",
Username: "foo", Username: "foo",
@@ -184,9 +184,9 @@ func TestIndexDiff(t *testing.T) {
wantChanges: false, wantChanges: false,
}, },
{ {
name: "diff if registry added", name: "diff if registry added",
olds: func(*testing.T, IndexState) IndexState { return baseState }, state: func(*testing.T, IndexState) IndexState { return baseState },
news: func(_ *testing.T, a IndexArgs) IndexArgs { inputs: func(_ *testing.T, a IndexArgs) IndexArgs {
a.Registry = &Registry{Address: "foo.com", Username: "foo", Password: "foo"} a.Registry = &Registry{Address: "foo.com", Username: "foo", Password: "foo"}
return a return a
}, },
@@ -194,7 +194,7 @@ func TestIndexDiff(t *testing.T) {
}, },
{ {
name: "diff if registry user changes", name: "diff if registry user changes",
olds: func(_ *testing.T, s IndexState) IndexState { state: func(_ *testing.T, s IndexState) IndexState {
s.Registry = &Registry{ s.Registry = &Registry{
Address: "foo", Address: "foo",
Username: "foo", Username: "foo",
@@ -202,7 +202,7 @@ func TestIndexDiff(t *testing.T) {
} }
return s return s
}, },
news: func(_ *testing.T, a IndexArgs) IndexArgs { inputs: func(_ *testing.T, a IndexArgs) IndexArgs {
a.Registry = &Registry{ a.Registry = &Registry{
Address: "DIFFERENT USER", Address: "DIFFERENT USER",
Username: "foo", Username: "foo",
@@ -226,9 +226,9 @@ func TestIndexDiff(t *testing.T) {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
t.Parallel() t.Parallel()
resp, err := s.Diff(provider.DiffRequest{ resp, err := s.Diff(provider.DiffRequest{
Urn: urn, Urn: urn,
Olds: encode(t, tt.olds(t, baseState)), State: encode(t, tt.state(t, baseState)),
News: encode(t, tt.news(t, baseArgs)), Inputs: encode(t, tt.inputs(t, baseArgs)),
}) })
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, tt.wantChanges, resp.HasChanges, resp.DetailedDiff) assert.Equal(t, tt.wantChanges, resp.HasChanges, resp.DetailedDiff)

View File

@@ -140,11 +140,11 @@ func diffConfigIgnoreInternal(
diffConfig func(ctx context.Context, req provider.DiffRequest) (provider.DiffResponse, error), diffConfig func(ctx context.Context, req provider.DiffRequest) (provider.DiffResponse, error),
) func(ctx context.Context, req provider.DiffRequest) (provider.DiffResponse, error) { ) func(ctx context.Context, req provider.DiffRequest) (provider.DiffResponse, error) {
return func(ctx context.Context, req provider.DiffRequest) (provider.DiffResponse, error) { return func(ctx context.Context, req provider.DiffRequest) (provider.DiffResponse, error) {
m := req.News.AsMap() m := req.Inputs.AsMap()
delete(m, "__internal") delete(m, "__internal")
delete(m, "__pulumi-go-provider-infer") delete(m, "__pulumi-go-provider-infer")
delete(m, "__pulumi-go-provider-version") delete(m, "__pulumi-go-provider-version")
req.News = property.NewMap(m) req.Inputs = property.NewMap(m)
return diffConfig(ctx, req) return diffConfig(ctx, req)
} }