Fix consul test build on Windows
This commit is contained in:
parent
a63162c7ff
commit
8926743106
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue