agent: test permissions are set on rpc socket

This commit is contained in:
Ryan Uber 2015-01-20 16:57:00 -08:00
parent 99d4e7831e
commit 782b0ddd88
1 changed files with 8 additions and 0 deletions

View File

@ -187,6 +187,9 @@ func TestSetupAgent_RPCUnixSocket_FileExists(t *testing.T) {
// Set socket address to an existing file.
conf.Addresses.RPC = "unix://" + socketPath
// Custom mode for socket file
conf.UnixSockets = map[string]string{"mode": "0777"}
shutdownCh := make(chan struct{})
defer close(shutdownCh)
@ -211,4 +214,9 @@ func TestSetupAgent_RPCUnixSocket_FileExists(t *testing.T) {
if fi.Mode()&os.ModeSocket == 0 {
t.Fatalf("expected socket to replace file")
}
// Ensure permissions were applied to the socket file
if fi.Mode().String() != "Srwxrwxrwx" {
t.Fatalf("bad permissions: %s", fi.Mode())
}
}