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

Function testFrameworks

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

Source from the content-addressed store, hash-verified

12)
13
14func testFrameworks(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 // Only attempt cleanup if test actually ran (not skipped) and name was set
34 if name != "" && !t.Skipped() && (!settings.KeepFailedContainers || !t.Failed()) {
35 Expect(platform.Delete.Execute(name)).To(Succeed())
36 }
37 })
38
39 context("APM Agents", func() {
40 context("with New Relic service binding", func() {
41 it("detects and installs New Relic agent", func() {
42 deployment, logs, err := platform.Deploy.
43 WithServices(map[string]switchblade.Service{
44 "newrelic": {
45 "licenseKey": "test-license-key-1234567890abcdef",
46 },
47 }).
48 WithEnv(map[string]string{
49 "BP_JAVA_VERSION": "11",
50 }).
51 Execute(name, filepath.Join(fixtures, "containers", "spring_boot_staged"))
52 Expect(err).NotTo(HaveOccurred(), logs.String)
53
54 // Verify New Relic agent was detected
55 Expect(logs.String()).To(ContainSubstring("New Relic Agent"))
56 Eventually(deployment).Should(matchers.Serve(ContainSubstring("")))
57 })
58
59 it("configures New Relic with license key from service binding", func() {
60 deployment, logs, err := platform.Deploy.
61 WithServices(map[string]switchblade.Service{
62 "my-newrelic-service": {
63 "licenseKey": "abc123def456ghi789jkl012mno345pq",
64 },
65 }).
66 WithEnv(map[string]string{
67 "BP_JAVA_VERSION": "17",
68 }).
69 Execute(name, filepath.Join(fixtures, "apps", "integration_valid"))
70 Expect(err).NotTo(HaveOccurred(), logs.String)
71

Callers 1

TestIntegrationFunction · 0.85

Calls 2

StringMethod · 0.80
ExecuteMethod · 0.65

Tested by

no test coverage detected