Enable bionic/stein and disco/stein functional tests

Update name of ``backup_driver`` for Stein and onwards, reflecting
changes of how Oslo library now does import of drivers.

Change-Id: Icb050254488437bd1635fbe73b564238869e3421
This commit is contained in:
Frode Nordahl 2019-04-08 13:51:06 +02:00
parent d66b91003d
commit 31270aa9a7
No known key found for this signature in database
GPG Key ID: 6A5D59A3BA48373F
5 changed files with 77 additions and 3 deletions

View File

@ -42,7 +42,10 @@ class CephBackupSubordinateContext(OSContextGenerator):
raise Exception("Unsupported version of Openstack")
service = service_name()
backup_driver = 'cinder.backup.drivers.ceph'
if CompareOpenStackReleases(release) >= "stein":
backup_driver = 'cinder.backup.drivers.ceph.CephBackupDriver'
else:
backup_driver = 'cinder.backup.drivers.ceph'
return {
"cinder": {
"/etc/cinder/cinder.conf": {

View File

@ -335,9 +335,13 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
unit = self.cinder_backup_sentry
relation = ['backup-backend', 'cinder:backup-backend']
if self._get_openstack_release() >= self.bionic_stein:
backup_driver = 'cinder.backup.drivers.ceph.CephBackupDriver'
else:
backup_driver = 'cinder.backup.drivers.ceph'
sub = ('{"cinder": {"/etc/cinder/cinder.conf": {"sections": '
'{"DEFAULT": ['
'["backup_driver", "cinder.backup.drivers.ceph"], '
'["backup_driver", "'+backup_driver+'"], '
'["backup_ceph_conf", '
'"/var/lib/charm/cinder-backup/ceph.conf"], '
'["backup_ceph_pool", "cinder-backup"], '
@ -495,6 +499,11 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
unit_mq = self.rabbitmq_sentry
rel_mq_ci = unit_mq.relation('amqp', 'cinder:amqp')
if self._get_openstack_release() >= self.bionic_stein:
backup_driver = 'cinder.backup.drivers.ceph.CephBackupDriver'
else:
backup_driver = 'cinder.backup.drivers.ceph'
expected = {
'DEFAULT': {
'use_syslog': 'False',
@ -505,7 +514,7 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
'auth_strategy': 'keystone',
'volumes_dir': '/var/lib/cinder/volumes',
'enabled_backends': 'cinder-ceph',
'backup_driver': 'cinder.backup.drivers.ceph',
'backup_driver': backup_driver,
'backup_ceph_pool': 'cinder-backup',
'backup_ceph_user': 'cinder-backup'
},

23
tests/dev-basic-disco-stein Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env python
#
# Copyright 2016 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.
"""Amulet tests on a basic cinder-backup deployment on disco-stein."""
from basic_deployment import CinderBackupBasicDeployment
if __name__ == '__main__':
deployment = CinderBackupBasicDeployment(series='disco')
deployment.run_tests()

25
tests/gate-basic-bionic-stein Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
#
# Copyright 2016 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.
"""Amulet tests on a basic cinder backup deployment on bionic-stein."""
from basic_deployment import CinderBackupBasicDeployment
if __name__ == '__main__':
deployment = CinderBackupBasicDeployment(series='bionic',
openstack='cloud:bionic-stein',
source='cloud:bionic-stein')
deployment.run_tests()

View File

@ -46,6 +46,20 @@ class TestCinderBackupContext(CharmTestCase):
('backup_ceph_user',
'cinder-backup-ut')]}}}}
self.assertEqual(ctxt, exp)
self.get_os_codename_package.return_value = 'stein'
exp = {'cinder': {'/etc/cinder/cinder.conf':
{'sections': {'DEFAULT':
[('backup_driver',
'cinder.backup.drivers.ceph.'
'CephBackupDriver'),
('backup_ceph_conf',
'/var/lib/charm/'
'cinder-backup-ut/ceph.conf'),
('backup_ceph_pool',
'cinder-backup-ut'),
('backup_ceph_user',
'cinder-backup-ut')]}}}}
self.assertEqual(contexts.CephBackupSubordinateContext()(), exp)
def test_backup_context_unsupported(self):
self.get_os_codename_package.return_value = 'havana'