github.com/goern/docker@v1.9.0-rc1/integration-cli/docker_cli_info_test.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	"github.com/docker/docker/pkg/integration/checker"
     8  	"github.com/docker/docker/utils"
     9  	"github.com/go-check/check"
    10  )
    11  
    12  // ensure docker info succeeds
    13  func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
    14  	out, _ := dockerCmd(c, "info")
    15  
    16  	// always shown fields
    17  	stringsToCheck := []string{
    18  		"ID:",
    19  		"Containers:",
    20  		"Images:",
    21  		"Execution Driver:",
    22  		"Logging Driver:",
    23  		"Operating System:",
    24  		"CPUs:",
    25  		"Total Memory:",
    26  		"Kernel Version:",
    27  		"Storage Driver:",
    28  	}
    29  
    30  	if utils.ExperimentalBuild() {
    31  		stringsToCheck = append(stringsToCheck, "Experimental: true")
    32  	}
    33  
    34  	for _, linePrefix := range stringsToCheck {
    35  		if !strings.Contains(out, linePrefix) {
    36  			c.Errorf("couldn't find string %v in output", linePrefix)
    37  		}
    38  	}
    39  }
    40  
    41  // TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
    42  // `--cluster-store` properly show the backend's endpoint in info output.
    43  func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
    44  	testRequires(c, SameHostDaemon)
    45  
    46  	d := NewDaemon(c)
    47  	discoveryBackend := "consul://consuladdr:consulport/some/path"
    48  	if err := d.Start(fmt.Sprintf("--cluster-store=%s", discoveryBackend), "--cluster-advertise=foo"); err != nil {
    49  		c.Fatal(err)
    50  	}
    51  	defer d.Stop()
    52  
    53  	out, err := d.Cmd("info")
    54  	c.Assert(err, checker.IsNil)
    55  	c.Assert(out, checker.Contains, fmt.Sprintf("Cluster store: %s\n", discoveryBackend))
    56  }