github.com/paketo-buildpacks/libpak@v1.70.0/stack_test.go (about)

     1  package libpak_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/onsi/gomega"
     7  	"github.com/paketo-buildpacks/libpak"
     8  	"github.com/sclevine/spec"
     9  )
    10  
    11  func testStack(t *testing.T, context spec.G, it spec.S) {
    12  	context("bionic stacks", func() {
    13  		it("matches standard bionic stack", func() {
    14  			Expect(libpak.IsBionicStack("io.buildpacks.stacks.bionic")).To(BeTrue())
    15  		})
    16  
    17  		it("matches tiny bionic stack", func() {
    18  			Expect(libpak.IsBionicStack("io.paketo.stacks.tiny")).To(BeTrue())
    19  		})
    20  
    21  		it("does not match non-bionic stack", func() {
    22  			Expect(libpak.IsBionicStack("io.buildpacks.stacks.jammy")).To(BeFalse())
    23  		})
    24  	})
    25  
    26  	context("jammy stacks", func() {
    27  		it("matches standard jammy stack", func() {
    28  			Expect(libpak.IsJammyStack("io.buildpacks.stacks.jammy")).To(BeTrue())
    29  		})
    30  
    31  		it("matches tiny jammy stack", func() {
    32  			Expect(libpak.IsJammyStack("io.buildpacks.stacks.jammy.tiny")).To(BeTrue())
    33  		})
    34  
    35  		it("matches static jammy stack", func() {
    36  			Expect(libpak.IsJammyStack("io.buildpacks.stacks.jammy.static")).To(BeTrue())
    37  		})
    38  
    39  		it("does not match non-jammy stack", func() {
    40  			Expect(libpak.IsJammyStack("io.buildpacks.stacks.bionic")).To(BeFalse())
    41  		})
    42  	})
    43  
    44  	context("tiny stacks", func() {
    45  		it("matches tiny bionic stack", func() {
    46  			Expect(libpak.IsTinyStack("io.paketo.stacks.tiny")).To(BeTrue())
    47  		})
    48  
    49  		it("matches tiny jammy stack", func() {
    50  			Expect(libpak.IsTinyStack("io.buildpacks.stacks.jammy.tiny")).To(BeTrue())
    51  		})
    52  
    53  		it("does not match full stack", func() {
    54  			Expect(libpak.IsTinyStack("io.buildpacks.stacks.bionic")).To(BeFalse())
    55  		})
    56  	})
    57  
    58  	context("static stack", func() {
    59  		it("matches static jammy stack", func() {
    60  			Expect(libpak.IsStaticStack("io.buildpacks.stacks.jammy.static")).To(BeTrue())
    61  		})
    62  
    63  		it("does not match full stack", func() {
    64  			Expect(libpak.IsTinyStack("io.buildpacks.stacks.bionic")).To(BeFalse())
    65  		})
    66  	})
    67  
    68  	context("shell", func() {
    69  		it("matches a full stack", func() {
    70  			Expect(libpak.IsShellPresentOnStack("io.buildpacks.stacks.bionic")).To(BeTrue())
    71  		})
    72  
    73  		it("does not match static jammy stack", func() {
    74  			Expect(libpak.IsShellPresentOnStack("io.buildpacks.stacks.jammy.static")).To(BeFalse())
    75  		})
    76  	})
    77  }