-
Notifications
You must be signed in to change notification settings - Fork 347
Expand file tree
/
Copy pathstandalone_test.go
More file actions
75 lines (60 loc) · 2.16 KB
/
standalone_test.go
File metadata and controls
75 lines (60 loc) · 2.16 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
package integration_test
import (
"path/filepath"
"testing"
"github.com/cloudfoundry/switchblade"
"github.com/sclevine/spec"
. "github.com/onsi/gomega"
)
func testStandaloneApp(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
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("APP_START_CMD with WEB_SERVER=none", func() {
it("builds with explicit APP_START_CMD", func() {
_, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_DEBUG": "1",
}).
Execute(name, filepath.Join(fixtures, "standalone_app"))
Expect(err).NotTo(HaveOccurred(), logs.String)
// Verify the buildpack detected standalone mode
Expect(logs).To(ContainSubstring("Standalone app mode: will run worker.php"))
// Verify the finalize phase completed successfully
Expect(logs).To(ContainSubstring("PHP buildpack finalize phase complete"))
// Verify start script was created
Expect(logs).To(ContainSubstring("Created start script for none"))
})
it("builds with auto-detected app.php", func() {
_, logs, err := platform.Deploy.
WithEnv(map[string]string{
"BP_DEBUG": "1",
}).
Execute(name, filepath.Join(fixtures, "standalone_autodetect"))
Expect(err).NotTo(HaveOccurred(), logs.String)
// Verify the buildpack detected standalone mode and found app.php
Expect(logs).To(ContainSubstring("Standalone app mode: will run app.php"))
// Verify the finalize phase completed successfully
Expect(logs).To(ContainSubstring("PHP buildpack finalize phase complete"))
// Verify start script was created
Expect(logs).To(ContainSubstring("Created start script for none"))
})
})
}
}