Browse code

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 <github@gone.nl>
(cherry picked from commit c8599a6537016dc27d01f756c6747aa709554a45)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2021/03/25 08:16:23
Showing 1 changed files
... ...
@@ -161,7 +161,7 @@ func assertPortList(c *testing.T, out string, expected []string) error {
161 161
 	// of the CLI used an incorrect output format for mappings on IPv6 addresses
162 162
 	// for example, "80/tcp -> :::80" instead of "80/tcp -> [::]:80".
163 163
 	oldFormat := func(mapping string) string {
164
-		old := strings.Replace(mapping, "-> [", "-> ", 1)
164
+		old := strings.Replace(mapping, "[", "", 1)
165 165
 		old = strings.Replace(old, "]:", ":", 1)
166 166
 		return old
167 167
 	}