summaryrefslogtreecommitdiff
path: root/test/e2e/run_privileged_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/run_privileged_test.go')
-rw-r--r--test/e2e/run_privileged_test.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index d793a01f8..b894c7b1c 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -21,18 +21,18 @@ func containerCapMatchesHost(ctrCap string, hostCap string) {
if isRootless() {
return
}
- ctrCap_n, err := strconv.ParseUint(ctrCap, 16, 64)
+ ctrCapN, err := strconv.ParseUint(ctrCap, 16, 64)
Expect(err).NotTo(HaveOccurred(), "Error parsing %q as hex", ctrCap)
- hostCap_n, err := strconv.ParseUint(hostCap, 16, 64)
+ hostCapN, err := strconv.ParseUint(hostCap, 16, 64)
Expect(err).NotTo(HaveOccurred(), "Error parsing %q as hex", hostCap)
// host caps can never be zero (except rootless).
// and host caps must always be a superset (inclusive) of container
- Expect(hostCap_n).To(BeNumerically(">", 0), "host cap %q should be nonzero", hostCap)
- Expect(hostCap_n).To(BeNumerically(">=", ctrCap_n), "host cap %q should never be less than container cap %q", hostCap, ctrCap)
- hostCap_masked := hostCap_n & (1<<len(capability.List()) - 1)
- Expect(ctrCap_n).To(Equal(hostCap_masked), "container cap %q is not a subset of host cap %q", ctrCap, hostCap)
+ Expect(hostCapN).To(BeNumerically(">", 0), "host cap %q should be nonzero", hostCap)
+ Expect(hostCapN).To(BeNumerically(">=", ctrCapN), "host cap %q should never be less than container cap %q", hostCap, ctrCap)
+ hostCapMasked := hostCapN & (1<<len(capability.List()) - 1)
+ Expect(ctrCapN).To(Equal(hostCapMasked), "container cap %q is not a subset of host cap %q", ctrCap, hostCap)
}
var _ = Describe("Podman privileged container tests", func() {
@@ -63,9 +63,7 @@ var _ = Describe("Podman privileged container tests", func() {
session := podmanTest.Podman([]string{"run", "--privileged", BB, "mount"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- ok, lines := session.GrepString("sysfs")
- Expect(ok).To(BeTrue())
- Expect(lines[0]).To(ContainSubstring("sysfs (rw,"))
+ Expect(session.OutputToString()).To(ContainSubstring("sysfs (rw,"))
})
It("podman privileged CapEff", func() {
@@ -124,7 +122,7 @@ var _ = Describe("Podman privileged container tests", func() {
session := podmanTest.Podman([]string{"run", "-t", BB, "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(17))
+ Expect(session.OutputToStringArray()).To(HaveLen(17))
})
It("podman privileged should inherit host devices", func() {