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

integcli: fix TestInspectLinksStopped with Go1.3

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
unclejack 2014-07-23 01:13:52 +03:00
parent c838a4be29
commit d0cbc54f23

View file

@ -122,16 +122,31 @@ func TestInspectLinksStarted(t *testing.T) {
}
func TestInspectLinksStopped(t *testing.T) {
var (
expected = map[string]struct{}{"/container1:/testinspectlink/alias1": {}, "/container2:/testinspectlink/alias2": {}}
result []string
)
defer deleteAllContainers()
cmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10")
cmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10")
cmd(t, "run", "-d", "--name", "testinspectlink", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "true")
links, err := inspectField("testinspectlink", "HostConfig.Links")
links, err := inspectFieldJSON("testinspectlink", "HostConfig.Links")
if err != nil {
t.Fatal(err)
}
if expected := "[/container1:/testinspectlink/alias1 /container2:/testinspectlink/alias2]"; links != expected {
t.Fatalf("Links %s, but expected %s", links, expected)
err = unmarshalJSON([]byte(links), &result)
if err != nil {
t.Fatal(err)
}
output := convertSliceOfStringsToMap(result)
equal := deepEqual(expected, output)
if !equal {
t.Fatalf("Links %s, but expected %s", result, expected)
}
logDone("link - links in stopped container inspect")
}