Skip to content

Commit 78c924b

Browse files
committed
testing: functional tests pipeline failures
1 parent d455f08 commit 78c924b

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

tests/suite/graceful_recovery_test.go

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,23 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
5151

5252
checkForWorkingTraffic := func(teaURL, coffeeURL string) error {
5353
if err := expectRequestToSucceed(teaURL, address, "URI: /tea"); err != nil {
54+
fmt.Println("checkForWorkingTraffic failed for teaURL:", teaURL, "with error:", err)
5455
return err
5556
}
5657
if err := expectRequestToSucceed(coffeeURL, address, "URI: /coffee"); err != nil {
58+
fmt.Println("checkForWorkingTraffic failed for coffeeURL:", coffeeURL, "with error:", err)
5759
return err
5860
}
5961
return nil
6062
}
6163

6264
checkForFailingTraffic := func(teaURL, coffeeURL string) error {
6365
if err := expectRequestToFail(teaURL, address); err != nil {
66+
fmt.Println("checkForFailingTraffic failed for teaURL:", teaURL, "with error:", err)
6467
return err
6568
}
6669
if err := expectRequestToFail(coffeeURL, address); err != nil {
70+
fmt.Println("checkForFailingTraffic failed for coffeeURL:", coffeeURL, "with error:", err)
6771
return err
6872
}
6973
return nil
@@ -89,7 +93,10 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
8993
}
9094

9195
checkContainerRestart := func(podName, containerName, namespace string, currentRestartCount int) error {
96+
fmt.Println("Checking if container restart count has incremented...")
9297
restartCount, err := getContainerRestartCount(podName, namespace, containerName)
98+
fmt.Println("Current restart count for container:", restartCount)
99+
fmt.Println("error:", err)
93100
if err != nil {
94101
return err
95102
}
@@ -157,9 +164,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
157164
}
158165

159166
restartNginxContainer := func(nginxPodName, namespace, containerName string) {
167+
fmt.Println("restarting NGINX container in Pod:", nginxPodName)
160168
jobScript := "PID=$(pgrep -f \"nginx-agent\") && kill -9 $PID"
161169

162170
restartCount, err := getContainerRestartCount(nginxPodName, namespace, containerName)
171+
fmt.Println("Current restart count for NGINX container:", restartCount)
172+
fmt.Println("error:", err)
163173
Expect(err).ToNot(HaveOccurred())
164174

165175
cleanUpPortForward()
@@ -235,17 +245,22 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
235245

236246
runRestartNodeTest := func(teaURL, coffeeURL string, files []string, ns *core.Namespace, drain bool) {
237247
nodeNames, err := getNodeNames()
248+
fmt.Println("Node names:", nodeNames)
238249
Expect(err).ToNot(HaveOccurred())
239250
Expect(nodeNames).To(HaveLen(1))
240251

241252
kindNodeName := nodeNames[0]
253+
fmt.Println("Kind node name:", kindNodeName)
242254

243255
Expect(clusterName).ToNot(BeNil(), "clusterName variable not set")
256+
fmt.Println("Cluster name:", *clusterName)
244257
Expect(*clusterName).ToNot(BeEmpty())
245258
containerName := *clusterName + "-control-plane"
259+
fmt.Println("Container name:", containerName)
246260

247261
cleanUpPortForward()
248262

263+
fmt.Println("drain:", drain)
249264
if drain {
250265
output, err := exec.Command(
251266
"kubectl",
@@ -255,15 +270,20 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
255270
"--delete-emptydir-data",
256271
).CombinedOutput()
257272

273+
fmt.Println("Output of kubectl drain command:", string(output))
274+
fmt.Println("Error of kubectl drain command:", err)
275+
258276
Expect(err).ToNot(HaveOccurred(), string(output))
259277

260278
output, err = exec.Command("kubectl", "delete", "node", kindNodeName).CombinedOutput()
261279
Expect(err).ToNot(HaveOccurred(), string(output))
262280
}
263281

264-
_, err = exec.Command("docker", "restart", containerName).CombinedOutput()
282+
restart, err := exec.Command("docker", "restart", containerName).CombinedOutput()
265283
Expect(err).ToNot(HaveOccurred())
266284

285+
fmt.Println("docker restart output:", string(restart))
286+
fmt.Println("docker restart error:", err)
267287
// need to wait for docker container to restart and be running before polling for ready NGF Pods or else we will error
268288
Eventually(
269289
func() bool {
@@ -274,6 +294,8 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
274294
"{{.State.Running}}",
275295
containerName,
276296
).CombinedOutput()
297+
fmt.Println("docker inspect output:", string(output))
298+
fmt.Println("docker inspect error:", err)
277299
return strings.TrimSpace(string(output)) == "true" && err == nil
278300
}).
279301
WithTimeout(timeoutConfig.CreateTimeout).
@@ -290,6 +312,8 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
290312
releaseName,
291313
timeoutConfig.GetStatusTimeout,
292314
)
315+
fmt.Println("NGF Pod names:", podNames)
316+
fmt.Println("NGF Pod error:", err)
293317
return len(podNames) == 1 && err == nil
294318
}).
295319
WithTimeout(timeoutConfig.CreateTimeout * 2).
@@ -298,6 +322,9 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
298322
Should(BeTrue())
299323
newNGFPodName := podNames[0]
300324

325+
fmt.Print("New NGF Pod name:", newNGFPodName)
326+
fmt.Print("Active NGF Pod name:", activeNGFPodName)
327+
301328
// expected behavior is when node is drained, new pods will be created. when the node is
302329
// abruptly restarted, new pods are not created.
303330
if drain {
@@ -328,6 +355,8 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
328355

329356
setUpPortForward(activeNginxPodName, ns.Name)
330357

358+
fmt.Println("Active Nginx Pod name:", activeNginxPodName)
359+
331360
// sets activeNginxPodName to new pod
332361
checkNGFFunctionality(teaURL, coffeeURL, files, ns)
333362

@@ -522,6 +551,7 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
522551

523552
func expectRequestToSucceed(appURL, address string, responseBodyMessage string) error {
524553
status, body, err := framework.Get(appURL, address, timeoutConfig.RequestTimeout, nil, nil)
554+
fmt.Println("expectRequestToSucceed", "HTTP status:", status, "Response body:", body)
525555

526556
if status != http.StatusOK {
527557
return errors.New("http status was not 200")
@@ -536,6 +566,7 @@ func expectRequestToSucceed(appURL, address string, responseBodyMessage string)
536566

537567
func expectRequestToFail(appURL, address string) error {
538568
status, body, err := framework.Get(appURL, address, timeoutConfig.RequestTimeout, nil, nil)
569+
fmt.Println("expectRequestToFail", "HTTP status:", status, "Response body:", body)
539570
if status != 0 {
540571
return errors.New("expected http status to be 0")
541572
}

0 commit comments

Comments
 (0)