From bc86d6801a7d32aad25827dcbf2a0e16f13bf3fc Mon Sep 17 00:00:00 2001 From: vgusev Date: Fri, 17 Jun 2016 13:06:27 +0300 Subject: [PATCH] Add destructive tests for LMA Infrastructure Alerting plugin Change-Id: I987124718cb4d14c5a1701c09f98fe9c9fb9bf1b --- doc/lma_infrastructure_alerting.rst | 6 ++ .../test_destructive.py | 82 +++++++++++++++++++ stacklight_tests/run_tests.py | 2 + 3 files changed, 90 insertions(+) create mode 100644 stacklight_tests/lma_infrastructure_alerting/test_destructive.py diff --git a/doc/lma_infrastructure_alerting.rst b/doc/lma_infrastructure_alerting.rst index 0c3838e..9018a31 100644 --- a/doc/lma_infrastructure_alerting.rst +++ b/doc/lma_infrastructure_alerting.rst @@ -12,3 +12,9 @@ System .. automodule:: stacklight_tests.lma_infrastructure_alerting.test_system :members: + +Destructive +=========== + +.. automodule:: stacklight_tests.lma_infrastructure_alerting.test_destructive + :members: diff --git a/stacklight_tests/lma_infrastructure_alerting/test_destructive.py b/stacklight_tests/lma_infrastructure_alerting/test_destructive.py new file mode 100644 index 0000000..6ac8867 --- /dev/null +++ b/stacklight_tests/lma_infrastructure_alerting/test_destructive.py @@ -0,0 +1,82 @@ +# 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.lma_infrastructure_alerting import api + + +@test(groups=["plugins"]) +class TestDestructiveLMAInfraAlertingPlugin(api.InfraAlertingPluginApi): + """Class for testing plugin failover after network disaster.""" + + @test(depends_on_groups=["deploy_ha_lma_infrastructure_alerting"], + groups=["check_disaster_lma_infrastructure_alerting", + "lma_infrastructure_alerting", "destructive", + "check_cluster_outage_lma_infrastructure_alerting"]) + @log_snapshot_after_test + def check_cluster_outage_lma_infrastructure_alerting(self): + """Verify that the backends and dashboards recover after a network + outage of the whole LMA Infrastructure Alerting cluster. + + Scenario: + 1. Revert the snapshot with 9 deployed nodes in HA configuration + 2. Simulate a network outage of the whole + LMA Infrastructure Alerting cluster + 3. Wait for at least 7 minutes before network recovery + 4. Wait for all services to be back online + 5. Run OSTF + 6. Check that the cluster's state is okay + + Duration 40m + """ + self.env.revert_snapshot("deploy_ha_lma_infrastructure_alerting") + + self.helpers.emulate_whole_network_disaster( + delay_before_recover=7 * 60) + + self.wait_plugin_online() + + self.helpers.run_ostf() + + @test(depends_on_groups=["deploy_lma_infrastructure_alerting"], + groups=["check_disaster_lma_infrastructure_alerting", + "lma_infrastructure_alerting", "destructive", + "check_node_outage_lma_infrastructure_alerting"]) + @log_snapshot_after_test + def check_node_outage_lma_infrastructure_alerting(self): + """Verify that the backends and dashboards recover after + a network outage on a standalone LMA Infrastructure Alerting node. + + Scenario: + 1. Revert the snapshot with 3 deployed nodes + 2. Simulate network interruption on the LMA Infrastructure Alerting + node + 3. Wait for at least 30 seconds before recover network availability + 4. Run OSTF + 5. Check that plugin is working + + Duration 20m + """ + self.env.revert_snapshot("deploy_lma_infrastructure_alerting") + + with self.fuel_web.get_ssh_for_nailgun_node( + self.helpers.get_master_node_by_role(self.settings.role_name) + ) as remote: + self.remote_ops.simulate_network_interrupt_on_node(remote) + + self.wait_plugin_online() + + self.helpers.run_ostf() diff --git a/stacklight_tests/run_tests.py b/stacklight_tests/run_tests.py index 587e8e2..6253095 100644 --- a/stacklight_tests/run_tests.py +++ b/stacklight_tests/run_tests.py @@ -48,6 +48,8 @@ def import_tests(): from stacklight_tests.influxdb_grafana import test_smoke_bvt # noqa from stacklight_tests.influxdb_grafana import test_system # noqa from stacklight_tests.lma_collector import test_smoke_bvt # noqa + from stacklight_tests.lma_infrastructure_alerting import ( # noqa + test_destructive) from stacklight_tests.lma_infrastructure_alerting import ( # noqa test_smoke_bvt) from stacklight_tests.lma_infrastructure_alerting import ( # noqa