Fix tox files and use avalable flag in handler

This commit is contained in:
lolwww
2019-06-27 22:06:19 +03:00
parent da0f9631f9
commit 0574dc0e0c
9 changed files with 83 additions and 17 deletions

View File

@@ -9,3 +9,5 @@ Jinja2>=2.6 # BSD License (3 clause)
six>=1.9.0
dnspython>=1.12.0
psutil>=1.1.1,<2.0.0
## Build requirements
charm-tools>=2.4.4

View File

@@ -1,6 +1,8 @@
includes:
- 'layer:openstack'
- 'interface:cinder-backup'
repo: https://github.com/openstack/charm-cinder-backup-swift
options:
basic:
repo: https://github.com/lolwww/charm-cinder-backup-swift-reactive
use_venv: true
include_system_packages: true

View File

@@ -18,7 +18,7 @@ flags.register_trigger(when='endpoint.backup-backend.changed',
clear_flag='config.complete')
@reactive.when_any('endpoint.backup-backend.joined', 'endpoint.backup-backend.changed')
@reactive.when_any('backup-backend.available')
@reactive.when_not('config.complete')
def configure_cinder_backup():
# don't always have a relation context - obtain from the flag

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

@@ -0,0 +1,22 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
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
# Unit test requirements
charms.reactive
git+https://github.com/openstack/charms.openstack#egg=charms.openstack
# NOTE: workaround for 14.04 pip/tox
pytz
pyudev # for ceph-* charm unit tests (not mocked?)
# For functional tests
git+https://github.com/openstack-charmers/zaza.git#egg=zaza;python_version>='3.0'
git+https://github.com/openstack/charms.openstack#egg=charms.openstack
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack

View File

@@ -13,6 +13,8 @@ machines:
series: bionic
'6':
series: bionic
'7':
series: bionic
relations:
- - nova-compute:amqp
@@ -73,6 +75,8 @@ relations:
- swift-storage-z2:swift-storage
- - swift-proxy:swift-storage
- swift-storage-z3:swift-storage
- - swift-proxy:swift-storage
- swift-storage-z4:swift-storage
applications:
ceph-mon:
@@ -110,7 +114,7 @@ applications:
num_units: 0
cinder-backup-swift:
series: bionic
charm: cinder-backup-swift
charm: /home/alex/Documents/Code/localcharmrepo/charms/builds/cinder-backup-swift
num_units: 0
options:
auth-version: 3
@@ -214,4 +218,13 @@ applications:
block-device: "/dev/sdb"
to:
- '6'
swift-storage-z4:
series: bionic
charm: cs:swift-storage
num_units: 1
options:
zone: 4
block-device: "/dev/sdb"
to:
- '7'

38
src/tox.ini Normal file
View File

@@ -0,0 +1,38 @@
[tox]
skipsdist = True
envlist = pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
whitelist_externals = juju
passenv = HOME TERM CS_* OS_*
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 --keep-model
deps = -r{toxinidir}/test-requirements.txt
# -r{toxinidir}/requirements.txt
[testenv:func-smoke]
basepython = python3
commands =
functest-run-suite --keep-model --smoke
[testenv:venv]
commands = {posargs}

17
tox.ini
View File

@@ -10,8 +10,8 @@ skip_missing_interpreters = True
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
TERM=linux
LAYER_PATH={toxinidir}/layers
INTERFACE_PATH={toxinidir}/interfaces
CHARM_LAYERS_DIR={toxinidir}/layers
CHARM_INTERFACES_DIR={toxinidir}/interfaces
JUJU_REPOSITORY={toxinidir}/build
passenv = http_proxy https_proxy
install_command =
@@ -20,12 +20,8 @@ deps =
-r{toxinidir}/requirements.txt
[testenv:build]
whitelist_externals=/snap/bin/charm
/usr/bin/sudo
/usr/bin/snap
/bin/sh
basepython = python2.7
commands =
sh -c 'snap list charm 2>/dev/null || sudo snap install charm'
charm build --log-level DEBUG -o {toxinidir}/build src {posargs}
[testenv:py27]
@@ -56,13 +52,6 @@ basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = flake8 {posargs} src unit_tests
[testenv:func]
basepython = python3
commands =
functest-run-suite --keep-model
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:venv]
basepython = python3
commands = {posargs}