diff --git a/.gitignore b/.gitignore index db1b3559..b72c2de0 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ _testmain.go bin/ gopath/ +.vagrant diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 817f072a..0108d70e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,12 +51,21 @@ We generally require test coverage of any new features or bug fixes. Here's how you can run the test suite on any system (even Mac or Windows) using [Vagrant](https://www.vagrantup.com/) and a hypervisor of your choice: +First, ensure that you have the [CNI repo](https://github.com/containernetworking/cni) and this repo (plugins) cloned side-by-side: +```bash +cd ~/workspace +git clone https://github.com/containernetworking/cni +git clone https://github.com/containernetworking/plugins +``` + +Next, boot the virtual machine and SSH in to run the tests: + ```bash vagrant up vagrant ssh # you're now in a shell in a virtual machine sudo su -cd /go/src/github.com/containernetworking/cni +cd /go/src/github.com/containernetworking/plugins # to run the full test suite ./test.sh diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 00000000..7c5f8f1b --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,21 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "bento/ubuntu-16.04" + + config.vm.synced_folder "..", "/go/src/github.com/containernetworking" + + config.vm.provision "shell", inline: <<-SHELL + set -e -x -u + + apt-get update -y || (sleep 40 && apt-get update -y) + apt-get install -y git + + wget -qO- https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | tar -C /usr/local -xz + + echo 'export GOPATH=/go' >> /root/.bashrc + echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> /root/.bashrc + cd /go/src/github.com/containernetworking/plugins + SHELL +end