summaryrefslogtreecommitdiff
path: root/.travis.yml
diff options
context:
space:
mode:
authorFlavio Castelli <fcastelli@suse.com>2017-07-27 01:23:08 +0200
committerFlavio Castelli <flavio@castelli.me>2017-07-27 14:59:30 +0200
commit991da6f90957a3cba82d6e079423492c5841e74d (patch)
tree22af87ca7a4c3ec8f59ca16f3e868ae5445c523b /.travis.yml
parentccf4dff4f872291b5cf131cbdfb3d3c5b2f0dd47 (diff)
downloadterraform-provider-libvirt-991da6f90957a3cba82d6e079423492c5841e74d.tar
terraform-provider-libvirt-991da6f90957a3cba82d6e079423492c5841e74d.tar.gz
Fix broken tests
The tests are failing because travis has an old version of libvirt that is not happy about the xml we generate. Unfortunately there's no way to get a more recent version of ubuntu on travis (it's stuck with trusty!!) and there are not libvirt 2.0 packages for trusty. This commit fixes the issues in the "inception" way: * travis provisions a ubuntu trusty VM as usual * the travis/host script does the following steps: * installs LXD * creates a system container based on the latest release of ubuntu * runs the container as privileged one * mount the git checkout into the container as read-only mount point (it easier than having a RW one) * runs the travis/guest script inside of the container: * install libvirt + go 1.8 * run the acceptance tests, save coverage to file * on the travis VM: * pull the coverage results file from the container * send it to coverall So far everything is working and is a miracle given the container, based on a more recent version of ubuntu, is using the kernel of the host, the old ubuntu trusty. This is just a termporary workaround until either travis updates its VMs to a more recent release of ubuntu or we switch the project to use Jenkins with an openSUSE worker. Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Diffstat (limited to '.travis.yml')
-rw-r--r--.travis.yml33
1 files changed, 7 insertions, 26 deletions
diff --git a/.travis.yml b/.travis.yml
index cd78f440..a05d064a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,31 +3,12 @@ language: go
go:
- 1.8
-
-before_install:
- - sudo add-apt-repository -y cloud-archive:mitaka
- - sudo apt-get -qq update
- - sudo apt-get install -y qemu libvirt-bin libvirt-dev
- - sudo usermod -a -G libvirtd $USER
- - echo -e "<pool type='dir'>\n<name>default</name>\n<target>\n<path>/pool-default</path>\n</target>\n</pool>" > pool.xml
- - sudo mkdir /pool-default
- - sudo chmod a+rwx /pool-default
- - sudo virsh pool-define pool.xml
- - sudo virsh pool-start default
+install: true
+before_script:
- go get github.com/mattn/goveralls
-
-install:
- - go build .
-
-# override the custom test script, this would trigger
-# also the execution of the unit tests of the vendored
-# code
-env:
- global:
- - TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE=qemu
- - TF_ACC=true
- - LIBVIRT_DEFAULT_URI="qemu:///system"
-
+ - sudo bash ./travis/setup-host
+ - sudo lxc exec libvirt -- bash /code/travis/setup-guest
script:
- - sg libvirtd -c "go test -v ./libvirt"
- - sg libvirtd -c "$HOME/gopath/bin/goveralls -v -service=travis-ci"
+ - sudo lxc exec libvirt -- bash /code/travis/run-tests-inside-guest
+ - sudo lxc file pull libvirt/root/go/src/github.com/dmacvicar/terraform-provider-libvirt/profile.cov .
+ - goveralls -coverprofile=profile.cov -service=travis-ci