Add ceph pg tuning test
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
"""Ceph Testing."""
|
||||
|
||||
import unittest
|
||||
import json
|
||||
import logging
|
||||
from os import (
|
||||
listdir,
|
||||
@@ -56,7 +57,7 @@ class CephLowLevelTest(test_utils.OpenStackBaseTest):
|
||||
}
|
||||
|
||||
ceph_osd_processes = {
|
||||
'ceph-osd': [2, 3]
|
||||
'ceph-osd': [1, 2, 3]
|
||||
}
|
||||
|
||||
# Units with process names and PID quantities expected
|
||||
@@ -95,6 +96,16 @@ class CephLowLevelTest(test_utils.OpenStackBaseTest):
|
||||
target_status='running'
|
||||
)
|
||||
|
||||
@test_utils.skipUntilVersion('ceph-mon', 'ceph', '14.2.0')
|
||||
def test_pg_tuning(self):
|
||||
"""Verify that auto PG tuning is enabled for Nautilus+."""
|
||||
unit_name = 'ceph-mon/0'
|
||||
cmd = "ceph osd pool autoscale-status --format=json"
|
||||
result = zaza_model.run_on_unit(unit_name, cmd)
|
||||
self.assertEqual(result['Code'], '0')
|
||||
for pool in json.loads(result['Stdout']):
|
||||
self.assertEqual(pool['pg_autoscale_mode'], 'on')
|
||||
|
||||
|
||||
class CephRelationTest(test_utils.OpenStackBaseTest):
|
||||
"""Ceph's relations test class."""
|
||||
@@ -138,7 +149,6 @@ class CephRelationTest(test_utils.OpenStackBaseTest):
|
||||
fsid = result.get('Stdout').strip()
|
||||
expected = {
|
||||
'private-address': remote_ip,
|
||||
'auth': 'none',
|
||||
'ceph-public-address': remote_ip,
|
||||
'fsid': fsid,
|
||||
}
|
||||
@@ -408,9 +418,14 @@ class CephTest(test_utils.OpenStackBaseTest):
|
||||
|
||||
set_default = {
|
||||
'ephemeral-unmount': '',
|
||||
'osd-devices': '/dev/vdb /srv/ceph',
|
||||
'osd-devices': '/dev/vdb',
|
||||
}
|
||||
|
||||
current_release = zaza_openstack.get_os_release()
|
||||
bionic_train = zaza_openstack.get_os_release('bionic_train')
|
||||
if current_release < bionic_train:
|
||||
set_default['osd-devices'] = '/dev/vdb /srv/ceph'
|
||||
|
||||
logging.info('Restoring to default configuration...')
|
||||
zaza_model.set_application_config(juju_service, set_default)
|
||||
|
||||
|
||||
@@ -14,12 +14,14 @@
|
||||
"""Module containg base class for implementing charm tests."""
|
||||
import contextlib
|
||||
import logging
|
||||
import subprocess
|
||||
import unittest
|
||||
import zaza.model
|
||||
|
||||
import zaza.model as model
|
||||
import zaza.charm_lifecycle.utils as lifecycle_utils
|
||||
import zaza.openstack.utilities.openstack as openstack_utils
|
||||
import zaza.openstack.utilities.generic as generic_utils
|
||||
|
||||
|
||||
def skipIfNotHA(service_name):
|
||||
@@ -38,6 +40,25 @@ def skipIfNotHA(service_name):
|
||||
return _skipIfNotHA_inner_1
|
||||
|
||||
|
||||
def skipUntilVersion(service, package, release):
|
||||
"""Run decorator to skip this test if application version is too low."""
|
||||
def _skipUntilVersion_inner_1(f):
|
||||
def _skipUntilVersion_inner_2(*args, **kwargs):
|
||||
package_version = generic_utils.get_pkg_version(service, package)
|
||||
try:
|
||||
subprocess.check_call(['dpkg', '--compare-versions',
|
||||
package_version, 'ge', release],
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True)
|
||||
return f(*args, **kwargs)
|
||||
except subprocess.CalledProcessError as cp:
|
||||
logging.warn("Skipping test for older ({})"
|
||||
"service {}, requested {}".format(
|
||||
package_version, service, release))
|
||||
return _skipUntilVersion_inner_2
|
||||
return _skipUntilVersion_inner_1
|
||||
|
||||
|
||||
def audit_assertions(action,
|
||||
expected_passes,
|
||||
expected_failures=None,
|
||||
|
||||
Reference in New Issue
Block a user