mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Austin Vazquez <austin.vazquez@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
35 lines
911 B
Go
35 lines
911 B
Go
//go:build !windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/moby/moby/client"
|
|
"github.com/moby/moby/v2/daemon/config"
|
|
"github.com/moby/moby/v2/internal/testutil"
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
)
|
|
|
|
func (s *DockerCLIInfoSuite) TestInfoSecurityOptions(c *testing.T) {
|
|
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
|
if !seccompEnabled() && !Apparmor() {
|
|
c.Skip("test requires Seccomp and/or AppArmor")
|
|
}
|
|
|
|
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
|
assert.NilError(c, err)
|
|
defer apiClient.Close()
|
|
result, err := apiClient.Info(testutil.GetContext(c), client.InfoOptions{})
|
|
assert.NilError(c, err)
|
|
info := result.Info
|
|
|
|
if Apparmor() {
|
|
assert.Check(c, is.Contains(info.SecurityOptions, "name=apparmor"))
|
|
}
|
|
if seccompEnabled() {
|
|
assert.Check(c, is.Contains(info.SecurityOptions, "name=seccomp,profile="+config.SeccompProfileDefault))
|
|
}
|
|
}
|