Added manifest checking tests.

Overview:
1) fixed up .gitignore file to use absolute paths (to project dir).
2) updated tox to run both manifest tests and flake8
3) updated yml file cause NULL for aws credentials causes an error on validation.
4) actually added the tests under tests/integration
This commit is contained in:
Rory Finnegan 2014-04-30 14:49:26 -05:00
parent 47997b4b13
commit 128bce8fff
5 changed files with 54 additions and 14 deletions

14
.gitignore vendored
View file

@ -1,14 +1,14 @@
*.pyc *.pyc
# Jekyll-generated files # Jekyll-generated files
Gemfile.lock /Gemfile.lock
_site/ /_site/
# When developing for ec2 `vagrant provision' is quite handy # When developing for ec2 `vagrant provision' is quite handy
/Vagrantfile /Vagrantfile
/.vagrant /.vagrant/
# Building the package # Building the package
/build /build/
/dist /dist/
/bootstrap_vz.egg-info /bootstrap_vz.egg-info/
# Testing # Testing
/.coverage /.coverage
/.tox /.tox/

View file

@ -1,6 +1,5 @@
bootstrap-vz bootstrap-vz
=========================================== ===========================================
bootstrap-vz is a bootstrapping framework for Debian. bootstrap-vz is a bootstrapping framework for Debian.
It is is specifically targeted at bootstrapping systems for virtualized environments. It is is specifically targeted at bootstrapping systems for virtualized environments.
bootstrap-vz runs without any user intervention and generates ready-to-boot images for bootstrap-vz runs without any user intervention and generates ready-to-boot images for

View file

@ -2,8 +2,8 @@
provider: "ec2" provider: "ec2"
virtualization: "pvm" virtualization: "pvm"
credentials: credentials:
access-key: null access-key: ""
secret-key: null secret-key: ""
bootstrapper: bootstrapper:
workspace: "/target" workspace: "/target"
image: image:

View file

@ -0,0 +1,39 @@
import os
from nose.tools import assert_true
from bootstrapvz.base.manifest import Manifest
MANIFEST_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'../../manifests'
)
def test_manifest_generator():
"""
manifests_tests - test_manifest_generator.
Loops through the manifests directory and tests that
each file can successfully be loaded and validated.
"""
for fobj in os.listdir(MANIFEST_DIR):
path = os.path.join(os.path.abspath(MANIFEST_DIR), fobj)
yield validate_manifests, path
def validate_manifests(path):
"""
manifests_tests - validate_manifests.
Actually creates the manifest for a given path
and checks that all the data values have successfully
been created.
"""
manifest = Manifest(path)
assert_true(manifest.data)
assert_true(manifest.data['provider'])
assert_true(manifest.data['bootstrapper'])
assert_true(manifest.data['image'])
assert_true(manifest.data['volume'])
assert_true(manifest.data['system'])

10
tox.ini
View file

@ -3,12 +3,14 @@ ignore = E101,E221,E241,E501,W191
max-line-length = 110 max-line-length = 110
[tox] [tox]
envlist = flake8 envlist = flake8, integration
[testenv:flake8] [testenv:flake8]
deps = flake8 deps = flake8
commands = flake8 bootstrapvz/ --exclude=minify_json.py commands = flake8 bootstrapvz/ --exclude=minify_json.py
# Once tests have started being written, uncomment this to run tests when running tox. [testenv:integration]
#[testenv] deps =
#commands = nosetests -v tests --with-coverage --cover-package=bootstrapvz --cover-inclusive nose
nose-cov
commands = nosetests -v tests/integration --with-coverage --cover-package=bootstrapvz --cover-inclusive