MCPcopy Index your code
hub / github.com/cloudfoundry/java-buildpack / testDistZip

Function testDistZip

src/integration/dist_zip_test.go:14–92  ·  view source on GitHub ↗
(platform switchblade.Platform, fixtures string)

Source from the content-addressed store, hash-verified

12)
13
14func testDistZip(platform switchblade.Platform, fixtures string) func(*testing.T, spec.G, spec.S) {
15 return func(t *testing.T, context spec.G, it spec.S) {
16 var (
17 Expect = NewWithT(t).Expect
18 Eventually = NewWithT(t).Eventually
19 name string
20 )
21
22 it.Before(func() {
23 var err error
24 name, err = switchblade.RandomName()
25 Expect(err).NotTo(HaveOccurred())
26 })
27
28 it.After(func() {
29 if t.Failed() && name != "" {
30 t.Logf("❌ FAILED TEST - App/Container: %s", name)
31 t.Logf(" Platform: %s", settings.Platform)
32 }
33 if name != "" && (!settings.KeepFailedContainers || !t.Failed()) {
34 Expect(platform.Delete.Execute(name)).To(Succeed())
35 }
36 })
37
38 context("with a distribution ZIP application", func() {
39 it("successfully deploys a standard dist zip", func() {
40 deployment, logs, err := platform.Deploy.
41 WithEnv(map[string]string{
42 "BP_JAVA_VERSION": "11",
43 }).
44 Execute(name, filepath.Join(fixtures, "containers", "dist_zip"))
45 Expect(err).NotTo(HaveOccurred(), logs.String)
46
47 Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
48 Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
49 })
50
51 it("successfully deploys with custom application classpath", func() {
52 deployment, logs, err := platform.Deploy.
53 WithEnv(map[string]string{
54 "BP_JAVA_VERSION": "11",
55 }).
56 Execute(name, filepath.Join(fixtures, "containers", "dist_zip_app_classpath"))
57 Expect(err).NotTo(HaveOccurred(), logs.String)
58
59 Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
60 Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
61 })
62 })
63
64 context("with JRE version selection", func() {
65 it("deploys DistZip with Java 8", func() {
66 deployment, logs, err := platform.Deploy.
67 WithEnv(map[string]string{
68 "BP_JAVA_VERSION": "8",
69 }).
70 Execute(name, filepath.Join(fixtures, "containers", "dist_zip"))
71 Expect(err).NotTo(HaveOccurred(), logs.String)

Callers 1

TestIntegrationFunction · 0.85

Calls 2

StringMethod · 0.80
ExecuteMethod · 0.65

Tested by

no test coverage detected