Fix diff behavior for buildOnPreview

This commit is contained in:
Bryce Lampe
2024-04-22 16:28:45 -07:00
parent fbc4ddec66
commit 2987a65183
2 changed files with 12 additions and 2 deletions

View File

@@ -889,7 +889,7 @@ func (*Image) Diff(
if !reflect.DeepEqual(olds.BuildArgs, news.BuildArgs) {
diff["buildArgs"] = update
}
if olds.BuildOnPreview != news.BuildOnPreview {
if !reflect.DeepEqual(olds.BuildOnPreview, news.BuildOnPreview) {
diff["buildOnPreview"] = update
}
if !reflect.DeepEqual(olds.Builder, news.Builder) {

View File

@@ -518,7 +518,7 @@ func TestImageDiff(t *testing.T) {
wantChanges: true,
},
{
name: "diff if buildOnPreview changes",
name: "diff if buildOnPreview doesn't change",
olds: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs {
val := true
@@ -527,6 +527,16 @@ func TestImageDiff(t *testing.T) {
},
wantChanges: true,
},
{
name: "diff if buildOnPreview changes",
olds: func(*testing.T, ImageState) ImageState { return baseState },
news: func(t *testing.T, ia ImageArgs) ImageArgs {
val := false
ia.BuildOnPreview = &val
return ia
},
wantChanges: true,
},
{
name: "diff if ssh changes",
olds: func(*testing.T, ImageState) ImageState { return baseState },