Merge "Add functional tests" into main
This commit is contained in:
commit
96f1f7f760
@ -2,3 +2,6 @@
|
|||||||
templates:
|
templates:
|
||||||
- openstack-python3-charm-yoga-jobs
|
- openstack-python3-charm-yoga-jobs
|
||||||
- openstack-cover-jobs
|
- openstack-cover-jobs
|
||||||
|
- microk8s-func-test
|
||||||
|
vars:
|
||||||
|
charm_build_name: cinder-k8s
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- charm-unit-jobs-py38
|
|
||||||
- charm-unit-jobs-py310
|
|
||||||
- charm-publish-jobs
|
- charm-publish-jobs
|
||||||
vars:
|
vars:
|
||||||
needs_charm_build: true
|
needs_charm_build: true
|
||||||
|
@ -313,12 +313,7 @@ class CinderOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
|||||||
self.sb_svc.set_ready()
|
self.sb_svc.set_ready()
|
||||||
|
|
||||||
|
|
||||||
class CinderXenaOperatorCharm(CinderOperatorCharm):
|
|
||||||
|
|
||||||
openstack_release = "xena"
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Note: use_juju_for_storage=True required per
|
# Note: use_juju_for_storage=True required per
|
||||||
# https://github.com/canonical/operator/issues/506
|
# 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
|
mock
|
||||||
flake8
|
flake8
|
||||||
stestr
|
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
|
import ops_sunbeam.test_utils as test_utils
|
||||||
|
|
||||||
|
|
||||||
class _CinderXenaOperatorCharm(charm.CinderXenaOperatorCharm):
|
class _CinderOperatorCharm(charm.CinderOperatorCharm):
|
||||||
|
|
||||||
def __init__(self, framework):
|
def __init__(self, framework):
|
||||||
self.seen_events = []
|
self.seen_events = []
|
||||||
@ -31,13 +31,12 @@ class _CinderXenaOperatorCharm(charm.CinderXenaOperatorCharm):
|
|||||||
self.seen_events.append(type(event).__name__)
|
self.seen_events.append(type(event).__name__)
|
||||||
|
|
||||||
def renderer(self, containers, container_configs, template_dir,
|
def renderer(self, containers, container_configs, template_dir,
|
||||||
openstack_release, adapters):
|
adapters):
|
||||||
self.render_calls.append(
|
self.render_calls.append(
|
||||||
(
|
(
|
||||||
containers,
|
containers,
|
||||||
container_configs,
|
container_configs,
|
||||||
template_dir,
|
template_dir,
|
||||||
openstack_release,
|
|
||||||
adapters))
|
adapters))
|
||||||
|
|
||||||
def configure_charm(self, event):
|
def configure_charm(self, event):
|
||||||
@ -59,7 +58,7 @@ class TestCinderOperatorCharm(test_utils.CharmTestCase):
|
|||||||
'remove_path': []}
|
'remove_path': []}
|
||||||
super().setUp(charm, self.PATCHES)
|
super().setUp(charm, self.PATCHES)
|
||||||
self.harness = test_utils.get_harness(
|
self.harness = test_utils.get_harness(
|
||||||
_CinderXenaOperatorCharm,
|
_CinderOperatorCharm,
|
||||||
container_calls=self.container_calls)
|
container_calls=self.container_calls)
|
||||||
self.addCleanup(self.harness.cleanup)
|
self.addCleanup(self.harness.cleanup)
|
||||||
self.harness.begin()
|
self.harness.begin()
|
||||||
|
@ -83,6 +83,31 @@ commands =
|
|||||||
coverage xml -o cover/coverage.xml
|
coverage xml -o cover/coverage.xml
|
||||||
coverage report
|
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]
|
[coverage:run]
|
||||||
branch = True
|
branch = True
|
||||||
concurrency = multiprocessing
|
concurrency = multiprocessing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user