amulet test refactor

This commit is contained in:
Ryan Beisner 2015-06-23 23:52:07 +00:00
parent aca4aed445
commit e8024e0c66
11 changed files with 392 additions and 513 deletions

View File

@ -2,17 +2,17 @@
PYTHON := /usr/bin/env python
lint:
@flake8 --exclude hooks/charmhelpers actions hooks unit_tests tests
@flake8 --exclude hooks/charmhelpers,tests/charmhelpers \
actions hooks unit_tests tests
@charm proof
unit_test:
test:
@# Bundletester expects unit tests here.
@echo Starting unit tests...
@$(PYTHON) /usr/bin/nosetests --nologcapture --with-coverage unit_tests
test:
functional_test:
@echo Starting amulet deployment tests...
#NOTE(beisner): can remove -v after bug 1320357 is fixed
# https://bugs.launchpad.net/amulet/+bug/1320357
@juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700
bin/charm_helpers_sync.py:
@ -21,7 +21,7 @@ bin/charm_helpers_sync.py:
> bin/charm_helpers_sync.py
sync: bin/charm_helpers_sync.py
@$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-hooks.yaml
# @$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-hooks.yaml
@$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-tests.yaml
publish: lint unit_test

View File

@ -1,4 +1,5 @@
branch: lp:charm-helpers
#branch: lp:charm-helpers
branch: lp:~1chb1n/charm-helpers/amulet-ceph-cinder-updates/
destination: tests/charmhelpers
include:
- contrib.amulet

View File

@ -555,11 +555,6 @@ def git_clone_and_install(projects_yaml, core_project, depth=1):
pip_create_virtualenv(os.path.join(parent_dir, 'venv'))
# Upgrade setuptools from default virtualenv version. The default version
# in trusty breaks update.py in global requirements master branch.
pip_install('setuptools', upgrade=True, proxy=http_proxy,
venv=os.path.join(parent_dir, 'venv'))
for p in projects['repositories']:
repo = p['repository']
branch = p['branch']
@ -621,24 +616,24 @@ def _git_clone_and_install_single(repo, branch, depth, parent_dir, http_proxy,
else:
repo_dir = dest_dir
venv = os.path.join(parent_dir, 'venv')
if update_requirements:
if not requirements_dir:
error_out('requirements repo must be cloned before '
'updating from global requirements.')
_git_update_requirements(venv, repo_dir, requirements_dir)
_git_update_requirements(repo_dir, requirements_dir)
juju_log('Installing git repo from dir: {}'.format(repo_dir))
if http_proxy:
pip_install(repo_dir, proxy=http_proxy, venv=venv)
pip_install(repo_dir, proxy=http_proxy,
venv=os.path.join(parent_dir, 'venv'))
else:
pip_install(repo_dir, venv=venv)
pip_install(repo_dir,
venv=os.path.join(parent_dir, 'venv'))
return repo_dir
def _git_update_requirements(venv, package_dir, reqs_dir):
def _git_update_requirements(package_dir, reqs_dir):
"""
Update from global requirements.
@ -647,8 +642,7 @@ def _git_update_requirements(venv, package_dir, reqs_dir):
"""
orig_dir = os.getcwd()
os.chdir(reqs_dir)
python = os.path.join(venv, 'bin/python')
cmd = [python, 'update.py', package_dir]
cmd = ['python', 'update.py', package_dir]
try:
subprocess.check_call(cmd)
except subprocess.CalledProcessError:

View File

@ -3,7 +3,7 @@ summary: Cinder OpenStack storage service
maintainer: Adam Gandelman <adamg@canonical.com>
description: |
Cinder is a storage service for the Openstack project
categories:
tags:
- miscellaneous
provides:
nrpe-external-master:

View File

@ -6,6 +6,7 @@ sudo add-apt-repository --yes ppa:juju/stable
sudo apt-get update --yes
sudo apt-get install --yes python-amulet \
python-cinderclient \
python-distro-info \
python-glanceclient \
python-keystoneclient \
python-novaclient

0
tests/017-basic-trusty-kilo Normal file → Executable file
View File

0
tests/019-basic-vivid-kilo Normal file → Executable file
View File

0
tests/053-basic-trusty-kilo-git Normal file → Executable file
View File

0
tests/054-basic-vivid-kilo-git Normal file → Executable file
View File

View File

@ -1,6 +1,15 @@
This directory provides Amulet tests that focus on verification of Cinder
deployments.
test_* methods are called in lexical sort order.
Test name convention to ensure desired test order:
1xx service and endpoint checks
2xx relation checks
3xx config checks
4xx functional checks
9xx restarts and other final checks
In order to run tests, you'll need charm-tools installed (in addition to
juju, of course):
sudo add-apt-repository ppa:juju/stable

File diff suppressed because it is too large Load Diff