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()) + } }