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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2024-09-11 10:45:16 +02:00 committed by mergify[bot]
parent c48f5bff37
commit 5c621d2e82
2 changed files with 11 additions and 0 deletions

View File

@ -250,6 +250,8 @@ func (yrn *yamlResourceNamespaced) Do(action kubectlAction) error {
return fmt.Errorf("failed to read content from %q: %w", yrn.filename, err) return fmt.Errorf("failed to read content from %q: %w", yrn.filename, err)
} }
data = replaceLogLevelInTemplate(data)
if yrn.oneReplica { if yrn.oneReplica {
data = oneReplicaDeployYaml(data) data = oneReplicaDeployYaml(data)
} }

View File

@ -823,6 +823,15 @@ func oneReplicaDeployYaml(template string) string {
return re.ReplaceAllString(template, `$1 1`) 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=<number> 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 { func enableReadAffinityInTemplate(template string) string {
return strings.ReplaceAll(template, "# - \"--enable-read-affinity=true\"", "- \"--enable-read-affinity=true\"") return strings.ReplaceAll(template, "# - \"--enable-read-affinity=true\"", "- \"--enable-read-affinity=true\"")
} }