mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
x/sys/windows/svc/mgr: skip tests when we are not authorised to manage services
It seems some Windows versions requires you to be an Administrator to manage services. Just google for "openscmanager access denied windows 2008" or similar. Fixes golang/go#11156. Change-Id: I4b09d244a61179ece7a1319234e5c3199423cbe9 Reviewed-on: https://go-review.googlesource.com/10933 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -20,6 +21,9 @@ import (
|
||||
func TestOpenLanManServer(t *testing.T) {
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERROR_ACCESS_DENIED {
|
||||
t.Skip("Skipping test: we don't have rights to manage services.")
|
||||
}
|
||||
t.Fatalf("SCM connection failed: %s", err)
|
||||
}
|
||||
defer m.Disconnect()
|
||||
@@ -107,6 +111,9 @@ func TestMyService(t *testing.T) {
|
||||
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERROR_ACCESS_DENIED {
|
||||
t.Skip("Skipping test: we don't have rights to manage services.")
|
||||
}
|
||||
t.Fatalf("SCM connection failed: %s", err)
|
||||
}
|
||||
defer m.Disconnect()
|
||||
|
||||
Reference in New Issue
Block a user