Add smoke test for Redis plugin

Change-Id: Iff2a9a27919f4757edfd289260a48df260a3f110
This commit is contained in:
Artem 2016-06-20 17:21:36 +03:00
parent 29f7be46e6
commit f91cbe048f
6 changed files with 237 additions and 0 deletions

View File

@ -0,0 +1,51 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
from stacklight_tests import base_test
from stacklight_tests.ceilometer_redis import plugin_settings
class CeilometerRedisPluginApi(base_test.PluginApi):
def get_plugin_vip(self):
pass
def get_plugin_settings(self):
return plugin_settings
def prepare_plugin(self):
self.helpers.prepare_plugin(self.settings.plugin_path)
def run_ostf(self):
self.helpers.run_ostf(test_sets=['sanity', 'smoke', 'ha',
'tests_platform'])
def activate_plugin(self, options=None):
if options is None:
options = self.settings.default_options
self.helpers.activate_plugin(
self.settings.name, self.settings.version, options)
def check_plugin_online(self):
resource_names = ['p_redis-server', 'p_ceilometer-agent-central',
'p_aodh-evaluator']
for resource_name in resource_names:
self.helpers.check_pacemaker_resource(resource_name, "controller")
def uninstall_plugin(self):
return self.helpers.uninstall_plugin(self.settings.name,
self.settings.version)
def check_uninstall_failure(self):
return self.helpers.check_plugin_cannot_be_uninstalled(
self.settings.name, self.settings.version)

View File

@ -0,0 +1,28 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
from stacklight_tests.helpers import helpers
from stacklight_tests import settings
name = 'ceilometer-redis'
plugin_path = settings.CEILOMETER_REDIS_PLUGIN_PATH
version = helpers.get_plugin_version(plugin_path)
default_options = {}
base_nodes = {
'slave-01': ['controller', 'mongo'],
'slave-02': ['controller', 'mongo'],
'slave-03': ['controller', 'mongo'],
'slave-04': ['compute', 'cinder'],
'slave-05': ['compute', 'cinder']
}

View File

@ -0,0 +1,128 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from plugin_settings import base_nodes
from proboscis import test
from stacklight_tests.ceilometer_redis import api
@test(groups=["plugins"])
class TestCeilometerRedis(api.CeilometerRedisPluginApi):
"""Class for smoke testing the Ceilometer-Redis plugin."""
@test(depends_on_groups=['prepare_slaves_5'],
groups=["install_ceilometer_redis", "install",
"ceilometer_redis", "smoke"])
@log_snapshot_after_test
def install_ceilometer_redis(self):
"""Install Ceilometer-Redis plugin and check it exists
Scenario:
1. Upload the Ceilometer-Redis plugin to the master node
2. Install the plugin
3. Create a cluster
4. Check that the plugin can be enabled
Duration 90m
"""
self.env.revert_snapshot("ready_with_5_slaves")
self.prepare_plugin()
self.helpers.create_cluster(name=self.__class__.__name__,
settings={'ceilometer': True})
self.activate_plugin()
@test(depends_on_groups=['prepare_slaves_5'],
groups=["deploy_ceilometer_redis", "deploy",
"ceilometer_redis", "smoke"])
@log_snapshot_after_test
def deploy_ceilometer_redis(self):
"""Deploy a cluster with the Ceilometer-Redis plugin
Scenario:
1. Upload the Ceilometer-Redis plugin to the master node
2. Install the plugin
3. Create the cluster
4. Add 3 node with controller with Mongo
5. Add 2 node with compute and cinder roles
7. Deploy the cluster
8. Check that Ceilometer-Redis are running
9. Run OSTF
Duration 60m
Snapshot deploy_ceilometer_redis
"""
self.check_run("deploy_ceilometer_redis")
self.env.revert_snapshot("ready_with_5_slaves")
self.prepare_plugin()
self.helpers.create_cluster(name=self.__class__.__name__,
settings={'ceilometer': True})
self.activate_plugin()
self.helpers.deploy_cluster(base_nodes)
self.check_plugin_online()
self.run_ostf()
self.env.make_snapshot("deploy_ceilometer_redis", is_make=True)
@test(depends_on_groups=["prepare_slaves_5"],
groups=["uninstall_ceilometer_redis", "uninstall",
"ceilometer_redis", "smoke"])
@log_snapshot_after_test
def uninstall_ceilometer_redis(self):
"""Uninstall the Ceilometer-Redis plugin
Scenario:
1. Install the plugin.
2. Remove the plugin.
Duration 5m
"""
self.env.revert_snapshot("ready_with_5_slaves")
self.prepare_plugin()
self.uninstall_plugin()
@test(depends_on_groups=[deploy_ceilometer_redis],
groups=["uninstall_deployed_ceilometer_redis", "uninstall",
"ceilometer_redis", "smoke"])
@log_snapshot_after_test
def uninstall_deployed_ceilometer_redis(self):
"""Uninstall the Ceilometer-Redis plugin with a deployed
environment
Scenario:
1. Try to remove the plugin using the Fuel CLI
2. Check plugin can't be uninstalled on deployed cluster.
3. Remove the environment.
4. Remove the plugin.
Duration 20m
"""
self.env.revert_snapshot("deploy_ceilometer_redis")
self.check_uninstall_failure()
self.fuel_web.delete_env_wait(self.helpers.cluster_id)
self.uninstall_plugin()

View File

@ -577,3 +577,32 @@ class PluginHelper(object):
def get_fuel_release(self):
version = self.nailgun_client.get_api_version()
return version.get('release')
def check_pacemaker_resource(self, resource_name, role):
"""Check that the pacemaker resource is started on nodes with given
role
:param resource_name: the name of the pacemaker resource
:type resource_name: str
:param role: the role of node when pacemaker is running
:type role: str
:returns: None
"""
cluster_id = self.cluster_id
n_ctrls = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
cluster_id, [role])
d_ctrls = self.fuel_web.get_devops_nodes_by_nailgun_nodes(n_ctrls)
pcm_nodes = ' '.join(self.fuel_web.get_pcm_nodes(
d_ctrls[0].name, pure=True)['Online'])
logger.info("pacemaker nodes are {0}".format(pcm_nodes))
resource_nodes = self.fuel_web.get_pacemaker_resource_location(
d_ctrls[0].name, resource_name)
for resource_node in resource_nodes:
logger.info("Check resource [{0}] on node {1}".format(
resource_name, resource_node.name))
config = self.fuel_web.get_pacemaker_config(resource_node.name)
asserts.assert_not_equal(
re.search(
"Clone Set: clone_{0} \[{0}\]\s+Started: \[ {1} \]".format(
resource_name, pcm_nodes), config), None,
'Resource [{0}] is not properly configured'.format(
resource_name))

View File

@ -41,6 +41,7 @@ class CloseSSHConnectionsPlugin(plugins.Plugin):
def import_tests():
from stacklight_tests.ceilometer_redis import test_smoke_bvt # noqa
from stacklight_tests.elasticsearch_kibana import test_smoke_bvt # noqa
from stacklight_tests.elasticsearch_kibana import test_system # noqa
from stacklight_tests.influxdb_grafana import test_destructive # noqa