Skip to content

Commit 37dba3b

Browse files
committed
Updated Vagrant file per requests in #15
- Removed my_machines loop - switched to pip from curl - Updated Readme
1 parent 9a07e8f commit 37dba3b

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

README.rst

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,31 +205,51 @@ If you'd like to help with the project itself, here are some other ways you can
205205

206206
Testing
207207
~~~~~~~
208-
This role includes a Vagrantfile used with a Docker-based test harness for integration testing. Using Vagrant allows all contributors to test on the same platform and avoid false test failures due to untested or incompatible docker versions.
208+
Testing can be done using the provided Vagrantfile or by installing `Docker <https://docs.docker.com/engine/installation/>`__ and `Docker Compose <https://docs.docker.com/compose/>`__ locally.
209+
210+
Testing with Vagrant
211+
"""""""""""""""""""""
212+
This role includes a Vagrantfile used with a Docker-based test harness that approximates the Travis CI setup for integration testing. Using Vagrant allows all contributors to test on the same platform and avoid false test failures due to untested or incompatible docker versions.
209213

210214
1. Install `Vagrant <https://www.vagrantup.com/>`__ and `VirtualBox <https://www.virtualbox.org/>`__.
211215

212216
2. Run ``vagrant up`` from the same directory as the Vagrantfile in this repository.
213217

214-
3. SSH into the VM with: ``vagrant ssh`` or ``ssh 127.0.0.1:2222`` or ``ssh 10.1.15.10``
218+
3. SSH into the VM with: ``vagrant ssh``
219+
220+
4. Run tests with ``make``.
221+
222+
::
223+
224+
make -C /vagrant xenial64 test
225+
226+
Integration tests use **systemd** by default. Set ``PROCESS_CONTROL`` to change this:
227+
228+
::
229+
230+
make -C /vagrant trusty64 test PROCESS_CONTROL=supervisor
231+
232+
See ``make help`` for more information including a full list of available targets.
233+
234+
Testing with Docker and Docker Compose locally
235+
""""""""""""""""""""""""""""""""""""""""""""""""
236+
Alternatively, you can install `Docker <https://docs.docker.com/engine/installation/>`__ and `Docker Compose <https://docs.docker.com/compose/>`__ to run these tests locally on your machine.
215237

216-
4. Change directories into **/vagrant** with the command: ``cd /vagrant``
238+
1. Install `Docker <https://docs.docker.com/engine/installation/>`__ and `Docker Compose <https://docs.docker.com/compose/>`__.
217239

218-
5. Test the role against each Dockerfile with ``make``:
240+
2. Run tests with ``make``.
219241

220242
::
221243

222244
make jessie64 test
223-
make centos7 test
224-
make xenial64 test
225245

226246
Integration tests use **systemd** by default. Set ``PROCESS_CONTROL`` to change this:
227247

228248
::
229249

230250
make trusty64 test PROCESS_CONTROL=supervisor
231251

232-
See ``make help`` for more information.
252+
See ``make help`` for more information including a full list of available targets.
233253

234254
License
235255
-------

Vagrantfile

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
77
VAGRANTFILE_API_VERSION = "2"
88

9-
my_machines={
10-
# 'hostname' => ['IPAddress','Memory in MB','Number of CPUs'],
11-
'node1' => ['10.1.15.10','1024','1']
12-
}
13-
149
$setupScript = <<SCRIPT
1510
echo provisioning docker...
1611
sudo apt-get update
@@ -19,29 +14,25 @@ sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-trusty ma
1914
sudo apt-get update
2015
sudo apt-get -o Dpkg::Options::="--force-confnew" install --force-yes -y docker-engine=1.10.2-0~trusty
2116
sudo usermod -a -G docker vagrant
22-
curl -L "https://github.com/docker/compose/releases/download/1.6.2/docker-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose
23-
chmod +x /usr/local/bin/docker-compose
17+
sudo apt-get install python3-pip -y && sudo pip3 install --upgrade pip
18+
sudo pip install docker-compose==1.6.2
19+
2420
docker version
2521
2622
docker-compose version
2723
SCRIPT
2824

2925
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
3026
config.vm.box = "bento/ubuntu-14.04"
31-
32-
my_machines.each do |short_name, array|
33-
34-
config.vm.define short_name do |host|
35-
host.vm.network 'private_network', ip: array[0]
36-
host.vm.hostname = "#{short_name}"
37-
host.vm.provider "virtualbox" do |vb|
38-
vb.memory = "#{array[1]}"
39-
vb.cpus = "#{array[2]}"
40-
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
41-
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
42-
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
43-
end
44-
host.vm.provision :shell, :inline => $setupScript
27+
config.vm.define "server" do |host|
28+
host.vm.hostname = "server"
29+
host.vm.provider "virtualbox" do |vb|
30+
vb.memory = "1024"
31+
vb.cpus = "1"
32+
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
33+
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
34+
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
4535
end
36+
host.vm.provision :shell, :inline => $setupScript
4637
end
4738
end

0 commit comments

Comments
 (0)