Skip to content
Snippets Groups Projects
Verified Commit 0d3bdc7c authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: ci pipeline

parent d3015400
Branches
Tags
No related merge requests found
package jobqueue
const (
DOCKER_TEST_HOST_IP = "172.17.0.1"
)
...@@ -33,6 +33,9 @@ func startTestSMTPDockerImageAndContainer(t *testing.T, port string, ctx context ...@@ -33,6 +33,9 @@ func startTestSMTPDockerImageAndContainer(t *testing.T, port string, ctx context
_ = reader _ = reader
host, _, _ := net.SplitHostPort(cli.DaemonHost()) host, _, _ := net.SplitHostPort(cli.DaemonHost())
if host == "" || host == "unix" {
host = DOCKER_TEST_HOST_IP
}
hostConfig := &container.HostConfig{ hostConfig := &container.HostConfig{
PortBindings: nat.PortMap{ PortBindings: nat.PortMap{
...@@ -109,9 +112,7 @@ func TestMailRunner(t *testing.T) { ...@@ -109,9 +112,7 @@ func TestMailRunner(t *testing.T) {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
}) })
host := "172.17.0.1" listener, err := net.Listen("tcp", DOCKER_TEST_HOST_IP+":0")
listener, err := net.Listen("tcp", host+":0")
if err != nil { if err != nil {
t.Errorf("Unexpected error: %v", err) t.Errorf("Unexpected error: %v", err)
return return
...@@ -133,7 +134,7 @@ func TestMailRunner(t *testing.T) { ...@@ -133,7 +134,7 @@ func TestMailRunner(t *testing.T) {
waitCtx, waitCancel := context.WithTimeout(ctx, 60*time.Second) waitCtx, waitCancel := context.WithTimeout(ctx, 60*time.Second)
defer waitCancel() defer waitCancel()
for { for {
conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, portAsString), 1*time.Second) conn, err := net.DialTimeout("tcp", net.JoinHostPort(DOCKER_TEST_HOST_IP, portAsString), 1*time.Second)
if err == nil { if err == nil {
err = conn.Close() err = conn.Close()
assert.Nil(t, err) assert.Nil(t, err)
...@@ -156,7 +157,7 @@ func TestMailRunner(t *testing.T) { ...@@ -156,7 +157,7 @@ func TestMailRunner(t *testing.T) {
From: "from@example.com", From: "from@example.com",
Subject: "this is a test", Subject: "this is a test",
Body: "this is the body", Body: "this is the body",
Server: host, Server: DOCKER_TEST_HOST_IP,
Port: portAsString, Port: portAsString,
Username: "", Username: "",
Password: "", Password: "",
......
...@@ -34,6 +34,9 @@ func startSFTPTestDockerImageAndContainer(t *testing.T, port string, volume stri ...@@ -34,6 +34,9 @@ func startSFTPTestDockerImageAndContainer(t *testing.T, port string, volume stri
_ = reader _ = reader
host, _, _ := net.SplitHostPort(cli.DaemonHost()) host, _, _ := net.SplitHostPort(cli.DaemonHost())
if host == "" || host == "unix" {
host = DOCKER_TEST_HOST_IP
}
hostConfig := &container.HostConfig{ hostConfig := &container.HostConfig{
PortBindings: nat.PortMap{ PortBindings: nat.PortMap{
...@@ -109,9 +112,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) { ...@@ -109,9 +112,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
}) })
host := "172.17.0.1" listener, err := net.Listen("tcp", DOCKER_TEST_HOST_IP+":0")
listener, err := net.Listen("tcp", host+":0")
if err != nil { if err != nil {
t.Errorf("Unexpected error: %v", err) t.Errorf("Unexpected error: %v", err)
return return
...@@ -133,7 +134,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) { ...@@ -133,7 +134,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) {
waitCtx, waitCancel := context.WithTimeout(ctx, 60*time.Second) waitCtx, waitCancel := context.WithTimeout(ctx, 60*time.Second)
defer waitCancel() defer waitCancel()
for { for {
conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, portAsString), 1*time.Second) conn, err := net.DialTimeout("tcp", net.JoinHostPort(DOCKER_TEST_HOST_IP, portAsString), 1*time.Second)
if err == nil { if err == nil {
err = conn.Close() err = conn.Close()
assert.Nil(t, err) assert.Nil(t, err)
...@@ -162,7 +163,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) { ...@@ -162,7 +163,7 @@ func TestSFTPCRunnerLocalToRemote(t *testing.T) {
} }
sftpRunnable := &SFTPRunnable{ sftpRunnable := &SFTPRunnable{
Host: host, Host: DOCKER_TEST_HOST_IP,
Port: portAsInt, Port: portAsInt,
User: "demo", User: "demo",
Insecure: true, Insecure: true,
...@@ -204,9 +205,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) { ...@@ -204,9 +205,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
}) })
host := "127.0.0.1" listener, err := net.Listen("tcp", DOCKER_TEST_HOST_IP+":0")
listener, err := net.Listen("tcp", host+":0")
if err != nil { if err != nil {
t.Errorf("Unexpected error: %v", err) t.Errorf("Unexpected error: %v", err)
return return
...@@ -238,7 +237,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) { ...@@ -238,7 +237,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) {
waitCtx, waitCancel := context.WithTimeout(ctx, 60*time.Second) waitCtx, waitCancel := context.WithTimeout(ctx, 60*time.Second)
defer waitCancel() defer waitCancel()
for { for {
conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, portAsString), 1*time.Second) conn, err := net.DialTimeout("tcp", net.JoinHostPort(DOCKER_TEST_HOST_IP, portAsString), 1*time.Second)
if err == nil { if err == nil {
err = conn.Close() err = conn.Close()
assert.Nil(t, err) assert.Nil(t, err)
...@@ -259,7 +258,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) { ...@@ -259,7 +258,7 @@ func TestSFTPCRunnerRemoteToLocal(t *testing.T) {
tempDir := t.TempDir() tempDir := t.TempDir()
sftpRunnable := &SFTPRunnable{ sftpRunnable := &SFTPRunnable{
Host: host, Host: DOCKER_TEST_HOST_IP,
Port: portAsInt, Port: portAsInt,
User: "demo", User: "demo",
Insecure: true, Insecure: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment