Merge branch 'master' of github.com:hashicorp/nomad

This commit is contained in:
Alex Dadgar 2016-10-26 22:06:24 -07:00
commit 7abb3597a9
7 changed files with 32 additions and 12 deletions

View File

@ -1,4 +1,4 @@
//+build linux
//+build linux,lxc
package driver

View File

@ -1,3 +1,5 @@
//+build linux,lxc
package driver
import (

View File

@ -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)
}()

View File

@ -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,
},

View File

@ -22,7 +22,6 @@ func TestMeta_FlagSet(t *testing.T) {
"address",
"no-color",
"region",
"address",
"ca-cert",
"ca-path",
"client-cert",

View File

@ -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

View File

@ -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/)