Skip to content

Commit

Permalink
Merge pull request containers#6767 from vrothberg/sec-opt-test
Browse files Browse the repository at this point in the history
e2e inspect: HostConfig.SecurityOpt
  • Loading branch information
openshift-merge-robot authored Jun 26, 2020
2 parents d721f1f + a8cac24 commit 673116c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/e2e/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opencontainers/selinux/go-selinux"
)

var _ = Describe("Podman inspect", func() {
Expand Down Expand Up @@ -263,4 +264,29 @@ var _ = Describe("Podman inspect", func() {
Expect(len(baseJSON)).To(Equal(1))
Expect(baseJSON[0].Name).To(Equal(ctrName))
})

It("podman inspect - HostConfig.SecurityOpt ", func() {
if !selinux.GetEnabled() {
Skip("SELinux not enabled")
}

ctrName := "hugo"
create := podmanTest.PodmanNoCache([]string{
"create", "--name", ctrName,
"--security-opt", "seccomp=unconfined",
"--security-opt", "label=type:spc_t",
"--security-opt", "label=level:s0",
ALPINE, "sh"})

create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))

baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect.ExitCode()).To(Equal(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(len(baseJSON)).To(Equal(1))
Expect(baseJSON[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
})

})

0 comments on commit 673116c

Please sign in to comment.