Skip to content

Commit 1032143

Browse files
authored
Merge pull request #360 from cloudfoundry/fix-tests
Add executing with nginx buildpack
2 parents 77aac92 + 402d5eb commit 1032143

2 files changed

Lines changed: 37 additions & 26 deletions

File tree

src/nginx/integration/default_test.go

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
3434
context("templated with env vars", func() {
3535
it("builds and runs the app", func() {
3636
deployment, logs, err := platform.Deploy.
37+
WithBuildpacks("nginx_buildpack").
3738
WithEnv(map[string]string{
3839
"OVERRIDE": `'{ "abcd": 12345 }{ \'ef\' : "ab" }'`,
3940
}).
@@ -44,18 +45,17 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
4445

4546
Eventually(deployment).Should(Serve(ContainSubstring(`{ "abcd": 12345 }{ 'ef' : "ab" }`)).WithEndpoint("test"))
4647

47-
4848
Eventually(func() string {
4949
logs, _ := deployment.RuntimeLogs()
50-
return logs
51-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`),
52-
))
50+
return logs
51+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`)))
5352
})
5453
})
5554

5655
context("templated with env vars with include", func() {
5756
it("builds and runs the app", func() {
5857
deployment, logs, err := platform.Deploy.
58+
WithBuildpacks("nginx_buildpack").
5959
WithEnv(map[string]string{
6060
"OVERRIDE": `'{ "abcd": 12345 }{ \'ef\' : "ab" }'`,
6161
}).
@@ -68,49 +68,49 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
6868

6969
Eventually(func() string {
7070
logs, _ := deployment.RuntimeLogs()
71-
return logs
72-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`),
73-
))
71+
return logs
72+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`)))
7473
})
7574
})
7675

7776
context("with no specified pid", func() {
7877
it("builds and runs the app", func() {
7978
deployment, _, err := platform.Deploy.
79+
WithBuildpacks("nginx_buildpack").
8080
Execute(name, filepath.Join(fixtures, "default", "without_pid"))
8181
Expect(err).NotTo(HaveOccurred())
8282

8383
Eventually(deployment).Should(Serve(ContainSubstring("Exciting Content")))
8484

8585
Eventually(func() string {
8686
logs, _ := deployment.RuntimeLogs()
87-
return logs
88-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`),
89-
))
87+
return logs
88+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`)))
9089

9190
})
9291
})
9392

9493
context("with a specified pid", func() {
9594
it("builds and runs the app", func() {
9695
deployment, _, err := platform.Deploy.
96+
WithBuildpacks("nginx_buildpack").
9797
Execute(name, filepath.Join(fixtures, "default", "with_pid"))
9898
Expect(err).NotTo(HaveOccurred())
9999

100100
Eventually(deployment).Should(Serve(ContainSubstring("Exciting Content")))
101101

102102
Eventually(func() string {
103103
logs, _ := deployment.RuntimeLogs()
104-
return logs
105-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`),
106-
))
104+
return logs
105+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`)))
107106

108107
})
109108
})
110109

111110
context("with no specified version", func() {
112111
it("builds and runs the app and uses mainline", func() {
113112
deployment, logs, err := platform.Deploy.
113+
WithBuildpacks("nginx_buildpack").
114114
Execute(name, filepath.Join(fixtures, "default", "unspecified_version"))
115115
Expect(err).NotTo(HaveOccurred())
116116

@@ -121,15 +121,15 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
121121

122122
Eventually(func() string {
123123
logs, _ := deployment.RuntimeLogs()
124-
return logs
125-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`),
126-
))
124+
return logs
125+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`)))
127126
})
128127
})
129128

130129
context("with an app specifying mainline", func() {
131130
it("builds and runs the app", func() {
132131
deployment, logs, err := platform.Deploy.
132+
WithBuildpacks("nginx_buildpack").
133133
Execute(name, filepath.Join(fixtures, "default", "mainline"))
134134
Expect(err).NotTo(HaveOccurred())
135135

@@ -139,34 +139,34 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
139139

140140
Eventually(func() string {
141141
logs, _ := deployment.RuntimeLogs()
142-
return logs
143-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`),
144-
))
142+
return logs
143+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`)))
145144
})
146145
})
147146

148147
context("with an app specifying stable", func() {
149148
it("builds and runs the app", func() {
150149
deployment, logs, err := platform.Deploy.
150+
WithBuildpacks("nginx_buildpack").
151151
Execute(name, filepath.Join(fixtures, "default", "stable"))
152152
Expect(err).NotTo(HaveOccurred())
153153

154154
Eventually(logs).Should(ContainSubstring(`Requested nginx version: stable => 1.26.`))
155155
Eventually(logs).Should(ContainSubstring(`Warning: usage of "stable" versions of NGINX is discouraged in most cases by the NGINX team.`))
156156

157157
Eventually(deployment).Should(Serve(ContainSubstring("Exciting Content")))
158-
158+
159159
Eventually(func() string {
160160
logs, _ := deployment.RuntimeLogs()
161-
return logs
162-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`),
163-
))
161+
return logs
162+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`)))
164163
})
165164
})
166165

167166
context("with an app unavailable version", func() {
168167
it("the build fails and logs and error", func() {
169168
_, logs, err := platform.Deploy.
169+
WithBuildpacks("nginx_buildpack").
170170
Execute(name, filepath.Join(fixtures, "default", "unavailable_version"))
171171
Expect(err).To(HaveOccurred())
172172

@@ -177,6 +177,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
177177
context("with using the stream module", func() {
178178
it("builds and runs the app", func() {
179179
deployment, _, err := platform.Deploy.
180+
WithBuildpacks("nginx_buildpack").
180181
Execute(name, filepath.Join(fixtures, "default", "with_stream_module"))
181182
Expect(err).NotTo(HaveOccurred())
182183

@@ -187,6 +188,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
187188
context("with an app that has no access to logging", func() {
188189
it("logs a warning and builds and runs the app", func() {
189190
deployment, logs, err := platform.Deploy.
191+
WithBuildpacks("nginx_buildpack").
190192
Execute(name, filepath.Join(fixtures, "default", "no_logging"))
191193
Expect(err).NotTo(HaveOccurred())
192194

@@ -199,16 +201,16 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
199201
context("an Openresty app", func() {
200202
it("builds and runs the app", func() {
201203
deployment, _, err := platform.Deploy.
204+
WithBuildpacks("nginx_buildpack").
202205
Execute(name, filepath.Join(fixtures, "default", "openresty"))
203206
Expect(err).NotTo(HaveOccurred())
204207

205208
Eventually(deployment).Should(Serve(ContainSubstring("<p>hello, world</p>")))
206209

207210
Eventually(func() string {
208211
logs, _ := deployment.RuntimeLogs()
209-
return logs
210-
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`),
211-
))
212+
return logs
213+
}, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`)))
212214
})
213215
})
214216
}

src/nginx/integration/dynatrace_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
3333
context("deploying a Go app with Dynatrace agent with configured network zone", func() {
3434
it("checks if networkzone setting was successful", func() {
3535
_, logs, err := platform.Deploy.
36+
WithBuildpacks("nginx_buildpack").
3637
WithEnv(map[string]string{
3738
"BP_DEBUG": "true",
3839
}).
@@ -59,6 +60,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
5960
context("when deploying with Dynatrace agent with single credentials service", func() {
6061
it("checks if Dynatrace injection was successful", func() {
6162
_, logs, err := platform.Deploy.
63+
WithBuildpacks("nginx_buildpack").
6264
WithEnv(map[string]string{
6365
"BP_DEBUG": "true",
6466
}).
@@ -83,6 +85,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
8385
context("when deploying with Dynatrace agent with two credentials services", func() {
8486
it("checks if detection of second service with credentials works", func() {
8587
_, logs, err := platform.Deploy.
88+
WithBuildpacks("nginx_buildpack").
8689
WithEnv(map[string]string{
8790
"BP_DEBUG": "true",
8891
}).
@@ -108,6 +111,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
108111
context("when deploying with Dynatrace agent with failing agent download and ignoring errors", func() {
109112
it("checks if skipping download errors works", func() {
110113
_, logs, err := platform.Deploy.
114+
WithBuildpacks("nginx_buildpack").
111115
WithEnv(map[string]string{
112116
"BP_DEBUG": "true",
113117
}).
@@ -130,6 +134,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
130134
context("deploying a with Dynatrace agent with two dynatrace services", func() {
131135
it("check if service detection isn't disturbed by a service with tags", func() {
132136
_, logs, err := platform.Deploy.
137+
WithBuildpacks("nginx_buildpack").
133138
WithEnv(map[string]string{
134139
"BP_DEBUG": "true",
135140
}).
@@ -157,6 +162,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
157162
context("deploying with Dynatrace agent with single credentials service and without manifest.json", func() {
158163
it("checks if Dynatrace injection was successful", func() {
159164
_, logs, err := platform.Deploy.
165+
WithBuildpacks("nginx_buildpack").
160166
WithEnv(map[string]string{
161167
"BP_DEBUG": "true",
162168
}).
@@ -181,6 +187,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
181187
context("deploying Dynatrace agent with failing agent download and checking retry", func() {
182188
it("checks if retrying downloads works", func() {
183189
_, logs, err := platform.Deploy.
190+
WithBuildpacks("nginx_buildpack").
184191
WithEnv(map[string]string{
185192
"BP_DEBUG": "true",
186193
}).
@@ -204,6 +211,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
204211
context("deploying Dynatrace agent with single credentials service and a redis service", func() {
205212
it("checks if Dynatrace injection was successful", func() {
206213
_, logs, err := platform.Deploy.
214+
WithBuildpacks("nginx_buildpack").
207215
WithEnv(map[string]string{
208216
"BP_DEBUG": "true",
209217
}).
@@ -239,6 +247,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te
239247
context("deploying Dynatrace agent with single credentials service", func() {
240248
it("checks if agent config update via API was successful", func() {
241249
_, logs, err := platform.Deploy.
250+
WithBuildpacks("nginx_buildpack").
242251
WithEnv(map[string]string{
243252
"BP_DEBUG": "true",
244253
}).

0 commit comments

Comments
 (0)