github.com/buildpacks/pack@v0.33.3-0.20240516162812-884dd1837311/internal/commands/stack_suggest_test.go (about) 1 package commands 2 3 import ( 4 "bytes" 5 "testing" 6 7 "github.com/sclevine/spec" 8 "github.com/sclevine/spec/report" 9 "github.com/spf13/cobra" 10 11 "github.com/buildpacks/pack/pkg/logging" 12 h "github.com/buildpacks/pack/testhelpers" 13 ) 14 15 func TestStacksSuggestCommand(t *testing.T) { 16 spec.Run(t, "StacksSuggestCommand", testStacksSuggestCommand, spec.Parallel(), spec.Report(report.Terminal{})) 17 } 18 19 func testStacksSuggestCommand(t *testing.T, when spec.G, it spec.S) { 20 var ( 21 command *cobra.Command 22 outBuf bytes.Buffer 23 ) 24 25 it.Before(func() { 26 command = stackSuggest(logging.NewLogWithWriters(&outBuf, &outBuf)) 27 }) 28 29 when("#SuggestStacks", func() { 30 it("displays stack information", func() { 31 command.SetArgs([]string{}) 32 h.AssertNil(t, command.Execute()) 33 h.AssertEq(t, outBuf.String(), `Stacks maintained by the community: 34 35 Stack ID: Deprecation Notice 36 Description: Stacks are deprecated in favor of using BuildImages and RunImages directly, but will continue to be supported throughout all of 2023 and 2024 if not longer. Please see our docs for more details- https://buildpacks.io/docs/concepts/components/stack 37 Maintainer: CNB 38 Build Image: 39 Run Image: 40 41 Stack ID: heroku-20 42 Description: The official Heroku stack based on Ubuntu 20.04 43 Maintainer: Heroku 44 Build Image: heroku/heroku:20-cnb-build 45 Run Image: heroku/heroku:20-cnb 46 47 Stack ID: io.buildpacks.stacks.jammy 48 Description: A minimal Paketo stack based on Ubuntu 22.04 49 Maintainer: Paketo Project 50 Build Image: paketobuildpacks/build-jammy-base 51 Run Image: paketobuildpacks/run-jammy-base 52 53 Stack ID: io.buildpacks.stacks.jammy 54 Description: A large Paketo stack based on Ubuntu 22.04 55 Maintainer: Paketo Project 56 Build Image: paketobuildpacks/build-jammy-full 57 Run Image: paketobuildpacks/run-jammy-full 58 59 Stack ID: io.buildpacks.stacks.jammy.static 60 Description: A static Paketo stack based on Ubuntu 22.04, similar to distroless 61 Maintainer: Paketo Project 62 Build Image: paketobuildpacks/build-jammy-static 63 Run Image: paketobuildpacks/run-jammy-static 64 65 Stack ID: io.buildpacks.stacks.jammy.tiny 66 Description: A tiny Paketo stack based on Ubuntu 22.04, similar to distroless 67 Maintainer: Paketo Project 68 Build Image: paketobuildpacks/build-jammy-tiny 69 Run Image: paketobuildpacks/run-jammy-tiny 70 `) 71 }) 72 }) 73 }