Skip to content

Commit 4fdbb70

Browse files
committed
Remove exists() from getEndpoint()
Should fix tests running under travis build and boot2docker where unix:///var/run/docker.sock does not exist. exists was not necessary since connecting to a non-existent unix socket would fail anyways and is already handled.
1 parent 0e24cd2 commit 4fdbb70

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

utils.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"errors"
54
"os"
65
)
76

@@ -15,21 +14,10 @@ func getEndpoint() (string, error) {
1514
defaultEndpoint = endpoint
1615
}
1716

18-
proto, host, err := parseHost(defaultEndpoint)
17+
_, _, err := parseHost(defaultEndpoint)
1918
if err != nil {
2019
return "", err
2120
}
2221

23-
if proto == "unix" {
24-
exist, err := exists(host)
25-
if err != nil {
26-
return "", err
27-
}
28-
29-
if !exist {
30-
return "", errors.New(host + " does not exist")
31-
}
32-
}
33-
3422
return defaultEndpoint, nil
3523
}

utils_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ func TestDockerFlagEndpoint(t *testing.T) {
5555
}
5656
}
5757

58-
func TestUnixNotExists(t *testing.T) {
59-
60-
endpoint = ""
61-
err := os.Setenv("DOCKER_HOST", "unix:///does/not/exist")
62-
if err != nil {
63-
t.Fatalf("Unable to set DOCKER_HOST: %s", err)
64-
}
65-
66-
_, err = getEndpoint()
67-
if err == nil {
68-
t.Fatal("endpoint should have failed")
69-
}
70-
}
71-
7258
func TestUnixBadFormat(t *testing.T) {
7359
endpoint = "unix:/var/run/docker.sock"
7460
_, err := getEndpoint()

0 commit comments

Comments
 (0)