mirror of https://github.com/status-im/consul.git
agent: test permissions are set on rpc socket
This commit is contained in:
parent
99d4e7831e
commit
782b0ddd88
|
@ -187,6 +187,9 @@ func TestSetupAgent_RPCUnixSocket_FileExists(t *testing.T) {
|
||||||
// Set socket address to an existing file.
|
// Set socket address to an existing file.
|
||||||
conf.Addresses.RPC = "unix://" + socketPath
|
conf.Addresses.RPC = "unix://" + socketPath
|
||||||
|
|
||||||
|
// Custom mode for socket file
|
||||||
|
conf.UnixSockets = map[string]string{"mode": "0777"}
|
||||||
|
|
||||||
shutdownCh := make(chan struct{})
|
shutdownCh := make(chan struct{})
|
||||||
defer close(shutdownCh)
|
defer close(shutdownCh)
|
||||||
|
|
||||||
|
@ -211,4 +214,9 @@ func TestSetupAgent_RPCUnixSocket_FileExists(t *testing.T) {
|
||||||
if fi.Mode()&os.ModeSocket == 0 {
|
if fi.Mode()&os.ModeSocket == 0 {
|
||||||
t.Fatalf("expected socket to replace file")
|
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())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue