Add functional tests

This commit is contained in:
Frode Nordahl 2019-10-11 16:02:40 +02:00
parent b404e25a3b
commit c4f3095553
No known key found for this signature in database
GPG Key ID: 6A5D59A3BA48373F
6 changed files with 149 additions and 2 deletions

View File

@ -1,7 +1,8 @@
sudo: true
dist: xenial
language: python
install: pip install tox-travis
install:
- pip install tox-travis
matrix:
include:
- name: "Python 3.6"
@ -10,5 +11,26 @@ matrix:
- name: "Python 3.7"
python: 3.7
env: ENV=pep8,py3
- name: "Functional test"
env: ENV=func-smoke
script:
- tox -c tox.ini -e $ENV
- if [ $ENV = 'func-smoke' ]; then
sudo apt update;
sudo apt install -y distro-info;
sudo apt remove -y --purge lxd lxd-client;
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';
echo "export PATH=$PATH;cd $(pwd)" > $HOME/saved_path;
sudo su - travis -c "source $HOME/saved_path; tox -e build";
sudo su - travis -c "source $HOME/saved_path; tox -c build/builds/ovn-chassis/tox.ini -e $ENV -- --log DEBUG";
else
tox -c tox.ini -e $ENV;
fi
- if [ $ENV = 'func-smoke' ]; then
sudo su travis -c 'juju status -m $(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/)';
fi

11
src/test-requirements.txt Normal file
View File

@ -0,0 +1,11 @@
# This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
charm-tools>=2.4.4
coverage>=3.6
mock>=1.2
flake8>=2.2.4,<=2.4.1
stestr>=2.2.0
requests>=2.18.4
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git@add-ovn#egg=zaza.openstack

View File

@ -0,0 +1,30 @@
series: bionic
relations:
- - vault:shared-db
- mysql:shared-db
- - ovn-central:certificates
- vault:certificates
- - ubuntu
- ovn-chassis
- - ovn-chassis:ovsdb
- ovn-central:ovsdb
- - ovn-chassis:certificates
- vault:certificates
applications:
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
vault:
charm: cs:~openstack-charmers-next/vault
num_units: 1
ovn-central:
charm: cs:~openstack-charmers-next/ovn-central
num_units: 3
options:
source: cloud:bionic-stein
ubuntu:
charm: cs:ubuntu
num_units: 1
ovn-chassis:
series: bionic
charm: cs:~openstack-charmers-next/ovn-chassis

View File

@ -0,0 +1,28 @@
series: disco
relations:
- - vault:shared-db
- mysql:shared-db
- - ovn-central:certificates
- vault:certificates
- - ubuntu
- ovn-chassis
- - ovn-chassis:ovsdb
- ovn-central:ovsdb
- - ovn-chassis:certificates
- vault:certificates
applications:
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
vault:
charm: cs:~openstack-charmers-next/vault
num_units: 1
ovn-central:
charm: cs:~openstack-charmers-next/ovn-central
num_units: 3
ubuntu:
charm: cs:ubuntu
num_units: 1
ovn-chassis:
series: disco
charm: cs:~openstack-charmers-next/ovn-chassis

20
src/tests/tests.yaml Normal file
View File

@ -0,0 +1,20 @@
charm_name: ovn-chassis
gate_bundles:
- disco
- bionic
smoke_bundles:
- bionic
target_deploy_status:
ovn-central:
workload-status: blocked
workload-status-message: "'certificates' missing"
ovn-chassis:
workload-status: blocked
workload-status-message: "'certificates' missing"
vault:
workload-status: blocked
workload-status-message: Vault needs to be initialized
configure:
- zaza.openstack.charm_tests.vault.setup.auto_initialize_no_validation
tests:
- zaza.charm_tests.noop.tests.NoopTest

36
src/tox.ini Normal file
View File

@ -0,0 +1,36 @@
[tox]
envlist = pep8
skipsdist = True
[testenv]
download = true
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
whitelist_externals = juju
passenv = HOME TERM CS_API_* OS_* AMULET_*
deps = -r{toxinidir}/test-requirements.txt
install_command =
pip install {opts} {packages}
[testenv:pep8]
basepython = python3
deps=charm-tools
commands = charm-proof
[testenv:func-noop]
basepython = python3
commands =
true
[testenv:func]
basepython = python3
commands =
functest-run-suite {posargs} --keep-model
[testenv:func-smoke]
basepython = python3
commands =
functest-run-suite {posargs} --keep-model --smoke
[testenv:venv]
commands = {posargs}