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
1 changed files with 6 additions and 4 deletions

View File

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