(platform switchblade.Platform, fixtures string)
| 12 | ) |
| 13 | |
| 14 | func testSpringBootCLI(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 Spring Boot CLI application", func() { |
| 39 | it("successfully deploys a valid Spring Boot CLI app", 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", "spring_boot_cli_valid_app")) |
| 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 beans configuration", 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", "spring_boot_cli_beans_configuration")) |
| 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 | it("successfully deploys non-POGO Groovy scripts", func() { |
| 64 | deployment, logs, err := platform.Deploy. |
| 65 | WithEnv(map[string]string{ |
| 66 | "BP_JAVA_VERSION": "11", |
| 67 | }). |
| 68 | Execute(name, filepath.Join(fixtures, "containers", "spring_boot_cli_non_pogo")) |
| 69 | Expect(err).NotTo(HaveOccurred(), logs.String) |
| 70 | |
| 71 | Expect(logs.String()).To(ContainSubstring("Java Buildpack")) |
no test coverage detected