-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from paketo-buildpacks/add-static
Add static stack as well as convenience methods for matching stacks
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package libpak_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/gomega" | ||
"github.com/paketo-buildpacks/libpak" | ||
"github.com/sclevine/spec" | ||
) | ||
|
||
func testStack(t *testing.T, context spec.G, it spec.S) { | ||
context("bionic stacks", func() { | ||
it("matches standard bionic stack", func() { | ||
Expect(libpak.IsBionicStack("io.buildpacks.stacks.bionic")).To(BeTrue()) | ||
}) | ||
|
||
it("matches tiny bionic stack", func() { | ||
Expect(libpak.IsBionicStack("io.paketo.stacks.tiny")).To(BeTrue()) | ||
}) | ||
|
||
it("does not match non-bionic stack", func() { | ||
Expect(libpak.IsBionicStack("io.buildpacks.stacks.jammy")).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
context("jammy stacks", func() { | ||
it("matches standard jammy stack", func() { | ||
Expect(libpak.IsJammyStack("io.buildpacks.stacks.jammy")).To(BeTrue()) | ||
}) | ||
|
||
it("matches tiny jammy stack", func() { | ||
Expect(libpak.IsJammyStack("io.buildpacks.stacks.jammy.tiny")).To(BeTrue()) | ||
}) | ||
|
||
it("matches static jammy stack", func() { | ||
Expect(libpak.IsJammyStack("io.buildpacks.stacks.jammy.static")).To(BeTrue()) | ||
}) | ||
|
||
it("does not match non-jammy stack", func() { | ||
Expect(libpak.IsJammyStack("io.buildpacks.stacks.bionic")).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
context("tiny stacks", func() { | ||
it("matches tiny bionic stack", func() { | ||
Expect(libpak.IsTinyStack("io.paketo.stacks.tiny")).To(BeTrue()) | ||
}) | ||
|
||
it("matches tiny jammy stack", func() { | ||
Expect(libpak.IsTinyStack("io.buildpacks.stacks.jammy.tiny")).To(BeTrue()) | ||
}) | ||
|
||
it("does not match full stack", func() { | ||
Expect(libpak.IsTinyStack("io.buildpacks.stacks.bionic")).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
context("static stack", func() { | ||
it("matches static jammy stack", func() { | ||
Expect(libpak.IsStaticStack("io.buildpacks.stacks.jammy.static")).To(BeTrue()) | ||
}) | ||
|
||
it("does not match full stack", func() { | ||
Expect(libpak.IsTinyStack("io.buildpacks.stacks.bionic")).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
context("shell", func() { | ||
it("matches a full stack", func() { | ||
Expect(libpak.IsShellPresentOnStack("io.buildpacks.stacks.bionic")).To(BeTrue()) | ||
}) | ||
|
||
it("does not match static jammy stack", func() { | ||
Expect(libpak.IsShellPresentOnStack("io.buildpacks.stacks.jammy.static")).To(BeFalse()) | ||
}) | ||
}) | ||
} |