diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 64264cd813..3b1c1c230e 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "os" "os/exec" "path/filepath" @@ -592,8 +591,12 @@ func TestBuildRm(t *testing.T) { } func TestBuildWithVolumes(t *testing.T) { - name := "testbuildvolumes" - expected := "map[/test1:map[] /test2:map[]]" + var ( + result map[string]map[string]struct{} + name = "testbuildvolumes" + emptyMap = make(map[string]struct{}) + expected = map[string]map[string]struct{}{"/test1": emptyMap, "/test2": emptyMap} + ) defer deleteImages(name) _, err := buildImage(name, `FROM scratch @@ -603,13 +606,22 @@ func TestBuildWithVolumes(t *testing.T) { if err != nil { t.Fatal(err) } - res, err := inspectField(name, "Config.Volumes") + res, err := inspectFieldJSON(name, "Config.Volumes") if err != nil { t.Fatal(err) } - if res != expected { - t.Fatalf("Volumes %s, expected %s", res, expected) + + err = unmarshalJSON([]byte(res), &result) + if err != nil { + t.Fatal(err) } + + equal := deepEqual(&expected, &result) + + if !equal { + t.Fatalf("Volumes %s, expected %s", result, expected) + } + logDone("build - with volumes") } diff --git a/integration-cli/docker_cli_links_test.go b/integration-cli/docker_cli_links_test.go index d2616475c9..d5336a62c8 100644 --- a/integration-cli/docker_cli_links_test.go +++ b/integration-cli/docker_cli_links_test.go @@ -93,16 +93,30 @@ func TestIpTablesRulesWhenLinkAndUnlink(t *testing.T) { } func TestInspectLinksStarted(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", "sleep", "10") - 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, expected %s", result, expected) } logDone("link - links in started container inspect") }