Fix consul test build on Windows

This commit is contained in:
Michael Schurter 2017-04-19 16:14:11 -07:00
parent a63162c7ff
commit 8926743106

View file

@ -4,12 +4,12 @@ import (
"io/ioutil"
"log"
"os"
"os/user"
"path/filepath"
"runtime"
"testing"
"time"
"golang.org/x/sys/unix"
consulapi "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/testutil"
"github.com/hashicorp/nomad/client"
@ -38,8 +38,10 @@ func TestConsul_Integration(t *testing.T) {
if testing.Short() {
t.Skip("-short set; skipping")
}
if unix.Geteuid() != 0 {
t.Skip("Must be run as root")
if runtime.GOOS != "windows" {
if u, err := user.Current(); err == nil && u.Uid != "0" {
t.Skip("Must be run as root")
}
}
// Create an embedded Consul server
testconsul := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {