Skip to content

Commit

Permalink
Move nginx log levels to file
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-osborn committed Jan 3, 2025
1 parent 9a47b6d commit 55c5bf2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions tests/framework/nginx_log_levels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package framework

// NGINX Log Prefixes for various log levels

Check failure on line 3 in tests/framework/nginx_log_levels.go

View workflow job for this annotation

GitHub Actions / Go Lint (tests)

Comment should end in a period (godot)
const (
CritNGINXLog = "[crit]"
ErrorNGINXLog = "[error]"
WarnNGINXLog = "[warn]"
AlertNGINXLog = "[alert]"
EmergNGINXLog = "[emerg]"
)
8 changes: 7 additions & 1 deletion tests/suite/graceful_recovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
)
Expand Down

0 comments on commit 55c5bf2

Please sign in to comment.