Merge pull request #7170 from unclejack/fix_testinspectlinksstopped
integcli: fix TestInspectLinksStopped with Go1.3 Upstream-commit: 92cba0845c046c0dac2af74b5d717bc799c91984 Component: engine
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user