From d26ed2c33babc6a8516b447bf90de20e474d5d83 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 25 Mar 2021 00:16:23 +0100 Subject: [PATCH] fix assertPortList normalizing being too strict The normalizing was updated with the output of the "docker port" command in mind, but we're normalizing the "expected" output, which is passed without the "->" in front of the mapping, causing some tests to fail; === RUN TestDockerSuite/TestPortHostBinding --- FAIL: TestDockerSuite/TestPortHostBinding (1.21s) docker_cli_port_test.go:324: assertion failed: error is not nil: |:::9876!=[::]:9876| === RUN TestDockerSuite/TestPortList --- FAIL: TestDockerSuite/TestPortList (0.96s) docker_cli_port_test.go:25: assertion failed: error is not nil: |:::9876!=[::]:9876| Signed-off-by: Sebastiaan van Stijn (cherry picked from commit c8599a6537016dc27d01f756c6747aa709554a45) Signed-off-by: Sebastiaan van Stijn --- integration-cli/docker_cli_port_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-cli/docker_cli_port_test.go b/integration-cli/docker_cli_port_test.go index fbef608288..46722ae471 100644 --- a/integration-cli/docker_cli_port_test.go +++ b/integration-cli/docker_cli_port_test.go @@ -161,7 +161,7 @@ func assertPortList(c *testing.T, out string, expected []string) error { // of the CLI used an incorrect output format for mappings on IPv6 addresses // for example, "80/tcp -> :::80" instead of "80/tcp -> [::]:80". oldFormat := func(mapping string) string { - old := strings.Replace(mapping, "-> [", "-> ", 1) + old := strings.Replace(mapping, "[", "", 1) old = strings.Replace(old, "]:", ":", 1) return old }