diff --git a/tests/framework/nginx_log_levels.go b/tests/framework/nginx_log_levels.go new file mode 100644 index 0000000000..dcf0485c54 --- /dev/null +++ b/tests/framework/nginx_log_levels.go @@ -0,0 +1,10 @@ +package framework + +// NGINX Log Prefixes for various log levels +const ( + CritNGINXLog = "[crit]" + ErrorNGINXLog = "[error]" + WarnNGINXLog = "[warn]" + AlertNGINXLog = "[alert]" + EmergNGINXLog = "[emerg]" +) diff --git a/tests/suite/graceful_recovery_test.go b/tests/suite/graceful_recovery_test.go index 5c13961972..c952ad4cc7 100644 --- a/tests/suite/graceful_recovery_test.go +++ b/tests/suite/graceful_recovery_test.go @@ -370,7 +370,13 @@ func getNginxErrorLogs(ngfPodName string) string { ) Expect(err).ToNot(HaveOccurred()) - errPrefixes := []string{"[crit]", "[error]", "[warn]", "[alert]", "[emerg]"} + errPrefixes := []string{ + framework.CritNGINXLog, + framework.ErrorNGINXLog, + framework.WarnNGINXLog, + framework.AlertNGINXLog, + framework.EmergNGINXLog, + } errorLogs := "" for _, line := range strings.Split(nginxLogs, "\n") { diff --git a/tests/suite/scale_test.go b/tests/suite/scale_test.go index 42982883fc..27919a7e46 100644 --- a/tests/suite/scale_test.go +++ b/tests/suite/scale_test.go @@ -368,7 +368,7 @@ The logs are attached only if there are errors. ) nginxErrors := checkLogErrors( "nginx", - []string{"[error]", "[emerg]", "[crit]", "[alert]"}, + []string{framework.ErrorNGINXLog, framework.EmergNGINXLog, framework.CritNGINXLog, framework.AlertNGINXLog}, nil, filepath.Join(testResultsDir, framework.CreateResultsFilename("log", "nginx", *plusEnabled)), )