diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 335e9a5b24..17624c3fc0 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -2185,7 +2185,24 @@ func testAcceptance( imageManager.CleanupImages(runImageName) }) + it("fails with a message", func() { + h.SkipIf(t, pack.SupportsFeature(invoke.StackWarning), "stack is validated in prior versions") + output, err := pack.Run( + "build", repoName, + "-p", filepath.Join("testdata", "mock_app"), + "--run-image", runImageName, + ) + assert.NotNil(err) + + assertOutput := assertions.NewOutputAssertionManager(t, output) + assertOutput.ReportsRunImageStackNotMatchingBuilder( + "other.stack.id", + "pack.test.stack", + ) + }) + it("succeeds with a warning", func() { + h.SkipIf(t, !pack.SupportsFeature(invoke.StackWarning), "stack is no longer validated") output, err := pack.Run( "build", repoName, "-p", filepath.Join("testdata", "mock_app"), @@ -2194,7 +2211,7 @@ func testAcceptance( assert.Nil(err) assertOutput := assertions.NewOutputAssertionManager(t, output) - assertOutput.ReportsRunImageStackNotMatchingBuilder() + assertOutput.ReportsDeprecatedUseOfStack() }) }) }) diff --git a/acceptance/assertions/output.go b/acceptance/assertions/output.go index b8ec9b158c..e8d6f337c9 100644 --- a/acceptance/assertions/output.go +++ b/acceptance/assertions/output.go @@ -109,7 +109,16 @@ func (o OutputAssertionManager) ReportsSkippingRestore() { o.assert.Contains(o.output, "Skipping 'restore' due to clearing cache") } -func (o OutputAssertionManager) ReportsRunImageStackNotMatchingBuilder() { +func (o OutputAssertionManager) ReportsRunImageStackNotMatchingBuilder(runImageStack, builderStack string) { + o.testObject.Helper() + + o.assert.Contains( + o.output, + fmt.Sprintf("run-image stack id '%s' does not match builder stack '%s'", runImageStack, builderStack), + ) +} + +func (o OutputAssertionManager) ReportsDeprecatedUseOfStack() { o.testObject.Helper() o.assert.Contains(o.output, "Warning: deprecated usage of stack") diff --git a/acceptance/invoke/pack.go b/acceptance/invoke/pack.go index 9346bdce5a..739cb3c6d4 100644 --- a/acceptance/invoke/pack.go +++ b/acceptance/invoke/pack.go @@ -241,6 +241,7 @@ const ( ManifestCommands PlatformOption MultiPlatformBuildersAndBuildPackages + StackWarning ) var featureTests = map[Feature]func(i *PackInvoker) bool{ @@ -286,6 +287,9 @@ var featureTests = map[Feature]func(i *PackInvoker) bool{ MultiPlatformBuildersAndBuildPackages: func(i *PackInvoker) bool { return i.atLeast("v0.34.0") }, + StackWarning: func(i *PackInvoker) bool { + return !i.atLeast("v0.37.0") + }, } func (i *PackInvoker) SupportsFeature(f Feature) bool {