diff --git a/client/driver/lxc.go b/client/driver/lxc.go index 762d5d87c..ffcbc3897 100644 --- a/client/driver/lxc.go +++ b/client/driver/lxc.go @@ -1,4 +1,4 @@ -//+build linux +//+build linux,lxc package driver diff --git a/client/driver/lxc_test.go b/client/driver/lxc_test.go index a50640c75..8a46ec46f 100644 --- a/client/driver/lxc_test.go +++ b/client/driver/lxc_test.go @@ -1,3 +1,5 @@ +//+build linux,lxc + package driver import ( diff --git a/client/task_runner_test.go b/client/task_runner_test.go index 3f2032734..8e1ec9423 100644 --- a/client/task_runner_test.go +++ b/client/task_runner_test.go @@ -484,9 +484,9 @@ func TestTaskRunner_RestartTask(t *testing.T) { defer tr.ctx.AllocDir.Destroy() go func() { - time.Sleep(100 * time.Millisecond) + time.Sleep(time.Duration(testutil.TestMultiplier()*300) * time.Millisecond) tr.Restart("test", "restart") - time.Sleep(100 * time.Millisecond) + time.Sleep(time.Duration(testutil.TestMultiplier()*300) * time.Millisecond) tr.Kill("test", "restart", false) }() diff --git a/command/agent/agent.go b/command/agent/agent.go index 9ec74090b..49a28cac8 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -393,6 +393,7 @@ func (a *Agent) setupServer() error { a.server = server // Create the Nomad Server services for Consul + // TODO re-introduce HTTP/S checks when Consul 0.7.1 comes out if a.config.Consul.AutoAdvertise { httpServ := &structs.Service{ Name: a.config.Consul.ServerServiceName, @@ -401,9 +402,7 @@ func (a *Agent) setupServer() error { Checks: []*structs.ServiceCheck{ &structs.ServiceCheck{ Name: "Nomad Server HTTP Check", - Type: "http", - Path: "/v1/status/peers", - Protocol: "http", // TODO TLS + Type: "tcp", Interval: serverHttpCheckInterval, Timeout: serverHttpCheckTimeout, }, @@ -496,6 +495,8 @@ func (a *Agent) setupClient() error { a.client = client // Create the Nomad Client services for Consul + // TODO think how we can re-introduce HTTP/S checks when Consul 0.7.1 comes + // out if a.config.Consul.AutoAdvertise { httpServ := &structs.Service{ Name: a.config.Consul.ClientServiceName, @@ -504,9 +505,7 @@ func (a *Agent) setupClient() error { Checks: []*structs.ServiceCheck{ &structs.ServiceCheck{ Name: "Nomad Client HTTP Check", - Type: "http", - Path: "/v1/agent/servers", - Protocol: "http", // TODO TLS + Type: "tcp", Interval: clientHttpCheckInterval, Timeout: clientHttpCheckTimeout, }, diff --git a/command/meta_test.go b/command/meta_test.go index fd2d7cac5..76ff5b3ab 100644 --- a/command/meta_test.go +++ b/command/meta_test.go @@ -22,7 +22,6 @@ func TestMeta_FlagSet(t *testing.T) { "address", "no-color", "region", - "address", "ca-cert", "ca-path", "client-cert", diff --git a/scripts/build.sh b/scripts/build.sh index 10accd062..b82fb35c6 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -46,6 +46,24 @@ gox \ -output "pkg/{{.OS}}_{{.Arch}}/nomad" \ . +echo "" +if pkg-config --exists lxc; then + echo "==> Building linux_amd64_lxc..." + go build \ + -tags lxc \ + -ldflags "-X main.GitCommit='${GIT_COMMIT}${GIT_DIRTY}+lxc'" \ + -o "pkg/linux_amd64_lxc/nomad" +else + if [[ "${NOMAD_DEV}" ]]; then + # No lxc in dev mode is no problem + echo "LXC not installed; skipping" + else + # Require LXC for release mode + echo "LXC not installed; install lxc-dev to build release binaries" + exit 1 + fi +fi + # Move all the compiled things to the $GOPATH/bin GOPATH=${GOPATH:-$(go env GOPATH)} case $(uname) in diff --git a/scripts/test.sh b/scripts/test.sh index f2baeba24..097003e76 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,17 +1,19 @@ #!/usr/bin/env bash set -e +GOTEST_TAGS="nomad_test lxc" + # Create a temp dir and clean it up on exit TEMPDIR=`mktemp -d -t nomad-test.XXX` trap "rm -rf $TEMPDIR" EXIT HUP INT QUIT TERM # Build the Nomad binary for the API tests echo "--> Building nomad" -go build -tags "nomad_test" -o $TEMPDIR/nomad || exit 1 +go build -tags "$GOTEST_TAGS" -o $TEMPDIR/nomad || exit 1 # Run the tests echo "--> Running tests" GOBIN="`which go`" sudo -E PATH=$TEMPDIR:$PATH -E GOPATH=$GOPATH -E NOMAD_TEST_RKT=1 \ - $GOBIN test -tags "nomad_test" ${GOTEST_FLAGS:--cover -timeout=900s} $($GOBIN list ./... | grep -v /vendor/) + $GOBIN test -tags "$GOTEST_TAGS" ${GOTEST_FLAGS:--cover -timeout=900s} $($GOBIN list ./... | grep -v /vendor/)