Merge pull request #11525 from cpuguy83/10969-cleanup-unix-sockets

cleanup unix sockets
This commit is contained in:
Jessie Frazelle
2015-03-20 14:55:17 -07:00
4 changed files with 58 additions and 20 deletions
+28
View File
@@ -800,3 +800,31 @@ func TestDaemonDots(t *testing.T) {
logDone("daemon - test dots on INFO")
}
func TestDaemonUnixSockCleanedUp(t *testing.T) {
d := NewDaemon(t)
dir, err := ioutil.TempDir("", "socket-cleanup-test")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
sockPath := filepath.Join(dir, "docker.sock")
if err := d.Start("--host", "unix://"+sockPath); err != nil {
t.Fatal(err)
}
if _, err := os.Stat(sockPath); err != nil {
t.Fatal("socket does not exist")
}
if err := d.Stop(); err != nil {
t.Fatal(err)
}
if _, err := os.Stat(sockPath); err == nil || !os.IsNotExist(err) {
t.Fatal("unix socket is not cleaned up")
}
logDone("daemon - unix socket is cleaned up")
}