From 3ba9d0074608177d004257b0a82c8a02b9449cc5 Mon Sep 17 00:00:00 2001 From: ivanovac Date: Wed, 14 Jan 2026 15:58:16 +0200 Subject: [PATCH 1/3] add executing with nginx buildpack --- src/nginx/integration/default_test.go | 62 +++++++++++++------------ src/nginx/integration/dynatrace_test.go | 9 ++++ 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/nginx/integration/default_test.go b/src/nginx/integration/default_test.go index 5f370cf2..b926dad8 100644 --- a/src/nginx/integration/default_test.go +++ b/src/nginx/integration/default_test.go @@ -27,13 +27,14 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T println(name) }) - it.After(func() { - Expect(platform.Delete.Execute(name)).To(Succeed()) - }) + // it.After(func() { + // Expect(platform.Delete.Execute(name)).To(Succeed()) + // }) context("templated with env vars", func() { it("builds and runs the app", func() { deployment, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "OVERRIDE": `'{ "abcd": 12345 }{ \'ef\' : "ab" }'`, }). @@ -44,18 +45,17 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(deployment).Should(Serve(ContainSubstring(`{ "abcd": 12345 }{ 'ef' : "ab" }`)).WithEndpoint("test")) - Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`))) }) }) context("templated with env vars with include", func() { it("builds and runs the app", func() { deployment, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "OVERRIDE": `'{ "abcd": 12345 }{ \'ef\' : "ab" }'`, }). @@ -68,15 +68,15 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET /test HTTP/1.1" 200`))) }) }) context("with no specified pid", func() { it("builds and runs the app", func() { deployment, _, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "without_pid")) Expect(err).NotTo(HaveOccurred()) @@ -84,9 +84,8 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`))) }) }) @@ -94,6 +93,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T context("with a specified pid", func() { it("builds and runs the app", func() { deployment, _, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "with_pid")) Expect(err).NotTo(HaveOccurred()) @@ -101,9 +101,8 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`))) }) }) @@ -111,6 +110,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T context("with no specified version", func() { it("builds and runs the app and uses mainline", func() { deployment, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "unspecified_version")) Expect(err).NotTo(HaveOccurred()) @@ -121,15 +121,15 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`))) }) }) context("with an app specifying mainline", func() { it("builds and runs the app", func() { deployment, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "mainline")) Expect(err).NotTo(HaveOccurred()) @@ -139,15 +139,15 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`))) }) }) context("with an app specifying stable", func() { it("builds and runs the app", func() { deployment, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "stable")) Expect(err).NotTo(HaveOccurred()) @@ -155,18 +155,18 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(logs).Should(ContainSubstring(`Warning: usage of "stable" versions of NGINX is discouraged in most cases by the NGINX team.`)) Eventually(deployment).Should(Serve(ContainSubstring("Exciting Content"))) - + Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`))) }) }) context("with an app unavailable version", func() { - it("the build fails and logs and error", func() { + it.Focus("the build fails and logs and error", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "unavailable_version")) Expect(err).To(HaveOccurred()) @@ -177,6 +177,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T context("with using the stream module", func() { it("builds and runs the app", func() { deployment, _, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "with_stream_module")) Expect(err).NotTo(HaveOccurred()) @@ -187,6 +188,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T context("with an app that has no access to logging", func() { it("logs a warning and builds and runs the app", func() { deployment, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "no_logging")) Expect(err).NotTo(HaveOccurred()) @@ -199,6 +201,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T context("an Openresty app", func() { it("builds and runs the app", func() { deployment, _, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "openresty")) Expect(err).NotTo(HaveOccurred()) @@ -206,9 +209,8 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T Eventually(func() string { logs, _ := deployment.RuntimeLogs() - return logs - }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`), - )) + return logs + }, "10s", "1s").Should(Or(ContainSubstring(`NginxLog "GET / HTTP/1.1" 200`))) }) }) } diff --git a/src/nginx/integration/dynatrace_test.go b/src/nginx/integration/dynatrace_test.go index aeefe977..4346c5bd 100644 --- a/src/nginx/integration/dynatrace_test.go +++ b/src/nginx/integration/dynatrace_test.go @@ -33,6 +33,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("deploying a Go app with Dynatrace agent with configured network zone", func() { it("checks if networkzone setting was successful", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -59,6 +60,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("when deploying with Dynatrace agent with single credentials service", func() { it("checks if Dynatrace injection was successful", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -83,6 +85,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("when deploying with Dynatrace agent with two credentials services", func() { it("checks if detection of second service with credentials works", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -108,6 +111,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("when deploying with Dynatrace agent with failing agent download and ignoring errors", func() { it("checks if skipping download errors works", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -130,6 +134,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("deploying a with Dynatrace agent with two dynatrace services", func() { it("check if service detection isn't disturbed by a service with tags", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -157,6 +162,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("deploying with Dynatrace agent with single credentials service and without manifest.json", func() { it("checks if Dynatrace injection was successful", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -181,6 +187,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("deploying Dynatrace agent with failing agent download and checking retry", func() { it("checks if retrying downloads works", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -204,6 +211,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("deploying Dynatrace agent with single credentials service and a redis service", func() { it("checks if Dynatrace injection was successful", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). @@ -239,6 +247,7 @@ func testDynatrace(platform switchblade.Platform, fixtures, uri string) func(*te context("deploying Dynatrace agent with single credentials service", func() { it("checks if agent config update via API was successful", func() { _, logs, err := platform.Deploy. + WithBuildpacks("nginx_buildpack"). WithEnv(map[string]string{ "BP_DEBUG": "true", }). From 05daead1f5d0c9f012266a1d2364998cb82c8ee3 Mon Sep 17 00:00:00 2001 From: ivanovac Date: Wed, 14 Jan 2026 16:06:05 +0200 Subject: [PATCH 2/3] clean comment --- src/nginx/integration/default_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nginx/integration/default_test.go b/src/nginx/integration/default_test.go index b926dad8..1168f222 100644 --- a/src/nginx/integration/default_test.go +++ b/src/nginx/integration/default_test.go @@ -27,9 +27,9 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T println(name) }) - // it.After(func() { - // Expect(platform.Delete.Execute(name)).To(Succeed()) - // }) + it.After(func() { + Expect(platform.Delete.Execute(name)).To(Succeed()) + }) context("templated with env vars", func() { it("builds and runs the app", func() { From 402d5eb49b074d95c0533850fab920488d146336 Mon Sep 17 00:00:00 2001 From: ivanovac Date: Wed, 14 Jan 2026 16:07:17 +0200 Subject: [PATCH 3/3] clean Focus() --- src/nginx/integration/default_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nginx/integration/default_test.go b/src/nginx/integration/default_test.go index 1168f222..016e8756 100644 --- a/src/nginx/integration/default_test.go +++ b/src/nginx/integration/default_test.go @@ -164,7 +164,7 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T }) context("with an app unavailable version", func() { - it.Focus("the build fails and logs and error", func() { + it("the build fails and logs and error", func() { _, logs, err := platform.Deploy. WithBuildpacks("nginx_buildpack"). Execute(name, filepath.Join(fixtures, "default", "unavailable_version"))