From 5c621d2e82bb333e47fb546cb9cac24d5338bce9 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 11 Sep 2024 10:45:16 +0200 Subject: [PATCH] e2e: set log level to 5 in csi pods all the sidecar log level is not set to 5 by default, without debug logs we cannot understand what is wrong in the tests, this commits sets the log level to 5 for csi pods. Signed-off-by: Madhu Rajanna --- e2e/deployment.go | 2 ++ e2e/utils.go | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/e2e/deployment.go b/e2e/deployment.go index 15e6ce885..12b86acda 100644 --- a/e2e/deployment.go +++ b/e2e/deployment.go @@ -250,6 +250,8 @@ func (yrn *yamlResourceNamespaced) Do(action kubectlAction) error { return fmt.Errorf("failed to read content from %q: %w", yrn.filename, err) } + data = replaceLogLevelInTemplate(data) + if yrn.oneReplica { data = oneReplicaDeployYaml(data) } diff --git a/e2e/utils.go b/e2e/utils.go index 247c9b89e..9f05604f8 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -823,6 +823,15 @@ func oneReplicaDeployYaml(template string) string { return re.ReplaceAllString(template, `$1 1`) } +// replaceLogLevelInTemplate replaces the log level in the template file to 5. +func replaceLogLevelInTemplate(template string) string { + // Regular expression to find --v= arguments + re := regexp.MustCompile(`--v=\d+`) + + // template can contain different log levels, replace it with --v=5 + return re.ReplaceAllString(template, "--v=5") +} + func enableReadAffinityInTemplate(template string) string { return strings.ReplaceAll(template, "# - \"--enable-read-affinity=true\"", "- \"--enable-read-affinity=true\"") }