Skip to content

Commit 003c048

Browse files
authored
fix e2e tests
Signed-off-by: Malthe Poulsen <30603252+malpou@users.noreply.github.com>
1 parent 937a69c commit 003c048

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

tests/checks/placeholder_pages/placeholder_pages_test.go

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,6 @@ func TestPlaceholderPages(t *testing.T) {
103103
KubectlApplyWithTemplate(t, data, "placeholder-test", testTemplate)
104104
defer KubectlDeleteWithTemplate(t, data, "placeholder-test", testTemplate)
105105

106-
// Wait for deployment to be at 0 replicas (since min is 0)
107-
assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, testName, testNamespace, 0, 6, 10),
108-
"deployment should be at 0 replicas")
109-
110-
// Test placeholder response
111-
testPlaceholderResponse(t, kc)
112-
113-
// Test custom placeholder with script injection
114-
testCustomPlaceholderWithScript(t, kc, data)
115-
}
116-
117-
func testPlaceholderResponse(t *testing.T, kc *kubernetes.Clientset) {
118-
t.Log("--- testing placeholder response ---")
119-
120106
// Create a test pod to make requests
121107
clientPod := `
122108
apiVersion: v1
@@ -131,10 +117,6 @@ spec:
131117
command: ["sleep", "3600"]
132118
`
133119
// Create the pod using KubectlApplyWithTemplate
134-
data := templateData{
135-
TestNamespace: testNamespace,
136-
TestName: testName,
137-
}
138120
KubectlApplyWithTemplate(t, data, "curl-client", clientPod)
139121
defer KubectlDeleteWithTemplate(t, data, "curl-client", clientPod)
140122

@@ -145,6 +127,20 @@ spec:
145127
// Give pod time to fully initialize
146128
_, _ = ExecuteCommand("sleep 5")
147129

130+
// Wait for deployment to be at 0 replicas (since min is 0)
131+
assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, testName, testNamespace, 0, 6, 10),
132+
"deployment should be at 0 replicas")
133+
134+
// Test placeholder response
135+
testPlaceholderResponse(t, kc)
136+
137+
// Test custom placeholder with script injection
138+
testCustomPlaceholderWithScript(t, kc, data)
139+
}
140+
141+
func testPlaceholderResponse(t *testing.T, kc *kubernetes.Clientset) {
142+
t.Log("--- testing placeholder response ---")
143+
148144
// Make request through interceptor
149145
curlCmd := fmt.Sprintf("curl -si -H 'Host: %s.test' http://keda-add-ons-http-interceptor-proxy.keda:8080/", testName)
150146
stdout, stderr, err := ExecCommandOnSpecificPod(t, "curl-client", testNamespace, curlCmd)
@@ -191,7 +187,7 @@ spec:
191187
content: |
192188
<html>
193189
<body>
194-
<h1>Custom placeholder for {{"{{"}} .ServiceName {{"}}"}}</h1>
190+
<h1>Custom placeholder for {{ "{{" }}.ServiceName{{ "}}" }}</h1>
195191
<p>Please wait...</p>
196192
</body>
197193
</html>

0 commit comments

Comments
 (0)