Add zabbix destructive test.
Add test_host_failover test. Add related zabbix API methods. Change-Id: I20d8c032b321ec3818f98c577d29b5025771d9a4
This commit is contained in:
parent
d9aadcbffe
commit
16b0bafa2f
@ -70,6 +70,7 @@ def import_tests():
|
||||
from stacklight_tests.toolchain import test_reduced_footprint # noqa
|
||||
from stacklight_tests.toolchain import test_smoke_bvt # noqa
|
||||
from stacklight_tests.toolchain import test_system # noqa
|
||||
from stacklight_tests.zabbix import test_destructive # noqa
|
||||
from stacklight_tests.zabbix import test_functional # noqa
|
||||
from stacklight_tests.zabbix import test_smoke_bvt # noqa
|
||||
from stacklight_tests.zabbix import test_system # noqa
|
||||
|
@ -114,9 +114,12 @@ class ZabbixApi(base_test.PluginApi):
|
||||
self.helpers.cluster_id)['vips']['zbx_vip_mgmt']['ipaddr']
|
||||
|
||||
def check_plugin_online(self):
|
||||
controller = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
||||
self.helpers.cluster_id, ['controller'])[0]
|
||||
with self.fuel_web.get_ssh_for_nailgun_node(controller) as remote:
|
||||
controllers = [
|
||||
controller for controller in
|
||||
self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
||||
self.helpers.cluster_id, ['controller'])
|
||||
if controller["online"]]
|
||||
with self.fuel_web.get_ssh_for_nailgun_node(controllers[0]) as remote:
|
||||
remote.check_call("dpkg --get-selections | grep zabbix")
|
||||
response = remote.execute("crm resource status "
|
||||
"p_zabbix-server")["stdout"][0]
|
||||
@ -164,7 +167,7 @@ class ZabbixApi(base_test.PluginApi):
|
||||
result = remote.check_call(
|
||||
"crm status | grep {} | awk '{{print $4}}'".format(
|
||||
self.helpers.get_vip_resource_name(
|
||||
self.settings.zabbix_vip)))
|
||||
self.settings.failover_vip)))
|
||||
return result['stdout'][0].rstrip()
|
||||
|
||||
def get_triggers(self, params=None):
|
||||
|
@ -18,7 +18,9 @@ from stacklight_tests import settings
|
||||
name = 'zabbix_monitoring'
|
||||
plugin_path = settings.ZABBIX_MONITORING_PLUGIN_PATH
|
||||
version = helpers.get_plugin_version(plugin_path)
|
||||
zabbix_vip = 'zbx_vip_mgmt'
|
||||
failover_vip = 'zbx_vip_mgmt'
|
||||
# NOTE(vgusev): This parameter is required for destructive scenario
|
||||
role_name = ["controller"]
|
||||
dependant_plugins = {
|
||||
'ZABBIX_MONITORING_EMC': {
|
||||
'name': 'zabbix_monitoring_emc',
|
||||
|
45
stacklight_tests/zabbix/test_destructive.py
Normal file
45
stacklight_tests/zabbix/test_destructive.py
Normal file
@ -0,0 +1,45 @@
|
||||
# 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 proboscis import test
|
||||
|
||||
from stacklight_tests.zabbix import api
|
||||
|
||||
|
||||
@test(groups=["plugins"])
|
||||
class TestDestructiveZabbix(api.ZabbixApi):
|
||||
"""Class for destructive testing of Zabbix plugin."""
|
||||
|
||||
@test(depends_on_groups=["deploy_zabbix_monitoring_ha"],
|
||||
groups=["test_host_failover", "zabbix", "destructive"])
|
||||
@log_snapshot_after_test
|
||||
def test_host_failover(self):
|
||||
"""Verify that zabbix-server will be started on another
|
||||
node in case of network failover.
|
||||
|
||||
Scenario:
|
||||
1. Find node with active zabbix-server via crm status
|
||||
2. Shutdown the node.
|
||||
3. Check that zabbix is active on other node via crm status.
|
||||
4. Check response from zabbix via HTTP request
|
||||
|
||||
Duration 15m
|
||||
"""
|
||||
|
||||
self.env.revert_snapshot("deploy_zabbix_monitoring_ha")
|
||||
|
||||
self.check_plugin_failover()
|
||||
|
||||
self.check_plugin_online()
|
Loading…
x
Reference in New Issue
Block a user