Add test with the detach-database plugin
Change-Id: I7a8c9be06c926aa94883d0de703e953f5b5484e3
This commit is contained in:
parent
d59549d754
commit
8402a9e734
@ -23,7 +23,22 @@ from fuelweb_test import logger
|
||||
from proboscis import asserts
|
||||
|
||||
|
||||
PACKAGE_VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)')
|
||||
PLUGIN_PACKAGE_RE = re.compile(r'([^/]+)-(\d+\.\d+)-(\d+\.\d+\.\d+)')
|
||||
|
||||
|
||||
def get_plugin_name(filename):
|
||||
"""Extract the plugin name from the package filename.
|
||||
|
||||
:param filename: the plugin's filename.
|
||||
:type filename: str
|
||||
:returns: the plugin's name or None if not found
|
||||
:rtype: str
|
||||
"""
|
||||
m = PLUGIN_PACKAGE_RE.search(filename or '')
|
||||
if m:
|
||||
return m.group(1)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def get_plugin_version(filename):
|
||||
@ -34,9 +49,9 @@ def get_plugin_version(filename):
|
||||
:returns: the plugin's version or None if not found
|
||||
:rtype: str
|
||||
"""
|
||||
m = PACKAGE_VERSION_RE.search(filename or '')
|
||||
m = PLUGIN_PACKAGE_RE.search(filename or '')
|
||||
if m:
|
||||
return m.group(1)
|
||||
return m.group(3)
|
||||
else:
|
||||
return None
|
||||
|
||||
@ -81,7 +96,9 @@ class PluginHelper(object):
|
||||
"""
|
||||
if options is None:
|
||||
options = {}
|
||||
msg = "Plugin couldn't be enabled. Check plugin version. Test aborted"
|
||||
msg = "Plugin {name} ({version}) couldn't be enabled.".format(
|
||||
name=name,
|
||||
version=version)
|
||||
asserts.assert_true(
|
||||
self.fuel_web.check_plugin_exists(self.cluster_id, name),
|
||||
msg)
|
||||
|
@ -1,9 +1,13 @@
|
||||
from fuelweb_test.settings import * # noqa
|
||||
|
||||
# StackLight plugins
|
||||
LMA_COLLECTOR_PLUGIN_PATH = os.environ.get('LMA_COLLECTOR_PLUGIN_PATH')
|
||||
LMA_INFRA_ALERTING_PLUGIN_PATH = os.environ.get(
|
||||
'LMA_INFRA_ALERTING_PLUGIN_PATH')
|
||||
ELASTICSEARCH_KIBANA_PLUGIN_PATH = os.environ.get(
|
||||
'ELASTICSEARCH_KIBANA_PLUGIN_PATH')
|
||||
INFLUXDB_GRAFANA_PLUGIN_PATH = os.environ.get('INFLUXDB_GRAFANA_PLUGIN_PATH')
|
||||
|
||||
# Detach plugins
|
||||
DETACH_DATABASE_PLUGIN_PATH = os.environ.get('DETACH_DATABASE_PLUGIN_PATH')
|
||||
DETACH_RABBITMQ_PLUGIN_PATH = os.environ.get('DETACH_RABBITMQ_PLUGIN_PATH')
|
||||
|
@ -16,7 +16,9 @@ from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from proboscis import asserts
|
||||
from proboscis import test
|
||||
|
||||
from stacklight_tests.helpers.helpers import get_plugin_name
|
||||
from stacklight_tests.helpers.helpers import get_plugin_version
|
||||
from stacklight_tests.settings import DETACH_DATABASE_PLUGIN_PATH
|
||||
from stacklight_tests.settings import DETACH_RABBITMQ_PLUGIN_PATH
|
||||
from stacklight_tests.toolchain import api
|
||||
|
||||
@ -51,28 +53,84 @@ class TestToolchainDetachPlugins(api.ToolchainApi):
|
||||
Snapshot deploy_toolchain_with_detached_rabbitmq
|
||||
"""
|
||||
self.check_run("deploy_toolchain_with_detached_rabbitmq")
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
asserts.assert_is_not_none(
|
||||
DETACH_RABBITMQ_PLUGIN_PATH,
|
||||
"DETACH_RABBITMQ_PLUGIN_PATH variable should be set"
|
||||
)
|
||||
self.helpers.prepare_plugin(DETACH_RABBITMQ_PLUGIN_PATH)
|
||||
|
||||
self._deploy_toolchain_with_detached_plugin(
|
||||
"deploy_toolchain_with_detached_rabbitmq",
|
||||
DETACH_RABBITMQ_PLUGIN_PATH,
|
||||
"standalone-rabbitmq"
|
||||
)
|
||||
|
||||
@test(depends_on_groups=['prepare_slaves_5'],
|
||||
groups=["deploy_toolchain_with_detached_database", "deploy",
|
||||
"toolchain", "detached_plugins"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_toolchain_with_detached_database(self):
|
||||
"""Deploy a cluster with the LMA Toolchain plugins and the
|
||||
detach-database plugin.
|
||||
|
||||
Scenario:
|
||||
1. Upload the plugins to the master node
|
||||
2. Install the plugins
|
||||
3. Create the cluster
|
||||
4. Add 1 node with the controller role
|
||||
4. Add 1 node with the database role
|
||||
5. Add 1 node with the compute and cinder roles
|
||||
6. Add 1 node with the plugin roles
|
||||
7. Deploy the cluster
|
||||
8. Check that LMA Toolchain plugins are running
|
||||
9. Run OSTF
|
||||
|
||||
Duration 60m
|
||||
Snapshot deploy_toolchain_with_detached_database
|
||||
"""
|
||||
self.check_run("deploy_toolchain_with_detached_database")
|
||||
|
||||
asserts.assert_is_not_none(
|
||||
DETACH_DATABASE_PLUGIN_PATH,
|
||||
"DETACH_DATABASE_PLUGIN_PATH variable should be set"
|
||||
)
|
||||
|
||||
self._deploy_toolchain_with_detached_plugin(
|
||||
"deploy_toolchain_with_detached_database",
|
||||
DETACH_DATABASE_PLUGIN_PATH,
|
||||
"standalone-database"
|
||||
)
|
||||
|
||||
def _deploy_toolchain_with_detached_plugin(self, caller, plugin_path,
|
||||
plugin_role, ha=False):
|
||||
self.check_run(caller)
|
||||
if ha:
|
||||
self.env.revert_snapshot("ready_with_9_slaves")
|
||||
else:
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
self.helpers.prepare_plugin(plugin_path)
|
||||
self.prepare_plugins()
|
||||
|
||||
self.helpers.create_cluster(name=self.__class__.__name__)
|
||||
self.helpers.create_cluster(name=caller)
|
||||
|
||||
self.activate_plugins()
|
||||
self.helpers.activate_plugin(
|
||||
'detach-rabbitmq', get_plugin_version(DETACH_RABBITMQ_PLUGIN_PATH))
|
||||
get_plugin_name(plugin_path), get_plugin_version(plugin_path))
|
||||
|
||||
if ha:
|
||||
nodes = self.settings.full_ha_nodes.copy()
|
||||
# TODO(all): implement a mechanism to assign roles without
|
||||
# hard-coding the names of the nodes
|
||||
nodes['slave-06'] = [plugin_role]
|
||||
else:
|
||||
nodes = self.settings.base_nodes.copy()
|
||||
nodes['slave-04'] = [plugin_role]
|
||||
|
||||
nodes = self.settings.base_nodes.copy()
|
||||
nodes['slave-04'] = ['standalone-rabbitmq']
|
||||
self.helpers.deploy_cluster(nodes)
|
||||
|
||||
self.check_plugins_online()
|
||||
|
||||
self.helpers.run_ostf()
|
||||
|
||||
self.env.make_snapshot("deploy_toolchain_with_detached_rabbitmq",
|
||||
is_make=True)
|
||||
self.env.make_snapshot(caller, is_make=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user