From c7cc7221d46e8fa7ee7d64c7eab64f5515980fc1 Mon Sep 17 00:00:00 2001 From: Alvaro Saurin Date: Thu, 19 Oct 2017 17:39:31 +0200 Subject: Simplify the wait_for_leases mechanism --- travis/gofmtcheck.sh | 30 ------------------------------ travis/run-gofmt | 30 ++++++++++++++++++++++++++++++ travis/run-tests-acceptance | 9 +++++++++ travis/run-tests-inside-guest | 18 +++++++++++------- travis/run_acceptance_test.sh | 8 -------- travis/setup-host | 1 + 6 files changed, 51 insertions(+), 45 deletions(-) delete mode 100644 travis/gofmtcheck.sh create mode 100755 travis/run-gofmt create mode 100755 travis/run-tests-acceptance delete mode 100755 travis/run_acceptance_test.sh (limited to 'travis') diff --git a/travis/gofmtcheck.sh b/travis/gofmtcheck.sh deleted file mode 100644 index d7d7aef6..00000000 --- a/travis/gofmtcheck.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -set -e -GOPKG="libvirt" - -lint_pkg () { - cd $1 - echo "*** checking pkg $1 with gofmt" - if [ -n "$(go fmt ./...)" ]; then - echo "Go code on pkg $1 is not formatted well, run 'go fmt on pkg $1'" - exit 1 - fi - echo " pkg $1 has no lint gofmt errors!" - cd .. -} - -lint_main () { - echo '*** running gofmt on main.go' - if [ -n "$(go fmt main.go)" ]; then - echo "Go code on main.go is not formatted, please run 'go fmt main.go'" - exit 1 - fi -} - -echo "==> Checking that code complies with gofmt requirements..." -lint_pkg $GOPKG -echo -lint_main -echo '==> go fmt OK !!! ***' -exit 0 diff --git a/travis/run-gofmt b/travis/run-gofmt new file mode 100755 index 00000000..d7d7aef6 --- /dev/null +++ b/travis/run-gofmt @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -e +GOPKG="libvirt" + +lint_pkg () { + cd $1 + echo "*** checking pkg $1 with gofmt" + if [ -n "$(go fmt ./...)" ]; then + echo "Go code on pkg $1 is not formatted well, run 'go fmt on pkg $1'" + exit 1 + fi + echo " pkg $1 has no lint gofmt errors!" + cd .. +} + +lint_main () { + echo '*** running gofmt on main.go' + if [ -n "$(go fmt main.go)" ]; then + echo "Go code on main.go is not formatted, please run 'go fmt main.go'" + exit 1 + fi +} + +echo "==> Checking that code complies with gofmt requirements..." +lint_pkg $GOPKG +echo +lint_main +echo '==> go fmt OK !!! ***' +exit 0 diff --git a/travis/run-tests-acceptance b/travis/run-tests-acceptance new file mode 100755 index 00000000..30d49207 --- /dev/null +++ b/travis/run-tests-acceptance @@ -0,0 +1,9 @@ +#!/bin/bash +set -x + +unset http_proxy +export TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE=qemu +export LIBVIRT_DEFAULT_URI="qemu:///system" +export TF_ACC=true + +go test -v -covermode=count -coverprofile=profile.cov -timeout=1200s ./libvirt diff --git a/travis/run-tests-inside-guest b/travis/run-tests-inside-guest index a860a4d7..32ff9773 100755 --- a/travis/run-tests-inside-guest +++ b/travis/run-tests-inside-guest @@ -1,19 +1,23 @@ #!/bin/bash set -x +base="/root/go/src/github.com/dmacvicar" + unset http_proxy -export GOROOT=/usr/lib/go-1.9/ -export GOPATH=/root/go +export GOROOT="/usr/lib/go-1.9/" +export GOPATH="/root/go" export PATH=$GOPATH/bin:$GOROOT/bin:$PATH -mkdir -p /root/go/src/github.com/dmacvicar/ -cp -r /code/ /root/go/src/github.com/dmacvicar/terraform-provider-libvirt -cd /root/go/src/github.com/dmacvicar/terraform-provider-libvirt +mkdir -p $base +cp -r /code/ $base/terraform-provider-libvirt +cd $base/terraform-provider-libvirt go build . -export TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE=qemu +export TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE="qemu" export LIBVIRT_DEFAULT_URI="qemu:///system" -export TF_ACC=true +export TF_ACC="true" +export TF_SKIP_QEMU_AGENT="true" + go test -v -covermode=count -coverprofile=profile.cov -timeout=1200s ./libvirt diff --git a/travis/run_acceptance_test.sh b/travis/run_acceptance_test.sh deleted file mode 100755 index 5010505a..00000000 --- a/travis/run_acceptance_test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -x - -unset http_proxy -export TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE=qemu -export LIBVIRT_DEFAULT_URI="qemu:///system" -export TF_ACC=true -go test -v -covermode=count -coverprofile=profile.cov -timeout=1200s ./libvirt diff --git a/travis/setup-host b/travis/setup-host index cd9ce64c..6bb455cc 100755 --- a/travis/setup-host +++ b/travis/setup-host @@ -11,6 +11,7 @@ sudo sed -i 's/LXD_IPV4_NETWORK=".*"/LXD_IPV4_NETWORK="192.168.123.0\/24"/' /etc sudo sed -i 's/LXD_IPV4_DHCP_RANGE=".*"/LXD_IPV4_DHCP_RANGE="192.168.123.2,192.168.123.12"/' /etc/default/lxd-bridge sudo sed -i 's/LXD_IPV4_DHCP_MAX=".*"/LXD_IPV4_DHCP_MAX="10"/' /etc/default/lxd-bridge +sudo service libvirtd restart sudo service lxd restart sudo lxc launch ubuntu:zesty libvirt -c security.privileged=true -- cgit v1.2.3