1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Revert "Change related tests from DockerSuite to DockerDaemonSuite in docker_cli_info_test.go"

This reverts commit 0ce5ef279c.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2016-08-31 11:52:22 -07:00
parent b42ab41b8f
commit f0e9997287

View file

@ -63,15 +63,17 @@ func (s *DockerSuite) TestInfoFormat(c *check.C) {
// TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and // TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
// `--cluster-store` properly show the backend's endpoint in info output. // `--cluster-store` properly show the backend's endpoint in info output.
func (s *DockerDaemonSuite) TestInfoDiscoveryBackend(c *check.C) { func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux) testRequires(c, SameHostDaemon, DaemonIsLinux)
d := NewDaemon(c)
discoveryBackend := "consul://consuladdr:consulport/some/path" discoveryBackend := "consul://consuladdr:consulport/some/path"
discoveryAdvertise := "1.1.1.1:2375" discoveryAdvertise := "1.1.1.1:2375"
err := s.d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), fmt.Sprintf("--cluster-advertise=%s", discoveryAdvertise)) err := d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), fmt.Sprintf("--cluster-advertise=%s", discoveryAdvertise))
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
defer d.Stop()
out, err := s.d.Cmd("info") out, err := d.Cmd("info")
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend)) c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise)) c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise))
@ -79,30 +81,33 @@ func (s *DockerDaemonSuite) TestInfoDiscoveryBackend(c *check.C) {
// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with // TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with
// an invalid `--cluster-advertise` configuration // an invalid `--cluster-advertise` configuration
func (s *DockerDaemonSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) { func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux) testRequires(c, SameHostDaemon, DaemonIsLinux)
d := NewDaemon(c)
discoveryBackend := "consul://consuladdr:consulport/some/path" discoveryBackend := "consul://consuladdr:consulport/some/path"
// --cluster-advertise with an invalid string is an error // --cluster-advertise with an invalid string is an error
err := s.d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), "--cluster-advertise=invalid") err := d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), "--cluster-advertise=invalid")
c.Assert(err, checker.Not(checker.IsNil)) c.Assert(err, checker.Not(checker.IsNil))
// --cluster-advertise without --cluster-store is also an error // --cluster-advertise without --cluster-store is also an error
err = s.d.Start("--cluster-advertise=1.1.1.1:2375") err = d.Start("--cluster-advertise=1.1.1.1:2375")
c.Assert(err, checker.Not(checker.IsNil)) c.Assert(err, checker.Not(checker.IsNil))
} }
// TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise` // TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise`
// configured with interface name properly show the advertise ip-address in info output. // configured with interface name properly show the advertise ip-address in info output.
func (s *DockerDaemonSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) { func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
testRequires(c, SameHostDaemon, Network, DaemonIsLinux) testRequires(c, SameHostDaemon, Network, DaemonIsLinux)
d := NewDaemon(c)
discoveryBackend := "consul://consuladdr:consulport/some/path" discoveryBackend := "consul://consuladdr:consulport/some/path"
discoveryAdvertise := "eth0" discoveryAdvertise := "eth0"
err := s.d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), fmt.Sprintf("--cluster-advertise=%s:2375", discoveryAdvertise)) err := d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), fmt.Sprintf("--cluster-advertise=%s:2375", discoveryAdvertise))
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
defer d.Stop()
iface, err := net.InterfaceByName(discoveryAdvertise) iface, err := net.InterfaceByName(discoveryAdvertise)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
@ -112,7 +117,7 @@ func (s *DockerDaemonSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C)
ip, _, err := net.ParseCIDR(addrs[0].String()) ip, _, err := net.ParseCIDR(addrs[0].String())
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
out, err := s.d.Cmd("info") out, err := d.Cmd("info")
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend)) c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String())) c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String()))
@ -159,13 +164,15 @@ func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *check.C) {
c.Assert(out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", 1)) c.Assert(out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", 1))
} }
func (s *DockerDaemonSuite) TestInfoDebug(c *check.C) { func (s *DockerSuite) TestInfoDebug(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux) testRequires(c, SameHostDaemon, DaemonIsLinux)
err := s.d.Start("--debug") d := NewDaemon(c)
err := d.Start("--debug")
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
defer d.Stop()
out, err := s.d.Cmd("--debug", "info") out, err := d.Cmd("--debug", "info")
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Debug Mode (client): true\n") c.Assert(out, checker.Contains, "Debug Mode (client): true\n")
c.Assert(out, checker.Contains, "Debug Mode (server): true\n") c.Assert(out, checker.Contains, "Debug Mode (server): true\n")
@ -176,16 +183,18 @@ func (s *DockerDaemonSuite) TestInfoDebug(c *check.C) {
c.Assert(out, checker.Contains, "Docker Root Dir") c.Assert(out, checker.Contains, "Docker Root Dir")
} }
func (s *DockerDaemonSuite) TestInsecureRegistries(c *check.C) { func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux) testRequires(c, SameHostDaemon, DaemonIsLinux)
registryCIDR := "192.168.1.0/24" registryCIDR := "192.168.1.0/24"
registryHost := "insecurehost.com:5000" registryHost := "insecurehost.com:5000"
err := s.d.Start("--insecure-registry="+registryCIDR, "--insecure-registry="+registryHost) d := NewDaemon(c)
err := d.Start("--insecure-registry="+registryCIDR, "--insecure-registry="+registryHost)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
defer d.Stop()
out, err := s.d.Cmd("info") out, err := d.Cmd("info")
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Insecure Registries:\n") c.Assert(out, checker.Contains, "Insecure Registries:\n")
c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryHost)) c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryHost))