mirror of
https://github.com/moby/moby.git
synced 2026-01-11 02:31:44 +00:00
Use a more idiomatic name so that it can be used as `client.New()`. We should look if we want `New()` to have different / updated defaults i.e., enable `WithEnv` as default, and have an opt-out and have API- version negotiation enabled by default (with an opt-out option). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
35 lines
897 B
Go
35 lines
897 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.New(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))
|
|
}
|
|
}
|