mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
fix test cases on Windows
SysProcAttr.Credential is not available on Windows we need to move the WrapCmd test in a separate file to be able to build test cases on Windows, skipping the test is not enough
This commit is contained in:
19
sftpd/internal_unix_test.go
Normal file
19
sftpd/internal_unix_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// +build !windows
|
||||
|
||||
package sftpd
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWrapCmd(t *testing.T) {
|
||||
cmd := exec.Command("ls")
|
||||
cmd = wrapCmd(cmd, 1000, 1001)
|
||||
if cmd.SysProcAttr.Credential.Uid != 1000 {
|
||||
t.Errorf("unexpected uid")
|
||||
}
|
||||
if cmd.SysProcAttr.Credential.Gid != 1001 {
|
||||
t.Errorf("unexpected gid")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user