From 782b0ddd880f7c44ceead841008baf3a26b12f6b Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Tue, 20 Jan 2015 16:57:00 -0800 Subject: [PATCH] agent: test permissions are set on rpc socket --- command/agent/command_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/command/agent/command_test.go b/command/agent/command_test.go index d365b338ed..94f7d845b5 100644 --- a/command/agent/command_test.go +++ b/command/agent/command_test.go @@ -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()) + } }