Skip to content

Commit

Permalink
Fix seccomp value in test
Browse files Browse the repository at this point in the history
The seccomp value should be `2` rather than `1`. The test succeeded
because we also have the value `Seccomp_filters` which gets matched by
"ecc", too. We now check for "Seccomp:" to actually match the right
field.

Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Aug 10, 2023
1 parent b9442e6 commit bed9a6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/validate/security_context_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ var _ = framework.KubeDescribe("Security Context", func() {
podID, containerID = seccompTestContainer(rc, ic, seccompProfile)

By("verify seccomp profile")
verifySeccomp(rc, containerID, []string{"grep", "ecc", "/proc/self/status"}, false, "0") // seccomp disabled
verifySeccomp(rc, containerID, []string{"grep", "Seccomp:", "/proc/self/status"}, false, "0") // seccomp disabled
})

It("should support seccomp localhost profile on the container", func() {
Expand All @@ -714,7 +714,7 @@ var _ = framework.KubeDescribe("Security Context", func() {
podID, containerID = seccompTestContainer(rc, ic, seccompProfile)

By("verify seccomp profile")
verifySeccomp(rc, containerID, []string{"grep", "ecc", "/proc/self/status"}, false, "1") // seccomp enabled
verifySeccomp(rc, containerID, []string{"grep", "Seccomp:", "/proc/self/status"}, false, "2") // seccomp enabled
})

It("should support nil profile, which is unconfined", func() {
Expand All @@ -724,7 +724,7 @@ var _ = framework.KubeDescribe("Security Context", func() {
podID, containerID = seccompTestContainer(rc, ic, nil)

By("verify seccomp profile")
verifySeccomp(rc, containerID, []string{"grep", "ecc", "/proc/self/status"}, false, "0") // seccomp disabled
verifySeccomp(rc, containerID, []string{"grep", "Seccomp:", "/proc/self/status"}, false, "0") // seccomp disabled
})

// SYS_ADMIN capability allows sethostname, and seccomp is unconfined. sethostname should work.
Expand Down

0 comments on commit bed9a6b

Please sign in to comment.