summaryrefslogtreecommitdiff
path: root/server_config_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-06 14:11:00 +0300
committerWolfy-J <[email protected]>2018-06-06 14:11:00 +0300
commit67b88c9914d922314ce7cd8d3624d64812647758 (patch)
tree9cf52b1f85deed31133bae33961fd537e2270ad1 /server_config_test.go
parent7067d593f243e86a54f4ffd87a06c744e5636e07 (diff)
server config
Diffstat (limited to 'server_config_test.go')
-rw-r--r--server_config_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/server_config_test.go b/server_config_test.go
index bd3ee76b..fdd502c2 100644
--- a/server_config_test.go
+++ b/server_config_test.go
@@ -3,6 +3,9 @@ package roadrunner
import (
"testing"
"github.com/stretchr/testify/assert"
+ "os/user"
+ "runtime"
+ "strconv"
)
func Test_ServerConfig_PipeFactory(t *testing.T) {
@@ -68,3 +71,25 @@ func Test_ServerConfig_Cmd(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cmd)
}
+
+func Test_ServerConfig_Cmd_Credentials(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("not supported on " + runtime.GOOS)
+ }
+
+ u, err := user.Current()
+ assert.NoError(t, err)
+
+ cfg := &ServerConfig{
+ Command: "php php-src/tests/client.php pipes",
+ User: u.Username,
+ Group: u.Gid,
+ }
+
+ cmd, err := cfg.makeCommand()
+ assert.NoError(t, err)
+ assert.NotNil(t, cmd)
+
+ assert.Equal(t, u.Uid, strconv.Itoa(int(cmd().SysProcAttr.Credential.Uid)))
+ assert.Equal(t, u.Gid, strconv.Itoa(int(cmd().SysProcAttr.Credential.Gid)))
+}