tests: Fixes tests for Windows (containerd, RunAsUserName)

Since we've added support for RunAsUserName, we can now run some new
tests. However, the [LinuxOnly] tag will have to remain until the
WindowsRunAsUserName feature becomes enabled by default.

Additionally, Containerd supports file mounting on Windows, and some
tests will be able to pass on Windows with Containerd instead of Docker.
This commit is contained in:
Claudiu Belu
2019-07-05 12:23:04 +00:00
parent ef479c1a6f
commit f0e6d8ed09
10 changed files with 89 additions and 65 deletions

View File

@@ -91,13 +91,12 @@ var _ = ginkgo.Describe("[sig-storage] Projected downwardAPI", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001)
gid := int64(1234)
pod := downwardAPIVolumePodForSimpleTest(podName, "/etc/podinfo/podname")
pod.Spec.SecurityContext = &v1.PodSecurityContext{
RunAsUser: &uid,
FSGroup: &gid,
FSGroup: &gid,
}
setPodNonRootUser(pod)
f.TestContainerOutput("downward API volume plugin", pod, 0, []string{
fmt.Sprintf("%s\n", podName),
})
@@ -107,14 +106,13 @@ var _ = ginkgo.Describe("[sig-storage] Projected downwardAPI", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options, and it does not support setting file permissions.
framework.SkipIfNodeOSDistroIs("windows")
podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001)
gid := int64(1234)
mode := int32(0440) /* setting fsGroup sets mode to at least 440 */
pod := projectedDownwardAPIVolumePodForModeTest(podName, "/etc/podinfo/podname", &mode, nil)
pod.Spec.SecurityContext = &v1.PodSecurityContext{
RunAsUser: &uid,
FSGroup: &gid,
FSGroup: &gid,
}
setPodNonRootUser(pod)
f.TestContainerOutput("downward API volume plugin", pod, 0, []string{
"mode of file \"/etc/podinfo/podname\": -r--r-----",
})