-
Notifications
You must be signed in to change notification settings - Fork 18
/
stack_test.go
77 lines (61 loc) · 2.12 KB
/
stack_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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())
})
})
}