mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
integration-cli: migrate some "info" tests to integration
- Updated TestInfoSecurityOptions to not rely on CLI output. Note that this test should be migrated to the integration suite, but that suite does not yet have checks for "Seccomp" and "AppArmor" - TestInfoAPIWarnings: don't start with busybox because we're not running containers in this test - Migrate TestInfoDebug to integration suite - Migrate TestInsecureRegistries to integration suite (renamed to TestInfoInsecureRegistries) - Migrate TestRegistryMirrors to integration suite (renamed to TestInfoRegistryMirrors) - Migrate TestInfoDiscoveryBackend to integration suite - Migrate TestInfoDiscoveryInvalidAdvertise to integration suite - Migrate TestInfoDiscoveryAdvertiseInterfaceName to integration suite - Remove TestInfoFormat, which is testing the CLI functionality, and there is an existing test in docker/cli (TestFormatInfo) covering this Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
bebd820628
commit
ec4a34ae2f
4 changed files with 155 additions and 128 deletions
|
@ -3,15 +3,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/client"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestInfoSecurityOptions(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, Apparmor, DaemonIsLinux)
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
if !seccompEnabled() && !Apparmor() {
|
||||
c.Skip("test requires Seccomp and/or AppArmor")
|
||||
}
|
||||
|
||||
out, _ := dockerCmd(c, "info")
|
||||
assert.Assert(c, strings.Contains(out, "Security Options:\n apparmor\n seccomp\n Profile: default\n"))
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer cli.Close()
|
||||
info, err := cli.Info(context.Background())
|
||||
assert.NilError(c, err)
|
||||
|
||||
if Apparmor() {
|
||||
assert.Check(c, is.Contains(info.SecurityOptions, "name=apparmor"))
|
||||
}
|
||||
if seccompEnabled() {
|
||||
assert.Check(c, is.Contains(info.SecurityOptions, "name=seccomp,profile=default"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue