Move privilege e2e test to common

This commit is contained in:
Jefftree
2019-09-26 15:33:59 -07:00
parent 7fab683455
commit 40976754b5
3 changed files with 14 additions and 46 deletions

View File

@@ -271,6 +271,19 @@ var _ = framework.KubeDescribe("Security Context", func() {
framework.Failf("unprivileged container shouldn't be able to create dummy device")
}
})
ginkgo.It("should run the container as privileged when true [LinuxOnly] [NodeFeature:HostAccess]", func() {
podName := createAndWaitUserPod(true)
logs, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)
if err != nil {
framework.Failf("GetPodLogs for pod %q failed: %v", podName, err)
}
framework.Logf("Got logs for pod %q: %q", podName, logs)
if strings.Contains(logs, "Operation not permitted") {
framework.Failf("privileged container should be able to create dummy device")
}
})
})
ginkgo.Context("when creating containers with AllowPrivilegeEscalation", func() {