Skip to content

Commit

Permalink
Added integration tests using vagrant (ubuntu/freebsd)
Browse files Browse the repository at this point in the history
  • Loading branch information
Azulinho committed May 11, 2015
1 parent 5462cd3 commit cca33c2
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -4,3 +4,7 @@ src/cuisine.egg-info
*.pyc
build/*
dist/*
run_cuisine.py
tests/integration/freebsd/bash/run_cuisine.py
.vagrant
.bundle/
9 changes: 8 additions & 1 deletion Makefile
Expand Up @@ -5,7 +5,7 @@ VERSION = `grep VERSION src/cuisine.py | cut -d '=' -f2 | xargs echo`
PRODUCT = MANIFEST doc

.PHONY: all doc clean check

all: $(PRODUCT)

release: $(PRODUCT)
Expand All @@ -19,6 +19,7 @@ test:

clean:
@rm -rf api/ build dist MANIFEST ; true
vagrant destroy -f

check:
pychecker -100 $(SOURCES)
Expand All @@ -30,6 +31,12 @@ doc: $(DOC_SOURCES)
test:
python tests/all.py

up:
vagrant up --no-provision --provider virtualbox

provision:
vagrant provision

MANIFEST: $(MANIFEST)
echo $(MANIFEST) | xargs -n1 | sort | uniq > $@

Expand Down
16 changes: 14 additions & 2 deletions README.rst
Expand Up @@ -160,7 +160,7 @@ platform, you should do the following:
or read the source and mimic what we've done for `package_*`
3) Create a specific version of the decorated function by creating a new
function with the same name, suffixed by your specific backend name. For
instance, if you'd like to create a `yum` backend to `package_ensure`,
instance, if you'd like to create a `yum` backend to `package_ensure`,
you would need to create a function `package_ensure_yum` with the same
arguments as `package_ensure`
4) Once you've created your specific functions, make sure that you have
Expand All @@ -169,7 +169,7 @@ platform, you should do the following:
5) Look for the `supported` variable in the `select_*` and add your backend
suffix to it (in our example, this would be `yum`)

To use a specific backend implementation of a set of features, use the
To use a specific backend implementation of a set of features, use the
`select_*` functions.

.. code-block:: python
Expand All @@ -184,6 +184,18 @@ Modules

Cuisine-PostgreSQL http://pypi.python.org/pypi/cuisine-postgresql/

Integration testings
--------------------

This repository contains a vagrantfile that will build a freebsd box, and a ubuntu box.

Simply type:

make up
make provision

*make provision* will run the integration tests against the Virtual Machines

More?
-----

Expand Down
35 changes: 35 additions & 0 deletions Vagrantfile
@@ -0,0 +1,35 @@
Vagrant.configure("2") do |c|

c.vm.define :freebsd do |f|
f.vm.box = "opscode-freebsd-10.1"
f.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_freebsd-10.1_chef-provisionerless.box"
f.vm.hostname = "freebsd-10.1"
f.ssh.shell = '/bin/sh'
f.vm.network(:private_network, {:ip=>"192.168.33.2"})
f.vm.synced_folder ".", "/vagrant", disabled: true
f.vm.synced_folder "/home/azul/gits/azulinho-cuisine", "/vagrant", create: true, type: :nfs, :mount_options => ['nolock,vers=3,tcp,noatime,clientaddr=192.168.33.2']
f.vm.provider :virtualbox do |p|
p.gui = true
end
f.vm.provision :shell, path: 'tests/freebsd/bootstrap.sh'
end

c.vm.define :ubuntu do |f|
f.vm.box = "opscode-ubuntu-14.04"
f.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
f.vm.hostname = "ubuntu-14.04"
f.ssh.shell = '/bin/bash'
f.vm.network(:private_network, {:ip=>"192.168.33.3"})
f.vm.synced_folder ".", "/vagrant", disabled: true
f.vm.synced_folder "/home/azul/gits/azulinho-cuisine", "/vagrant", create: true, type: :nfs, :mount_options => ['nolock,vers=3,tcp,noatime,clientaddr=192.168.33.3']
f.vm.provider :virtualbox do |p|
p.gui = false
end
f.vm.provision :shell, inline: 'test -e /usr/bin/gcc || ( apt-get update && sudo apt-get -o APT::Install-Suggests="true" -y install build-essential python-dev python-gmpy2)'
f.vm.provision :shell, inline: 'test -e /usr/bin/easy_install || apt-get -y install python-setuptools'
f.vm.provision :shell, inline: 'test -e /usr/bin/fabric || easy_install fabric'
f.vm.provision :shell, inline: 'python /vagrant/tests/ubuntu/all.py'
end


end
3 changes: 2 additions & 1 deletion tests/all.py → tests/ubuntu/all.py
@@ -1,5 +1,6 @@
import imp
import unittest, os, hashlib
import cuisine
cuisine = imp.load_source('cuisine', '/vagrant/src/cuisine.py')
import tempfile

USER = os.popen("whoami").read()[:-1]
Expand Down

0 comments on commit cca33c2

Please sign in to comment.