e2e: replace quoted namespace in templates too

Some templates are now generated with the API, and these include
namespaces as "quotes" values. Namespace replacing in the templates need
to replace both the unquoted and quoted strings.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-03-14 14:40:24 +01:00 committed by mergify[bot]
parent 32de26828f
commit a469a66f9d

View File

@ -94,5 +94,9 @@ func replaceNamespaceInTemplate(filePath string) (string, error) {
return "", err
}
return strings.ReplaceAll(string(read), "namespace: default", fmt.Sprintf("namespace: %s", cephCSINamespace)), nil
// template can contain "default" as namespace, with or without ".
templ := strings.ReplaceAll(string(read), "namespace: default", fmt.Sprintf("namespace: %s", cephCSINamespace))
templ = strings.ReplaceAll(templ, "namespace: \"default\"", fmt.Sprintf("namespace: %s", cephCSINamespace))
return templ, nil
}