Merge pull request #132 from fnordahl/feature/add_functional_test
Add self-hosted functional test of Zaza
This commit is contained in:
27
.travis.yml
27
.travis.yml
@@ -1,9 +1,28 @@
|
||||
sudo: false
|
||||
sudo: true
|
||||
language: python
|
||||
dist: xenial
|
||||
python:
|
||||
- "3.6"
|
||||
install: pip install tox-travis
|
||||
env:
|
||||
- ENV=pep8
|
||||
- ENV=py3
|
||||
- ENV=func-travis
|
||||
comment: |
|
||||
install dependencies in script phase saving time on simpler test environments
|
||||
sudo back to ourself to activate lxd group membership executable search path
|
||||
script:
|
||||
- tox -c tox.ini -e pep8
|
||||
- tox -c tox.ini -e py3
|
||||
- if [ $ENV = 'func-travis' ]; then
|
||||
sudo apt-get -qq update;
|
||||
sudo apt-get -y install snapd;
|
||||
sudo snap install lxd;
|
||||
sudo snap install juju --classic;
|
||||
sudo sh -c 'echo PATH=/snap/bin:$PATH >> /etc/environment';
|
||||
sudo lxd waitready;
|
||||
sudo lxd init --auto;
|
||||
sudo usermod -a -G lxd travis;
|
||||
sudo su travis -c 'juju bootstrap --no-gui localhost';
|
||||
fi
|
||||
- tox -c tox.ini -e $ENV
|
||||
- if [ $ENV = 'func-travis' ]; then
|
||||
sudo su travis -c 'juju status -m $(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/)';
|
||||
fi
|
||||
|
||||
2
tests/README.md
Normal file
2
tests/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
This directory contains functional test definition for functional test of Zaza
|
||||
itself.
|
||||
5
tests/bundles/magpie.yaml
Normal file
5
tests/bundles/magpie.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
series: bionic
|
||||
applications:
|
||||
magpie:
|
||||
charm: cs:~admcleod/magpie
|
||||
num_units: 2
|
||||
1
tests/bundles/overlays/local-charm-overlay.yaml.j2
Normal file
1
tests/bundles/overlays/local-charm-overlay.yaml.j2
Normal file
@@ -0,0 +1 @@
|
||||
comment: this bundle overlay intentionally left blank
|
||||
11
tests/tests.yaml
Normal file
11
tests/tests.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
charm_name: none
|
||||
gate_bundles:
|
||||
- magpie
|
||||
target_deploy_status:
|
||||
magpie:
|
||||
workload-status: active
|
||||
workload-status-message: icmp ok, local hostname ok, dns ok
|
||||
configure:
|
||||
- zaza.charm_tests.noop.setup.basic_setup
|
||||
tests:
|
||||
- zaza.charm_tests.noop.tests.NoopTest
|
||||
17
tox.ini
17
tox.ini
@@ -34,3 +34,20 @@ changedir = doc/source
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
commands = sphinx-build -W -b html -d {toxinidir}/doc/build/doctrees . {toxinidir}/doc/build/html
|
||||
|
||||
[testenv:func]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
commands =
|
||||
{envdir}/bin/python3 setup.py install
|
||||
functest-run-suite --keep-model
|
||||
|
||||
[testenv:func-travis]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
# sudo back to ourself to activate lxd group membership executable search path
|
||||
whitelist_externals = sudo
|
||||
passenv = USER
|
||||
commands =
|
||||
{envdir}/bin/python3 setup.py install
|
||||
sudo su {env:USER} -c 'source {envdir}/bin/activate && functest-run-suite --keep-model'
|
||||
|
||||
15
zaza/charm_tests/noop/__init__.py
Normal file
15
zaza/charm_tests/noop/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright 2018 Canonical Ltd.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Collection of code for validating Zaza."""
|
||||
22
zaza/charm_tests/noop/setup.py
Normal file
22
zaza/charm_tests/noop/setup.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Copyright 2018 Canonical Ltd.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Code for validating Zaza configure function loader."""
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
def basic_setup():
|
||||
"""Run setup."""
|
||||
logging.info('OK')
|
||||
33
zaza/charm_tests/noop/tests.py
Normal file
33
zaza/charm_tests/noop/tests.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright 2018 Canonical Ltd.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Code for validating Zaza test class loader."""
|
||||
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
|
||||
class NoopTest(unittest.TestCase):
|
||||
"""Code for validating Zaza test class loader."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Run class setup for noop tests."""
|
||||
super(NoopTest, cls).setUpClass()
|
||||
|
||||
def test_foo(self):
|
||||
"""foo."""
|
||||
logging.info('bar')
|
||||
Reference in New Issue
Block a user