Files
moby/integration-cli/docker_cli_info_unix_test.go
Sebastiaan van Stijn d1f70d4f54 client: deprecate NewClientWithOpts in favor of New
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>
2025-10-30 18:09:44 +01:00

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))
}
}