tests: Use Windows absolute path on Windows pods

The test "should fail substituting values in a volume subpath with absolute path" creates a pod
with a variable expansion path which is set as an absolute path. However "/tmp" is not an absolute
on Windows, it has to be prefixed with the drive letter (C:\tmp). But C:\tmp does not typically
exist on Windows nodes, so we use C:\Users instead.
This commit is contained in:
Claudiu Belu 2020-08-18 13:35:48 -07:00
parent 72a26aed7d
commit 8ca08f1ced

View File

@ -181,11 +181,16 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
Description: Make sure a container's subpath can not be set using an expansion of environment variables when absolute path is supplied.
*/
framework.ConformanceIt("should fail substituting values in a volume subpath with absolute path [sig-storage][Slow]", func() {
absolutePath := "/tmp"
if framework.NodeOSDistroIs("windows") {
// Windows does not typically have a C:\tmp folder.
absolutePath = "C:\\Users"
}
envVars := []v1.EnvVar{
{
Name: "POD_NAME",
Value: "/tmp",
Value: absolutePath,
},
}
mounts := []v1.VolumeMount{