Check if local exports exist (#197)

Check if local exports exist during diffing. For tar, the file must
exist. For local, the directory must exist and be populated.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/177.
This commit is contained in:
Bryce Lampe
2024-08-13 13:52:10 -07:00
committed by GitHub
parent 81a7aa4ec4
commit d9c3284f40
4 changed files with 66 additions and 0 deletions

View File

@@ -757,6 +757,38 @@ func TestImageDiff(t *testing.T) {
},
wantChanges: true,
},
{
name: "diff if local export doesn't exist",
olds: func(t *testing.T, state ImageState) ImageState {
state.Exports = []Export{
{Local: &ExportLocal{Dest: "not-real"}},
}
return state
},
news: func(_ *testing.T, args ImageArgs) ImageArgs {
args.Exports = []Export{
{Local: &ExportLocal{Dest: "not-real"}},
}
return args
},
wantChanges: true,
},
{
name: "diff if tar export doesn't exist",
olds: func(t *testing.T, state ImageState) ImageState {
state.Exports = []Export{
{Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}},
}
return state
},
news: func(_ *testing.T, args ImageArgs) ImageArgs {
args.Exports = []Export{
{Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}},
}
return args
},
wantChanges: true,
},
}
s := newServer(nil)