Add functional tests
Change includes removing openstack_release inline with its removal from charm-ops-sunbeam Change-Id: I3956ba82cc54059f2b47bb217810752974516ccc
This commit is contained in:
parent
661ae1b364
commit
d0872ff7e6
@ -2,3 +2,6 @@
|
||||
templates:
|
||||
- openstack-python3-charm-yoga-jobs
|
||||
- openstack-cover-jobs
|
||||
- microk8s-func-test
|
||||
vars:
|
||||
charm_build_name: cinder-k8s
|
||||
|
@ -1,7 +1,5 @@
|
||||
- project:
|
||||
templates:
|
||||
- charm-unit-jobs-py38
|
||||
- charm-unit-jobs-py310
|
||||
- charm-publish-jobs
|
||||
vars:
|
||||
needs_charm_build: true
|
||||
|
@ -253,7 +253,6 @@ class CinderOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||
self.service_name,
|
||||
self.container_configs,
|
||||
self.template_dir,
|
||||
self.openstack_release,
|
||||
self.configure_charm,
|
||||
f"wsgi-{self.service_name}",
|
||||
),
|
||||
@ -263,7 +262,6 @@ class CinderOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||
"cinder-scheduler",
|
||||
[],
|
||||
self.template_dir,
|
||||
self.openstack_release,
|
||||
self.configure_charm,
|
||||
),
|
||||
]
|
||||
@ -315,12 +313,7 @@ class CinderOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||
self.sb_svc.set_ready()
|
||||
|
||||
|
||||
class CinderXenaOperatorCharm(CinderOperatorCharm):
|
||||
|
||||
openstack_release = "xena"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Note: use_juju_for_storage=True required per
|
||||
# https://github.com/canonical/operator/issues/506
|
||||
main(CinderXenaOperatorCharm, use_juju_for_storage=True)
|
||||
main(CinderOperatorCharm, use_juju_for_storage=True)
|
||||
|
@ -8,3 +8,7 @@ coverage
|
||||
mock
|
||||
flake8
|
||||
stestr
|
||||
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
|
||||
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack
|
||||
git+https://opendev.org/openstack/tempest.git#egg=tempest
|
||||
ops
|
||||
|
67
charms/cinder-k8s/tests/bundles/xena.yaml
Normal file
67
charms/cinder-k8s/tests/bundles/xena.yaml
Normal file
@ -0,0 +1,67 @@
|
||||
bundle: kubernetes
|
||||
applications:
|
||||
|
||||
mysql:
|
||||
charm: ch:mysql-k8s
|
||||
channel: edge
|
||||
scale: 1
|
||||
trust: false
|
||||
|
||||
# Currently traefik is required for networking things.
|
||||
# If this isn't present, the units will hang at "installing agent".
|
||||
traefik:
|
||||
charm: ch:traefik-k8s
|
||||
channel: edge
|
||||
scale: 1
|
||||
trust: true
|
||||
|
||||
traefik-public:
|
||||
charm: ch:traefik-k8s
|
||||
channel: edge
|
||||
scale: 1
|
||||
trust: true
|
||||
options:
|
||||
kubernetes-service-annotations: metallb.universe.tf/address-pool=public
|
||||
|
||||
rabbitmq:
|
||||
charm: ch:rabbitmq-k8s
|
||||
channel: edge
|
||||
scale: 1
|
||||
trust: true
|
||||
|
||||
keystone:
|
||||
charm: ch:keystone-k8s
|
||||
channel: edge
|
||||
scale: 1
|
||||
trust: true
|
||||
options:
|
||||
admin-role: admin
|
||||
storage:
|
||||
fernet-keys: 5M
|
||||
credential-keys: 5M
|
||||
|
||||
cinder:
|
||||
charm: ../../cinder-k8s.charm
|
||||
scale: 1
|
||||
trust: true
|
||||
resources:
|
||||
cinder-api-image: docker.io/kolla/ubuntu-binary-cinder-api:xena
|
||||
cinder-scheduler-image: docker.io/kolla/ubuntu-binary-cinder-scheduler:xena
|
||||
|
||||
relations:
|
||||
- - traefik:ingress
|
||||
- keystone:ingress-internal
|
||||
- - traefik-public:ingress
|
||||
- keystone:ingress-public
|
||||
|
||||
- - mysql:database
|
||||
- keystone:database
|
||||
|
||||
- - mysql:database
|
||||
- cinder:database
|
||||
- - keystone:identity-service
|
||||
- cinder:identity-service
|
||||
- - traefik:ingress
|
||||
- cinder:ingress-internal
|
||||
- - traefik-public:ingress
|
||||
- cinder:ingress-public
|
34
charms/cinder-k8s/tests/tests.yaml
Normal file
34
charms/cinder-k8s/tests/tests.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
gate_bundles:
|
||||
- xena
|
||||
smoke_bundles:
|
||||
- xena
|
||||
# There is no storage provider at the moment so cannot run tests.
|
||||
configure:
|
||||
- zaza.charm_tests.noop.setup.basic_setup
|
||||
tests:
|
||||
- zaza.charm_tests.noop.tests.NoopTest
|
||||
tests_options:
|
||||
trust:
|
||||
- xena
|
||||
ignore_hard_deploy_errors:
|
||||
- xena
|
||||
|
||||
target_deploy_status:
|
||||
traefik:
|
||||
workload-status: active
|
||||
workload-status-message-regex: '^$'
|
||||
traefik-public:
|
||||
workload-status: active
|
||||
workload-status-message-regex: '^$'
|
||||
rabbitmq:
|
||||
workload-status: active
|
||||
workload-status-message-regex: '^$'
|
||||
keystone:
|
||||
workload-status: active
|
||||
workload-status-message-regex: '^$'
|
||||
mysql:
|
||||
workload-status: active
|
||||
workload-status-message-regex: '^$'
|
||||
cinder:
|
||||
workload-status: blocked
|
||||
workload-status-message-regex: '\(storage-backend\) integration missing'
|
@ -20,7 +20,7 @@ import charm
|
||||
import ops_sunbeam.test_utils as test_utils
|
||||
|
||||
|
||||
class _CinderXenaOperatorCharm(charm.CinderXenaOperatorCharm):
|
||||
class _CinderOperatorCharm(charm.CinderOperatorCharm):
|
||||
|
||||
def __init__(self, framework):
|
||||
self.seen_events = []
|
||||
@ -31,13 +31,12 @@ class _CinderXenaOperatorCharm(charm.CinderXenaOperatorCharm):
|
||||
self.seen_events.append(type(event).__name__)
|
||||
|
||||
def renderer(self, containers, container_configs, template_dir,
|
||||
openstack_release, adapters):
|
||||
adapters):
|
||||
self.render_calls.append(
|
||||
(
|
||||
containers,
|
||||
container_configs,
|
||||
template_dir,
|
||||
openstack_release,
|
||||
adapters))
|
||||
|
||||
def configure_charm(self, event):
|
||||
@ -59,7 +58,7 @@ class TestCinderOperatorCharm(test_utils.CharmTestCase):
|
||||
'remove_path': []}
|
||||
super().setUp(charm, self.PATCHES)
|
||||
self.harness = test_utils.get_harness(
|
||||
_CinderXenaOperatorCharm,
|
||||
_CinderOperatorCharm,
|
||||
container_calls=self.container_calls)
|
||||
self.addCleanup(self.harness.cleanup)
|
||||
self.harness.begin()
|
||||
|
@ -83,6 +83,31 @@ commands =
|
||||
coverage xml -o cover/coverage.xml
|
||||
coverage report
|
||||
|
||||
[testenv:func-noop]
|
||||
basepython = python3
|
||||
commands =
|
||||
functest-run-suite --help
|
||||
|
||||
[testenv:func]
|
||||
basepython = python3
|
||||
commands =
|
||||
functest-run-suite --keep-model
|
||||
|
||||
[testenv:func-smoke]
|
||||
basepython = python3
|
||||
commands =
|
||||
functest-run-suite --keep-model --smoke
|
||||
|
||||
[testenv:func-dev]
|
||||
basepython = python3
|
||||
commands =
|
||||
functest-run-suite --keep-model --dev
|
||||
|
||||
[testenv:func-target]
|
||||
basepython = python3
|
||||
commands =
|
||||
functest-run-suite --keep-model --bundle {posargs}
|
||||
|
||||
[coverage:run]
|
||||
branch = True
|
||||
concurrency = multiprocessing
|
||||
|
Loading…
x
Reference in New Issue
Block a user