-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathspring_boot_cli_test.go
More file actions
115 lines (97 loc) · 3.76 KB
/
spring_boot_cli_test.go
File metadata and controls
115 lines (97 loc) · 3.76 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package integration_test
import (
"path/filepath"
"testing"
"github.com/cloudfoundry/switchblade"
"github.com/sclevine/spec"
"github.com/cloudfoundry/switchblade/matchers"
. "github.com/onsi/gomega"
)
func testSpringBootCLI(platform switchblade.Platform, fixtures string) func(*testing.T, spec.G, spec.S) {
return func(t *testing.T, context spec.G, it spec.S) {
var (
Expect = NewWithT(t).Expect
Eventually = NewWithT(t).Eventually
name string
)
it.Before(func() {
var err error
name, err = switchblade.RandomName()
Expect(err).NotTo(HaveOccurred())
})
it.After(func() {
if t.Failed() && name != "" {
t.Logf("❌ FAILED TEST - App/Container: %s", name)
t.Logf(" Platform: %s", settings.Platform)
}
if name != "" && (!settings.KeepFailedContainers || !t.Failed()) {
Expect(platform.Delete.Execute(name)).To(Succeed())
}
})
context("with a Spring Boot CLI application", func() {
it("successfully deploys a valid Spring Boot CLI app", func() {
deployment, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_JAVA_VERSION": "11",
}).
Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_valid_app"))
Expect(err).NotTo(HaveOccurred(), logs.String)
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
})
it("successfully deploys with beans configuration", func() {
deployment, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_JAVA_VERSION": "11",
}).
Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_beans_configuration"))
Expect(err).NotTo(HaveOccurred(), logs.String)
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
})
it("successfully deploys non-POGO Groovy scripts", func() {
deployment, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_JAVA_VERSION": "11",
}).
Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_non_pogo"))
Expect(err).NotTo(HaveOccurred(), logs.String)
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
})
it("successfully deploys with main method", func() {
deployment, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_JAVA_VERSION": "11",
}).
Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_main_method"))
Expect(err).NotTo(HaveOccurred(), logs.String)
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
})
it("successfully deploys Groovy with WEB-INF", func() {
deployment, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_JAVA_VERSION": "11",
}).
Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_groovy_with_web_inf"))
Expect(err).NotTo(HaveOccurred(), logs.String)
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
})
})
context("with JRE version selection", func() {
it("deploys Spring Boot CLI with Java 17", func() {
deployment, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_JAVA_VERSION": "17",
}).
Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_valid_app"))
Expect(err).NotTo(HaveOccurred(), logs.String)
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
})
})
}
}