diff --git a/client/driver/lxc_test.go b/client/driver/lxc_test.go index 3bb8dee86f6..3ba156e204c 100644 --- a/client/driver/lxc_test.go +++ b/client/driver/lxc_test.go @@ -75,15 +75,12 @@ func TestLxcDriver_Start_Wait(t *testing.T) { if _, err := d.Prestart(ctx.ExecCtx, task); err != nil { t.Fatalf("prestart err: %v", err) } - handle, err := d.Start(ctx.ExecCtx, task) + sresp, err := d.Start(ctx.ExecCtx, task) if err != nil { t.Fatalf("err: %v", err) } - if handle == nil { - t.Fatalf("missing handle") - } - lxcHandle, _ := handle.(*lxcDriverHandle) + lxcHandle, _ := sresp.Handle.(*lxcDriverHandle) // Destroy the container after the test defer func() { @@ -115,12 +112,12 @@ func TestLxcDriver_Start_Wait(t *testing.T) { } // Desroy the container - if err := handle.Kill(); err != nil { + if err := sresp.Handle.Kill(); err != nil { t.Fatalf("err: %v", err) } select { - case res := <-handle.WaitCh(): + case res := <-sresp.Handle.WaitCh(): if !res.Successful() { t.Fatalf("err: %v", res) } @@ -151,23 +148,19 @@ func TestLxcDriver_Open_Wait(t *testing.T) { if _, err := d.Prestart(ctx.ExecCtx, task); err != nil { t.Fatalf("prestart err: %v", err) } - handle, err := d.Start(ctx.ExecCtx, task) + sresp, err := d.Start(ctx.ExecCtx, task) if err != nil { t.Fatalf("err: %v", err) } - if handle == nil { - t.Fatalf("missing handle") - } // Destroy the container after the test - if lh, ok := handle.(*lxcDriverHandle); ok { - defer func() { - lh.container.Stop() - lh.container.Destroy() - }() - } + lh := sresp.Handle.(*lxcDriverHandle) + defer func() { + lh.container.Stop() + lh.container.Destroy() + }() - handle2, err := d.Open(ctx.ExecCtx, handle.ID()) + handle2, err := d.Open(ctx.ExecCtx, lh.ID()) if err != nil { t.Fatalf("err: %v", err) } diff --git a/demo/vagrant/Vagrantfile b/demo/vagrant/Vagrantfile index 89cc115d253..d13bf4bd6fe 100644 --- a/demo/vagrant/Vagrantfile +++ b/demo/vagrant/Vagrantfile @@ -12,7 +12,7 @@ echo Fetching Nomad... cd /tmp/ curl -sSL https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip -o nomad.zip -echo Installing Nomad... +echo "Installing Nomad..." unzip nomad.zip sudo chmod +x nomad sudo mv nomad /usr/bin/nomad @@ -21,16 +21,38 @@ sudo mkdir -p /etc/nomad.d sudo chmod a+w /etc/nomad.d # Set hostname's IP to made advertisement Just Work -sudo sed -i -e "s/.*nomad.*/$(ip route get 1 | awk '{print $NF;exit}') nomad/" /etc/hosts +#sudo sed -i -e "s/.*nomad.*/$(ip route get 1 | awk '{print $NF;exit}') nomad/" /etc/hosts + +echo "Install Docker..." +if [[ -f /etc/apt/sources.list.d/docker.list ]]; then + echo "Docker repository already installed; Skipping" +else + echo deb https://apt.dockerproject.org/repo ubuntu-`lsb_release -c | awk '{print $2}'` main | sudo tee /etc/apt/sources.list.d/docker.list + sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + sudo apt-get update +fi +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-engine + +# Restart docker to make sure we get the latest version of the daemon if there is an upgrade +sudo service docker restart + +# Make sure we can actually use docker as the vagrant user +sudo usermod -aG docker vagrant + +echo "Installing Consul..." +cd /opt/nomad +bash scripts/install_consul.sh SCRIPT Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/xenial64" # 16.04 LTS + config.vm.box = "bento/ubuntu-16.04" # 16.04 LTS config.vm.hostname = "nomad" config.vm.provision "shell", inline: $script, privileged: false config.vm.provision "docker" # Just install it + config.vm.synced_folder '../..', '/opt/nomad' + # Increase memory for Parallels Desktop config.vm.provider "parallels" do |p, o| p.memory = "1024" diff --git a/scripts/install_consul.sh b/scripts/install_consul.sh index 964347ed04a..9589c965c10 100755 --- a/scripts/install_consul.sh +++ b/scripts/install_consul.sh @@ -2,7 +2,7 @@ set -e -CONSUL_VERSION="0.7.3" +CONSUL_VERSION="0.8.4" CURDIR=`pwd` if [[ $(which consul >/dev/null && consul version | head -n 1 | cut -d ' ' -f 2) == "v$CONSUL_VERSION" ]]; then