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