From 8229a75535d24c09f9b59da9af64f7a46c4c03de Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 17 May 2016 12:05:36 +0200 Subject: [PATCH] Homogenize InfluxDB/Grafana test cases Change-Id: I5d08349f697d37760a5a25a6af4604fa35f24844 --- .../influxdb_grafana/test_destructive.py | 58 +++++++---------- .../influxdb_grafana/test_smoke_bvt.py | 50 +++++++------- .../influxdb_grafana/test_system.py | 65 +++++++++---------- 3 files changed, 81 insertions(+), 92 deletions(-) diff --git a/stacklight_tests/influxdb_grafana/test_destructive.py b/stacklight_tests/influxdb_grafana/test_destructive.py index 46ac207..7207d37 100644 --- a/stacklight_tests/influxdb_grafana/test_destructive.py +++ b/stacklight_tests/influxdb_grafana/test_destructive.py @@ -16,37 +16,32 @@ from fuelweb_test.helpers.decorators import log_snapshot_after_test from proboscis import test from stacklight_tests.influxdb_grafana import api -from stacklight_tests.influxdb_grafana import test_smoke_bvt @test(groups=["plugins"]) class TestDestructiveInfluxdbPlugin(api.InfluxdbPluginApi): """Class for testing plugin failover after network disaster.""" - @test(depends_on=[ - test_smoke_bvt.TestInfluxdbPlugin.deploy_ha_influxdb_grafana_plugin], - groups=["check_disaster_influxdb_grafana", "influxdb_grafana", - "destructive", "check_failover_network_all_influxdb_grafana"]) + @test(depends_on_groups=["deploy_ha_influxdb_grafana"], + groups=["check_disaster_influxdb_grafana", "influxdb_grafana", + "destructive", "check_cluster_outage_influxdb_grafana"]) @log_snapshot_after_test - def emulate_network_disaster_whole_cluster_influxdb_grafana_plugin(self): + def check_cluster_outage_influxdb_grafana(self): """Verify that the backends and dashboards recover - after a network interruption in the whole cluster. + after a network outage of the whole InfluxDB/Grafana cluster. Scenario: - 1. Revert snapshot with 9 deployed nodes in HA configuration - 2. Simulate network interruption in the whole cluster - 3. Wait for at least 7 minutes before recover network availability - 4. Recover network availability - 5. Wait while all services are started - 6. Run OSTF - 7. Check that plugin is working - 8. Check that data continues to be pushed by the various nodes - once the network interruption has ended + 1. Revert the snapshot with 9 deployed nodes in HA configuration + 2. Simulate a network outage of the whole InfluxDB/Grafana 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 + Snapshot check_cluster_outage_influxdb_grafana """ - - self.env.revert_snapshot("deploy_ha_influxdb_grafana_plugin") + self.env.revert_snapshot("deploy_ha_influxdb_grafana") self.helpers.emulate_whole_network_disaster( delay_before_recover=7 * 60) @@ -55,30 +50,28 @@ class TestDestructiveInfluxdbPlugin(api.InfluxdbPluginApi): self.check_plugin_online() - self.helpers.run_ostf(should_fail=1) + self.helpers.run_ostf() - self.env.make_snapshot( - "emulate_network_disaster_whole_cluster_influxdb_grafana_plugin") + self.env.make_snapshot("check_cluster_outage_influxdb_grafana") - @test(depends_on=[ - test_smoke_bvt.TestInfluxdbPlugin.deploy_influxdb_grafana_plugin], - groups=["check_disaster_influxdb_grafana", "influxdb_grafana", - "destructive", "check_failover_network_node_influxdb_grafana"]) + @test(depends_on_groups=["deploy_influxdb_grafana"], + groups=["check_disaster_influxdb_grafana", "influxdb_grafana", + "destructive", "check_node_outage_influxdb_grafana"]) @log_snapshot_after_test - def emulate_network_disaster_on_influxdb_grafana_plugin_node(self): + def check_node_outage_influxdb_grafana(self): """Verify that the backends and dashboards recover after - a network failure on plugin node. + a network outage on a standalone InfluxDB/Grafana node. Scenario: - 1. Revert snapshot with 3 deployed nodes - 2. Simulate network interruption on plugin node + 1. Revert the snapshot with 3 deployed nodes + 2. Simulate network interruption on the InfluxDB/Grafana node 3. Wait for at least 30 seconds before recover network availability - 4. Recover network availability 5. Run OSTF 6. Check that plugin is working Duration 20m + Snapshot check_node_outage_influxdb_grafana """ - self.env.revert_snapshot("deploy_influxdb_grafana_plugin") + self.env.revert_snapshot("deploy_influxdb_grafana") with self.fuel_web.get_ssh_for_nailgun_node( self.get_influxdb_master_node()) as remote: @@ -90,5 +83,4 @@ class TestDestructiveInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf() - self.env.make_snapshot( - "emulate_network_disaster_on_influxdb_grafana_plugin_node") + self.env.make_snapshot("check_node_outage_influxdb_grafana") diff --git a/stacklight_tests/influxdb_grafana/test_smoke_bvt.py b/stacklight_tests/influxdb_grafana/test_smoke_bvt.py index e7a6c1b..6f63788 100644 --- a/stacklight_tests/influxdb_grafana/test_smoke_bvt.py +++ b/stacklight_tests/influxdb_grafana/test_smoke_bvt.py @@ -13,7 +13,6 @@ # under the License. from fuelweb_test.helpers.decorators import log_snapshot_after_test -from fuelweb_test.tests import base_test_case from proboscis import test from stacklight_tests.influxdb_grafana import api @@ -23,18 +22,18 @@ from stacklight_tests.influxdb_grafana import api class TestInfluxdbPlugin(api.InfluxdbPluginApi): """Class for smoke testing the InfluxDB-Grafana plugin.""" - @test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_3], + @test(depends_on_groups=['prepare_slaves_3'], groups=["install_influxdb_grafana", "install", "influxdb_grafana", "smoke"]) @log_snapshot_after_test - def install_influxdb_grafana_plugin(self): + def install_influxdb_grafana(self): """Install InfluxDB-Grafana plugin and check it exists Scenario: - 1. Upload plugin to the master node - 2. Install plugin - 3. Create cluster - 4. Check that plugin exists + 1. Upload the InfluxDB/Grafana plugin to the master node + 2. Install the plugin + 3. Create a cluster + 4. Check that the plugin can be enabled Duration 20m """ @@ -46,28 +45,28 @@ class TestInfluxdbPlugin(api.InfluxdbPluginApi): self.activate_plugin() - @test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_3], + @test(depends_on_groups=['prepare_slaves_3'], groups=["deploy_influxdb_grafana", "deploy", "influxdb_grafana", "smoke"]) @log_snapshot_after_test - def deploy_influxdb_grafana_plugin(self): + def deploy_influxdb_grafana(self): """Deploy a cluster with the InfluxDB-Grafana plugin Scenario: - 1. Upload plugin to the master node - 2. Install plugin - 3. Create cluster + 1. Upload the InfluxDB/Grafana plugin to the master node + 2. Install the plugin + 3. Create the cluster 4. Add 1 node with controller role 5. Add 1 node with compute and cinder roles 6. Add 1 node with influxdb_grafana role 7. Deploy the cluster - 8. Check that plugin is working + 8. Check that InfluxDB/Grafana are running 9. Run OSTF Duration 60m - Snapshot deploy_influxdb_grafana_plugin + Snapshot deploy_influxdb_grafana """ - self.check_run("deploy_influxdb_grafana_plugin") + self.check_run("deploy_influxdb_grafana") self.env.revert_snapshot("ready_with_3_slaves") self.prepare_plugin() @@ -82,30 +81,30 @@ class TestInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf() - self.env.make_snapshot("deploy_influxdb_grafana_plugin", is_make=True) + self.env.make_snapshot("deploy_influxdb_grafana", is_make=True) - @test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_9], + @test(depends_on_groups=['prepare_slaves_9'], groups=["deploy_ha_influxdb_grafana", "deploy", "deploy_ha" "influxdb_grafana", "smoke"]) @log_snapshot_after_test - def deploy_ha_influxdb_grafana_plugin(self): + def deploy_ha_influxdb_grafana(self): """Deploy a cluster with the InfluxDB-Grafana plugin in HA mode Scenario: - 1. Upload plugin to the master node - 2. Install plugin - 3. Create cluster + 1. Upload the InfluxDB/Grafana plugin to the master node + 2. Install the plugin + 3. Create the cluster 4. Add 3 nodes with controller role 5. Add 3 nodes with compute and cinder roles 6. Add 3 nodes with influxdb_grafana role 7. Deploy the cluster - 8. Check that plugin is working + 8. Check that InfluxDB/Grafana are running 9. Run OSTF Duration 120m - Snapshot deploy_ha_influxdb_grafana_plugin + Snapshot deploy_ha_influxdb_grafana """ - self.check_run("deploy_ha_influxdb_grafana_plugin") + self.check_run("deploy_ha_influxdb_grafana") self.env.revert_snapshot("ready_with_9_slaves") self.prepare_plugin() @@ -120,5 +119,4 @@ class TestInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf() - self.env.make_snapshot("deploy_ha_influxdb_grafana_plugin", - is_make=True) + self.env.make_snapshot("deploy_ha_influxdb_grafana", is_make=True) diff --git a/stacklight_tests/influxdb_grafana/test_system.py b/stacklight_tests/influxdb_grafana/test_system.py index 6851ea6..c226fab 100644 --- a/stacklight_tests/influxdb_grafana/test_system.py +++ b/stacklight_tests/influxdb_grafana/test_system.py @@ -17,20 +17,18 @@ from proboscis import test from fuelweb_test.helpers.decorators import log_snapshot_after_test from stacklight_tests.influxdb_grafana import api -from stacklight_tests.influxdb_grafana import test_smoke_bvt @test(groups=["plugins"]) class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): """Class for system tests for InfluxDB-Grafana plugin.""" - @test(depends_on=[ - test_smoke_bvt.TestInfluxdbPlugin.deploy_ha_influxdb_grafana_plugin], - groups=["check_scaling_influxdb_grafana", "scaling", - "influxdb_grafana", "system", - "check_add_delete_controller_influxdb_grafana"]) + @test(depends_on_groups=["deploy_ha_influxdb_grafana"], + groups=["check_scaling_influxdb_grafana", "scaling", + "influxdb_grafana", "system", + "check_add_delete_controller_influxdb_grafana"]) @log_snapshot_after_test - def add_remove_controller_influxdb_grafana_plugin(self): + def add_remove_controller_influxdb_grafana(self): """Verify that the number of controllers can scale up and down Scenario: @@ -44,8 +42,9 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): 7. Run OSTF Duration 120m + Snapshot add_remove_controller_influxdb_grafana """ - self.env.revert_snapshot("deploy_ha_influxdb_grafana_plugin") + self.env.revert_snapshot("deploy_ha_influxdb_grafana") manipulated_node = {'slave-03': ['controller']} @@ -68,15 +67,14 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf(should_fail=1) - self.env.make_snapshot("add_remove_controller_influxdb_grafana_plugin") + self.env.make_snapshot("add_remove_controller_influxdb_grafana") - @test(depends_on=[ - test_smoke_bvt.TestInfluxdbPlugin.deploy_ha_influxdb_grafana_plugin], - groups=["check_scaling_influxdb_grafana", "scaling", - "influxdb_grafana", "system", - "check_add_delete_compute_influxdb_grafana"]) + @test(depends_on_groups=["deploy_ha_influxdb_grafana"], + groups=["check_scaling_influxdb_grafana", "scaling", + "influxdb_grafana", "system", + "add_remove_compute_influxdb_grafana"]) @log_snapshot_after_test - def add_remove_compute_influxdb_grafana_plugin(self): + def add_remove_compute_influxdb_grafana(self): """Verify that the number of computes can scale up and down Scenario: @@ -90,8 +88,9 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): 7. Run OSTF Duration 120m + Snapshot add_remove_compute_influxdb_grafana """ - self.env.revert_snapshot("deploy_ha_influxdb_grafana_plugin") + self.env.revert_snapshot("deploy_ha_influxdb_grafana") manipulated_node = {'slave-04': ['compute', 'cinder']} @@ -114,15 +113,14 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf(should_fail=1) - self.env.make_snapshot("add_remove_compute_influxdb_grafana_plugin") + self.env.make_snapshot("add_remove_compute_influxdb_grafana") - @test(depends_on=[ - test_smoke_bvt.TestInfluxdbPlugin.deploy_ha_influxdb_grafana_plugin], - groups=["check_scaling_influxdb_grafana", "scaling", - "influxdb_grafana", "system", - "check_add_delete_influxdb_grafana_node"]) + @test(depends_on_groups=["deploy_ha_influxdb_grafana"], + groups=["check_scaling_influxdb_grafana", "scaling", + "influxdb_grafana", "system", + "add_remove_influxdb_grafana_node"]) @log_snapshot_after_test - def add_remove_node_with_influxdb_grafana_plugin(self): + def add_remove_influxdb_grafana_node(self): """Verify that the number of InfluxDB-Grafana nodes can scale up and down @@ -137,8 +135,9 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): 7. Run OSTF Duration 120m + Snapshot add_remove_node_with_influxdb_grafana """ - self.env.revert_snapshot("deploy_ha_influxdb_grafana_plugin") + self.env.revert_snapshot("deploy_ha_influxdb_grafana") self.check_influxdb_nodes_count(3) @@ -164,15 +163,14 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf() - self.env.make_snapshot("add_remove_node_with_influxdb_grafana_plugin") + self.env.make_snapshot("add_remove_influxdb_grafana_node") - @test(depends_on=[ - test_smoke_bvt.TestInfluxdbPlugin.deploy_ha_influxdb_grafana_plugin], - groups=["check_failover_influxdb_grafana" "failover", - "influxdb_grafana", "system", "destructive", - "check_shutdown_influxdb_grafana_node"]) + @test(depends_on_groups=["deploy_ha_influxdb_grafana"], + groups=["check_failover_influxdb_grafana" "failover", + "influxdb_grafana", "system", "destructive", + "shutdown_influxdb_grafana_node"]) @log_snapshot_after_test - def shutdown_node_with_influxdb_grafana_plugin(self): + def shutdown_influxdb_grafana_node(self): """Verify that failover for InfluxDB cluster works. Scenario: @@ -185,8 +183,9 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): 7. Run OSTF Duration 30m + Snaphost shutdown_influxdb_grafana_node """ - self.env.revert_snapshot("deploy_ha_influxdb_grafana_plugin") + self.env.revert_snapshot("deploy_ha_influxdb_grafana") master_node_hostname = self.get_influxdb_master_node()['fqdn'] @@ -200,4 +199,4 @@ class TestNodesInfluxdbPlugin(api.InfluxdbPluginApi): self.helpers.run_ostf() - self.env.make_snapshot("shutdown_node_with_influxdb_grafana_plugin") + self.env.make_snapshot("shutdown_influxdb_grafana_node")