safesocket: enable test to run on Windows unpriviliged

I manually tested that the code path that relaxes pipe permissions is
not executed when run with elevated priviliges, and the test also passes
in that case.

Updates #7876

Signed-off-by: James Tucker <jftucker@gmail.com>
This commit is contained in:
James Tucker
2023-04-14 16:52:44 -07:00
parent cd35a79136
commit f844791e15
3 changed files with 28 additions and 4 deletions

View File

@@ -10,10 +10,10 @@ import (
"testing"
)
// downgradeSDDL is a no-op test helper on non-Windows systems.
var downgradeSDDL = func() func() { return func() {} }
func TestBasics(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("TODO(#7876): test regressed on windows while CI was broken")
}
// Make the socket in a temp dir rather than the cwd
// so that the test can be run from a mounted filesystem (#2367).
dir := t.TempDir()
@@ -22,6 +22,7 @@ func TestBasics(t *testing.T) {
sock = filepath.Join(dir, "test")
} else {
sock = fmt.Sprintf(`\\.\pipe\tailscale-test`)
t.Cleanup(downgradeSDDL())
}
l, err := Listen(sock)