Refactor to source charm
This is in line with the agreed conventions on where to put files in a layered source package. Essentially, just the final moving of things around and ensuring that the dummy tests pass, along with lint. Change-Id: I392568d6279f0a5876bdb2a3ad5e49fee03734aa
This commit is contained in:
parent
d5e728e5af
commit
f10d28e392
26
README.md
26
README.md
@ -1,28 +1,18 @@
|
||||
# Overview
|
||||
|
||||
Tempest is a set of integration tests to be run against a live OpenStack cluster. Tempest has batteries of tests for OpenStack API validation, Scenarios, and other specific tests useful in validating an OpenStack deployment.
|
||||
This is a "source" charm, which is intended to be strictly the top
|
||||
layer of a built charm. This structure declares that any included
|
||||
layer assets are not intended to be consumed as a layer from a
|
||||
functional or design standpoint.
|
||||
|
||||
The Tempest Charm can be deployed into a new or existing Juju model containing an OpenStack deployment to execute sets or subsets of Tempest tests.
|
||||
|
||||
|
||||
# Building
|
||||
# Test and Build
|
||||
|
||||
```
|
||||
sudo apt-get install python-tox
|
||||
tox -e pep8
|
||||
tox -e py34 # or py27 or py35
|
||||
tox -e build
|
||||
```
|
||||
|
||||
|
||||
# Usage
|
||||
|
||||
At this time, the Tempest charm is in development and is in a proof-of-concept state. Development and related discussion occurs on the freenode #juju irc channel.
|
||||
|
||||
TLDR: Deploy the built charm and relate it to keystone and openstack-dashboard. See config.yaml as annotated.
|
||||
|
||||
More docs to come as this matures.
|
||||
|
||||
|
||||
# Contact Information
|
||||
|
||||
Report bugs on [Launchpad](http://bugs.launchpad.net/charms/+source/tempest/+filebug)
|
||||
|
||||
Freenode IRC: #openstack-charms
|
||||
|
28
copyright
28
copyright
@ -1,17 +1,13 @@
|
||||
Format: http://dep.debian.net/deps/dep5/
|
||||
Copyright 2016 Canonical Ltd.
|
||||
|
||||
Files: *
|
||||
Copyright: Copyright 2011, Canonical Ltd., All Rights Reserved.
|
||||
License: GPL-3
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
@ -1,18 +0,0 @@
|
||||
import charms.reactive as reactive
|
||||
import charm.openstack.tempest as tempest
|
||||
import os
|
||||
|
||||
|
||||
@reactive.hook('install')
|
||||
def install_packages():
|
||||
tempest.get_charm().install()
|
||||
|
||||
|
||||
@reactive.when('identity-admin.available')
|
||||
def render_tempest_config(keystone):
|
||||
charm = tempest.TempestCharmFactory.charm(
|
||||
interfaces=[keystone]
|
||||
)
|
||||
if not os.path.isdir(charm.TEMPEST_LOGDIR):
|
||||
os.makedirs(charm.TEMPEST_LOGDIR)
|
||||
charm.render_all_configs()
|
@ -2,13 +2,4 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
charm-tools>=2.0.0
|
||||
pbr>=1.8.0,<1.9.0
|
||||
PyYAML>=3.1.0
|
||||
simplejson>=2.2.0
|
||||
netifaces>=0.10.4
|
||||
netaddr>=0.7.12,!=0.7.16
|
||||
Jinja2>=2.6 # BSD License (3 clause)
|
||||
six>=1.9.0
|
||||
dnspython>=1.12.0
|
||||
psutil>=1.1.1,<2.0.0
|
||||
python-neutronclient>=2.6.0
|
||||
|
1
src/.testr.conf
Symbolic link
1
src/.testr.conf
Symbolic link
@ -0,0 +1 @@
|
||||
../.testr.conf
|
21
src/README.md
Normal file
21
src/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Overview
|
||||
|
||||
Tempest is a set of integration tests to be run against a live OpenStack cluster. Tempest has batteries of tests for OpenStack API validation, Scenarios, and other specific tests useful in validating an OpenStack deployment.
|
||||
|
||||
The Tempest Charm can be deployed into a new or existing Juju model containing an OpenStack deployment to execute sets or subsets of Tempest tests.
|
||||
|
||||
|
||||
# Usage
|
||||
|
||||
At this time, the Tempest charm is in development and is in a proof-of-concept state. Development and related discussion occurs on the freenode #juju irc channel.
|
||||
|
||||
TLDR: Deploy the built charm and relate it to keystone and openstack-dashboard. See config.yaml as annotated.
|
||||
|
||||
More docs to come as this matures.
|
||||
|
||||
|
||||
# Contact Information
|
||||
|
||||
Report bugs on [Launchpad](http://bugs.launchpad.net/charms/+source/tempest/+filebug)
|
||||
|
||||
Freenode IRC: #openstack-charms
|
1
src/copyright
Symbolic link
1
src/copyright
Symbolic link
@ -0,0 +1 @@
|
||||
../copyright
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@ -8,22 +8,26 @@ import neutronclient.v2_0.client as neutronclient
|
||||
import novaclient.v2 as novaclient
|
||||
import urllib
|
||||
|
||||
import charm.openstack.charm as charm
|
||||
import charm.openstack.adapters as adapters
|
||||
import charms_openstack.charm as charm
|
||||
import charms_openstack.adapters as adapters
|
||||
import charmhelpers.core.hookenv as hookenv
|
||||
import charmhelpers.fetch as fetch
|
||||
|
||||
tempest_charm = None
|
||||
|
||||
|
||||
def get_charm():
|
||||
""" Return a new instance of TempestCharm or existing global instance
|
||||
@returns TempestCharm
|
||||
def install():
|
||||
"""Use the singleton from the BarbicanCharm to install the packages on the
|
||||
unit
|
||||
"""
|
||||
global tempest_charm
|
||||
if tempest_charm is None:
|
||||
tempest_charm = TempestCharmFactory.charm()
|
||||
return tempest_charm
|
||||
TempestCharm.singleton.install()
|
||||
|
||||
|
||||
def render_configs(interfaces_list):
|
||||
"""Using a list of interfaces, render the configs and, if they have
|
||||
changes, restart the services on the unit.
|
||||
"""
|
||||
if not os.path.isdir(TempestCharm.TEMPEST_LOGDIR):
|
||||
os.makedirs(TempestCharm.TEMPEST_LOGDIR)
|
||||
TempestCharm.singleton.render_with_interfaces(interfaces_list)
|
||||
|
||||
|
||||
class TempestAdminAdapter(adapters.OpenStackRelationAdapter):
|
||||
@ -240,6 +244,9 @@ class TempestConfigurationAdapter(adapters.ConfigurationAdapter):
|
||||
|
||||
class TempestCharm(charm.OpenStackCharm):
|
||||
|
||||
release = 'liberty'
|
||||
name = 'tempest'
|
||||
|
||||
"""Directories and files used for running tempest"""
|
||||
TEMPEST_ROOT = '/var/lib/tempest/'
|
||||
TEMPEST_LOGDIR = TEMPEST_ROOT + '/logs'
|
||||
@ -326,12 +333,3 @@ class TempestCharm(charm.OpenStackCharm):
|
||||
self.setup_git(branch_name, git_dir)
|
||||
self.execute_tox(run_dir, logfile, tox_target)
|
||||
hookenv.action_set(action_info)
|
||||
|
||||
|
||||
class TempestCharmFactory(charm.OpenStackCharmFactory):
|
||||
|
||||
releases = {
|
||||
'liberty': TempestCharm
|
||||
}
|
||||
|
||||
first_release = 'liberty'
|
13
src/reactive/handlers.py
Normal file
13
src/reactive/handlers.py
Normal file
@ -0,0 +1,13 @@
|
||||
import charms.reactive as reactive
|
||||
import charm.openstack.tempest as tempest
|
||||
|
||||
|
||||
@reactive.when_not('charm.installed')
|
||||
def install_packages():
|
||||
tempest.install()
|
||||
reactive.set_state('charm.installed')
|
||||
|
||||
|
||||
@reactive.when('identity-admin.available')
|
||||
def render_tempest_config(keystone):
|
||||
tempest.render_configs([keystone])
|
1
src/requirements.txt
Symbolic link
1
src/requirements.txt
Symbolic link
@ -0,0 +1 @@
|
||||
../requirements.txt
|
1
src/test-requirements.txt
Symbolic link
1
src/test-requirements.txt
Symbolic link
@ -0,0 +1 @@
|
||||
../test-requirements.txt
|
1
src/tests/writeme
Normal file
1
src/tests/writeme
Normal file
@ -0,0 +1 @@
|
||||
Add amulet functional tests.
|
41
src/tox.ini
Normal file
41
src/tox.ini
Normal file
@ -0,0 +1,41 @@
|
||||
[tox]
|
||||
skipsdist = True
|
||||
envlist = pep8
|
||||
|
||||
[testenv]
|
||||
sitepackages = False
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONHASHSEED=0
|
||||
TERM=linux
|
||||
INTERFACE_PATH={toxinidir}/interfaces
|
||||
LAYER_PATH={toxinidir}/layers
|
||||
JUJU_REPOSITORY={toxinidir}/build
|
||||
passenv = http_proxy https_proxy
|
||||
install_command =
|
||||
pip install --allow-unverified python-apt {opts} {packages}
|
||||
commands = ostestr {posargs}
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:py34]
|
||||
basepython = python3.4
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python2.7
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = flake8 {posargs} hooks unit_tests tests actions
|
||||
charm-proof
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = E402
|
5
src/unit_tests/__init__.py
Normal file
5
src/unit_tests/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
# By design, this unit_tests dir is inside the src charm (layer),
|
||||
# and it will be included in the resultant built charm asset.
|
||||
#
|
||||
# Include unit tests here which are intended to be executable
|
||||
# from the built charm.
|
13
src/unit_tests/test_noop.py
Normal file
13
src/unit_tests/test_noop.py
Normal file
@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
|
||||
|
||||
class TestNoOp(unittest.TestCase):
|
||||
"""Placeholder - Write Me!"""
|
||||
# XXX (beisner): with the charm.openstack vs lib/charm/openstack/tempest
|
||||
# module namespace collision, and with the hard requirement to have some
|
||||
# sort of unit test passing, here is a temporary inert noop test. After
|
||||
# charms_openstack module is completed, and this tempest charm is
|
||||
# refactored to use it, revisit this and add actual unit tests.
|
||||
def test_noop(self):
|
||||
"""Test Nothing"""
|
||||
pass
|
@ -3,6 +3,6 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
coverage>=3.6
|
||||
mock>=1.2
|
||||
pep8>=1.7.0
|
||||
flake8>=2.2.4,<=2.4.1
|
||||
os-testr>=0.4.1
|
||||
requests==2.6.0
|
||||
|
25
tox.ini
25
tox.ini
@ -1,8 +1,10 @@
|
||||
[tox]
|
||||
skipsdist = True
|
||||
envlist = pep8
|
||||
skip_missing_interpreters = True
|
||||
|
||||
[testenv]
|
||||
sitepackages = False
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONHASHSEED=0
|
||||
TERM=linux
|
||||
@ -17,24 +19,31 @@ commands = ostestr {posargs}
|
||||
[testenv:build]
|
||||
basepython = python2.7
|
||||
commands =
|
||||
charm-build --log-level DEBUG -o {toxinidir}/build .
|
||||
charm-build --log-level DEBUG -o {toxinidir}/build src
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = ostestr {posargs}
|
||||
|
||||
[testenv:py34]
|
||||
basepython = python3.4
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = ostestr {posargs}
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = ostestr {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python2.7
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = flake8 {posargs} hooks unit_tests tests actions
|
||||
charm-proof
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = flake8 {posargs} src unit_tests
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = E402,E226
|
||||
exclude = hooks/charmhelpers
|
||||
|
@ -0,0 +1,5 @@
|
||||
# By design, this unit_tests dir is outside the src charm (layer),
|
||||
# and it will not be included in the resultant built charm asset.
|
||||
#
|
||||
# Include unit tests here which are intended to be executable
|
||||
# from the source charm but not the built charm.
|
Loading…
Reference in New Issue
Block a user