Skip to content

Commit 5bf9d66

Browse files
committed
Update graceful recovery test to skip test case on plus
1 parent cd9a4d1 commit 5bf9d66

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

tests/suite/graceful_recovery_test.go

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
331331
// sets activeNginxPodName to new pod
332332
checkNGFFunctionality(teaURL, coffeeURL, files, ns)
333333

334-
checkNGFContainerLogsForErrors(activeNGFPodName)
334+
if errorLogs := getNGFErrorLogs(activeNGFPodName); errorLogs != "" {
335+
fmt.Printf("NGF has error logs: \n%s", errorLogs)
336+
}
335337

336338
if errorLogs := getUnexpectedNginxErrorLogs(activeNginxPodName, ns.Name); errorLogs != "" {
337-
Skip(fmt.Sprintf("NGINX has unexpected error logs: \n%s", errorLogs))
339+
fmt.Printf("NGINX has unexpected error logs: \n%s", errorLogs)
338340
}
339341
}
340342

@@ -441,10 +443,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
441443
// sets activeNginxPodName to new pod
442444
checkNGFFunctionality(teaURL, coffeeURL, files, &ns)
443445

444-
checkNGFContainerLogsForErrors(activeNGFPodName)
446+
if errorLogs := getNGFErrorLogs(activeNGFPodName); errorLogs != "" {
447+
fmt.Printf("NGF has error logs: \n%s", errorLogs)
448+
}
445449

446450
if errorLogs := getUnexpectedNginxErrorLogs(activeNginxPodName, ns.Name); errorLogs != "" {
447-
Skip(fmt.Sprintf("NGINX has unexpected error logs: \n%s", errorLogs))
451+
fmt.Printf("NGINX has unexpected error logs: \n%s", errorLogs)
448452
}
449453
})
450454

@@ -493,10 +497,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
493497
// sets activeNginxPodName to new pod
494498
checkNGFFunctionality(teaURL, coffeeURL, files, &ns)
495499

496-
checkNGFContainerLogsForErrors(activeNGFPodName)
500+
if errorLogs := getNGFErrorLogs(activeNGFPodName); errorLogs != "" {
501+
fmt.Printf("NGF has error logs: \n%s", errorLogs)
502+
}
497503

498504
if errorLogs := getUnexpectedNginxErrorLogs(activeNginxPodName, ns.Name); errorLogs != "" {
499-
Skip(fmt.Sprintf("NGINX has unexpected error logs: \n%s", errorLogs))
505+
fmt.Printf("NGINX has unexpected error logs: \n%s", errorLogs)
500506
}
501507
})
502508

@@ -505,6 +511,10 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
505511
})
506512

507513
It("recovers when node is restarted abruptly", func() {
514+
if *plusEnabled {
515+
Skip(fmt.Sprintf("Skipping test when using NGINX Plus due to known issue:" +
516+
" https://github.com/nginx/nginx-gateway-fabric/issues/3248"))
517+
}
508518
runRestartNodeAbruptlyTest(teaURL, coffeeURL, files, &ns)
509519
})
510520
})
@@ -594,6 +604,27 @@ func getUnexpectedNginxErrorLogs(nginxPodName, namespace string) string {
594604
return unexpectedErrors
595605
}
596606

607+
// getNGFErrorLogs gets NGF container error logs.
608+
func getNGFErrorLogs(ngfPodName string) string {
609+
ngfLogs, err := resourceManager.GetPodLogs(
610+
ngfNamespace,
611+
ngfPodName,
612+
&core.PodLogOptions{Container: ngfContainerName},
613+
)
614+
Expect(err).ToNot(HaveOccurred())
615+
616+
errorLogs := ""
617+
618+
for _, line := range strings.Split(ngfLogs, "\n") {
619+
if strings.Contains(line, "\"level\":\"error\"") {
620+
errorLogs += line + "\n"
621+
break
622+
}
623+
}
624+
625+
return errorLogs
626+
}
627+
597628
// checkNGFContainerLogsForErrors checks NGF container's logs for any possible errors.
598629
func checkNGFContainerLogsForErrors(ngfPodName string) {
599630
ngfLogs, err := resourceManager.GetPodLogs(

0 commit comments

Comments
 (0)