From a1776e4fe6c021cede7e0a6f782ac9700c5071ec Mon Sep 17 00:00:00 2001 From: David Gannon <19214156+dgannon991@users.noreply.github.com> Date: Mon, 13 Jan 2025 21:36:40 +0000 Subject: [PATCH] Changed how we get the docker port Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com> --- e2e/helper_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/helper_test.go b/e2e/helper_test.go index 6a10c55..4b7cd7a 100644 --- a/e2e/helper_test.go +++ b/e2e/helper_test.go @@ -38,5 +38,6 @@ func (c *Container) Stop(t *testing.T) { // GetAddress returns the host:port this container listens on func (c *Container) GetAddress(t *testing.T) string { result := icmd.RunCommand("docker", "port", c.container, strconv.Itoa(c.privatePort)).Assert(t, icmd.Success) - return fmt.Sprintf("127.0.0.1:%v", strings.Trim(strings.Split(result.Stdout(), ":")[1], " \r\n")) + port := strings.Split(strings.Split(result.Stdout(), ":")[1], "\n")[0] + return fmt.Sprintf("127.0.0.1:%v", strings.Trim(port, " \r\n")) }