diff --git a/runnable-mail_test.go b/runnable-mail_test.go index 8fbc22a07a7ee6e3b25321b9d77e378ad9b17ab7..a0705f83b31491d3e83d2c2349a01b0b0f194ebb 100644 --- a/runnable-mail_test.go +++ b/runnable-mail_test.go @@ -13,7 +13,7 @@ import ( "time" ) -func startTestSMTPDockerImageAndContainer(t *testing.T, host string, port string, ctx context.Context) error { +func startTestSMTPDockerImageAndContainer(t *testing.T, port string, ctx context.Context) error { t.Helper() cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) @@ -32,6 +32,8 @@ func startTestSMTPDockerImageAndContainer(t *testing.T, host string, port string //_, _ = io.Copy(os.Stdout, reader) _ = reader + host, _, _ := net.SplitHostPort(cli.DaemonHost()) + hostConfig := &container.HostConfig{ PortBindings: nat.PortMap{ "1025/tcp": []nat.PortBinding{ @@ -120,7 +122,7 @@ func TestMailRunner(t *testing.T) { done := make(chan bool) go func() { - err = startTestSMTPDockerImageAndContainer(t, host, portAsString, ctx) + err = startTestSMTPDockerImageAndContainer(t, portAsString, ctx) if err != nil { t.Errorf("Unexpected error: %v", err) cancel() diff --git a/runnable-sftp_test.go b/runnable-sftp_test.go index cfca7efee2205a9ddb7ca773bccf87040988a624..5cad56d11278c29f75be4d6fe7f3acc4f01fad63 100644 --- a/runnable-sftp_test.go +++ b/runnable-sftp_test.go @@ -14,7 +14,7 @@ import ( "time" ) -func startSFTPTestDockerImageAndContainer(t *testing.T, host string, port string, volume string, ctx context.Context) error { +func startSFTPTestDockerImageAndContainer(t *testing.T, port string, volume string, ctx context.Context) error { t.Helper() cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) @@ -33,6 +33,8 @@ func startSFTPTestDockerImageAndContainer(t *testing.T, host string, port string //_, _ = io.Copy(os.Stdout, reader) _ = reader + host, _, _ := net.SplitHostPort(cli.DaemonHost()) + hostConfig := &container.HostConfig{ PortBindings: nat.PortMap{ "22/tcp": []nat.PortBinding{ @@ -120,7 +122,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) { done := make(chan bool) go func() { - err = startSFTPTestDockerImageAndContainer(t, host, portAsString, "", ctx) + err = startSFTPTestDockerImageAndContainer(t, "portAsString, "", ctx) if err != nil { t.Errorf("Unexpected error: %v", err) cancel() @@ -225,7 +227,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) { done := make(chan bool) go func() { - err = startSFTPTestDockerImageAndContainer(t, host, portAsString, tempSrcDir, ctx) + err = startSFTPTestDockerImageAndContainer(t, portAsString, tempSrcDir, ctx) if err != nil { t.Errorf("Unexpected error: %v", err) cancel()