Skip to content

Remove exists() from getEndpoint() #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions utils.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"errors"
"os"
)

Expand All @@ -15,21 +14,10 @@ func getEndpoint() (string, error) {
defaultEndpoint = endpoint
}

proto, host, err := parseHost(defaultEndpoint)
_, _, err := parseHost(defaultEndpoint)
if err != nil {
return "", err
}

if proto == "unix" {
exist, err := exists(host)
if err != nil {
return "", err
}

if !exist {
return "", errors.New(host + " does not exist")
}
}

return defaultEndpoint, nil
}
14 changes: 0 additions & 14 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ func TestDockerFlagEndpoint(t *testing.T) {
}
}

func TestUnixNotExists(t *testing.T) {

endpoint = ""
err := os.Setenv("DOCKER_HOST", "unix:///does/not/exist")
if err != nil {
t.Fatalf("Unable to set DOCKER_HOST: %s", err)
}

_, err = getEndpoint()
if err == nil {
t.Fatal("endpoint should have failed")
}
}

func TestUnixBadFormat(t *testing.T) {
endpoint = "unix:/var/run/docker.sock"
_, err := getEndpoint()
Expand Down