Homogenize Elasticsearch/Kibana test cases

Change-Id: Ib60e4656fb04690162e5cdd7030a1a0a3441b17b
This commit is contained in:
Simon Pasquier 2016-05-17 13:52:27 +02:00
parent 8229a75535
commit 7284097079
2 changed files with 64 additions and 75 deletions

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests import base_test_case
from proboscis import test from proboscis import test
from stacklight_tests.elasticsearch_kibana import api from stacklight_tests.elasticsearch_kibana import api
@ -23,18 +22,18 @@ from stacklight_tests.elasticsearch_kibana import api
class TestElasticsearchPlugin(api.ElasticsearchPluginApi): class TestElasticsearchPlugin(api.ElasticsearchPluginApi):
"""Class for smoke testing the Elasticsearch-Kibana plugin.""" """Class for smoke testing the Elasticsearch-Kibana plugin."""
@test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_3], @test(depends_on_groups=['prepare_slaves_3'],
groups=["install_elasticsearch_kibana", "install", groups=["install_elasticsearch_kibana", "install",
"elasticsearch_kibana", "smoke"]) "elasticsearch_kibana", "smoke"])
@log_snapshot_after_test @log_snapshot_after_test
def install_elasticsearch_kibana_plugin(self): def install_elasticsearch_kibana(self):
"""Install Elasticsearch-Kibana plugin and check it exists """Install Elasticsearch-Kibana plugin and check it exists
Scenario: Scenario:
1. Upload plugin to the master node 1. Upload the Elasticsearch/Kibana plugin to the master node
2. Install plugin 2. Install the plugin
3. Create cluster 3. Create a cluster
4. Check that plugin exists 4. Check that the plugin can be enabled
Duration 20m Duration 20m
""" """
@ -46,28 +45,28 @@ class TestElasticsearchPlugin(api.ElasticsearchPluginApi):
self.activate_plugin() self.activate_plugin()
@test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_3], @test(depends_on_groups=['prepare_slaves_3'],
groups=["deploy_elasticsearch_kibana", "deploy", groups=["deploy_elasticsearch_kibana", "deploy",
"elasticsearch_kibana", "smoke"]) "elasticsearch_kibana", "smoke"])
@log_snapshot_after_test @log_snapshot_after_test
def deploy_elasticsearch_kibana_plugin(self): def deploy_elasticsearch_kibana(self):
"""Deploy a cluster with the Elasticsearch-Kibana plugin """Deploy a cluster with the Elasticsearch-Kibana plugin
Scenario: Scenario:
1. Upload plugin to the master node 1. Upload the Elasticsearch/Kibana plugin to the master node
2. Install plugin 2. Install the plugin
3. Create cluster 3. Create the cluster
4. Add 1 node with controller role 4. Add 1 node with controller role
5. Add 1 node with compute and cinder roles 5. Add 1 node with compute and cinder roles
6. Add 1 node with elasticsearch_kibana role 6. Add 1 node with elasticsearch_kibana role
7. Deploy the cluster 7. Deploy the cluster
8. Check that plugin is working 8. Check that Elasticsearch/Kibana are running
9. Run OSTF 9. Run OSTF
Duration 60m Duration 60m
Snapshot deploy_elasticsearch_kibana_plugin Snapshot deploy_elasticsearch_kibana
""" """
self.check_run("deploy_elasticsearch_kibana_plugin") self.check_run("deploy_elasticsearch_kibana")
self.env.revert_snapshot("ready_with_3_slaves") self.env.revert_snapshot("ready_with_3_slaves")
self.prepare_plugin() self.prepare_plugin()
@ -82,31 +81,30 @@ class TestElasticsearchPlugin(api.ElasticsearchPluginApi):
self.helpers.run_ostf() self.helpers.run_ostf()
self.env.make_snapshot("deploy_elasticsearch_kibana_plugin", self.env.make_snapshot("deploy_elasticsearch_kibana", is_make=True)
is_make=True)
@test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_9], @test(depends_on_groups=['prepare_slaves_9'],
groups=["deploy_ha_elasticsearch_kibana", "deploy", "deploy_ha" groups=["deploy_ha_elasticsearch_kibana", "deploy", "deploy_ha"
"elasticsearch_kibana", "smoke"]) "elasticsearch_kibana", "smoke"])
@log_snapshot_after_test @log_snapshot_after_test
def deploy_ha_elasticsearch_kibana_plugin(self): def deploy_ha_elasticsearch_kibana(self):
"""Deploy a cluster with the Elasticsearch-Kibana plugin in HA mode """Deploy a cluster with the Elasticsearch-Kibana plugin in HA mode
Scenario: Scenario:
1. Upload plugin to the master node 1. Upload the Elasticsearch/Kibana plugin to the master node
2. Install plugin 2. Install the plugin
3. Create cluster 3. Create the cluster
4. Add 3 nodes with controller role 4. Add 3 nodes with controller role
5. Add 3 nodes with compute and cinder roles 5. Add 3 nodes with compute and cinder roles
6. Add 3 nodes with elasticsearch_kibana role 6. Add 3 nodes with elasticsearch_kibana role
7. Deploy the cluster 7. Deploy the cluster
8. Check that plugin is working 8. Check that Elasticsearch/Kibana are running
9. Run OSTF 9. Run OSTF
Duration 120m Duration 120m
Snapshot deploy_ha_elasticsearch_kibana_plugin Snapshot deploy_ha_elasticsearch_kibana
""" """
self.check_run("deploy_ha_elasticsearch_kibana_plugin") self.check_run("deploy_ha_elasticsearch_kibana")
self.env.revert_snapshot("ready_with_9_slaves") self.env.revert_snapshot("ready_with_9_slaves")
self.prepare_plugin() self.prepare_plugin()
@ -121,5 +119,4 @@ class TestElasticsearchPlugin(api.ElasticsearchPluginApi):
self.helpers.run_ostf() self.helpers.run_ostf()
self.env.make_snapshot("deploy_ha_elasticsearch_kibana_plugin", self.env.make_snapshot("deploy_ha_elasticsearch_kibana", is_make=True)
is_make=True)

View File

@ -20,129 +20,122 @@ from stacklight_tests.elasticsearch_kibana import api
@test(groups=["plugins"]) @test(groups=["plugins"])
class TestNodesElasticsearshPlugin(api.ElasticsearchPluginApi): class TestNodesElasticsearchPlugin(api.ElasticsearchPluginApi):
"""Class for system tests for Elasticsearch-Kibana plugin.""" """Class for system tests for Elasticsearch-Kibana plugin."""
@test(depends_on_groups=['deploy_ha_elasticsearch_kibana_plugin'], @test(depends_on_groups=['deploy_ha_elasticsearch_kibana'],
groups=["check_scaling_elasticsearch_kibana", "scaling", groups=["check_scaling_elasticsearch_kibana", "scaling",
"elasticsearch_kibana", "system", "elasticsearch_kibana", "system",
"add_remove_controller_elasticsearch_kibana_plugin"]) "add_remove_controller_elasticsearch_kibana"])
@log_snapshot_after_test @log_snapshot_after_test
def add_remove_controller_elasticsearch_kibana_plugin(self): def add_remove_controller_elasticsearch_kibana(self):
"""Verify that the number of controllers can scale up and down """Verify that the number of controllers can scale up and down
Scenario: Scenario:
1. Revert snapshot with 9 deployed nodes in HA configuration 1. Revert snapshot with 9 deployed nodes in HA configuration
2. Remove one controller node and update the cluster 2. Remove one controller node and redeploy the cluster
3. Check that plugin is working 3. Check that Elasticsearch/Kibana are running
4. Run OSTF 4. Run OSTF
5. Add one controller node (return previous state) and 5. Add one controller node (return previous state) and
update the cluster redeploy the cluster
6. Check that plugin is working 6. Check that Elasticsearch/Kibana are running
7. Run OSTF 7. Run OSTF
Duration 120m Duration 120m
Snapshot add_remove_controller_elasticsearch_kibana
""" """
self.env.revert_snapshot("deploy_ha_elasticsearch_kibana_plugin") self.env.revert_snapshot("deploy_ha_elasticsearch_kibana")
target_node = {'slave-03': ['controller']} target_node = {'slave-03': ['controller']}
# NOTE(vgusev): We set "check_services=False" and # Remove a controller
# "should_fail=1" parameters in deploy_cluster_wait and run_ostf
# methods because after removing one node
# nova has been keeping it in service list
# Remove controller
self.helpers.remove_node_from_cluster(target_node) self.helpers.remove_node_from_cluster(target_node)
self.check_plugin_online() self.check_plugin_online()
# After removing a controller, one OSTF test should fail
self.helpers.run_ostf(should_fail=1) self.helpers.run_ostf(should_fail=1)
# Add controller # Add a controller
self.helpers.add_node_to_cluster(target_node) self.helpers.add_node_to_cluster(target_node)
self.check_plugin_online() self.check_plugin_online()
self.helpers.run_ostf(should_fail=1) self.helpers.run_ostf(should_fail=1)
self.env.make_snapshot( self.env.make_snapshot("add_remove_controller_elasticsearch_kibana")
"add_remove_controller_elasticsearch_kibana_plugin")
@test(depends_on_groups=['deploy_ha_elasticsearch_kibana_plugin'], @test(depends_on_groups=['deploy_ha_elasticsearch_kibana'],
groups=["check_scaling_elasticsearch_kibana", "scaling", groups=["check_scaling_elasticsearch_kibana", "scaling",
"elasticsearch_kibana", "system", "elasticsearch_kibana", "system",
"add_remove_compute_elasticsearch_kibana_plugin"]) "add_remove_compute_elasticsearch_kibana"])
@log_snapshot_after_test @log_snapshot_after_test
def add_remove_compute_elasticsearch_kibana_plugin(self): def add_remove_compute_elasticsearch_kibana(self):
"""Verify that the number of computes can scale up and down """Verify that the number of computes can scale up and down
Scenario: Scenario:
1. Revert snapshot with 9 deployed nodes in HA configuration 1. Revert snapshot with 9 deployed nodes in HA configuration
2. Remove one compute node and update the cluster 2. Remove one compute node and redeploy the cluster
3. Check that plugin is working 3. Check that Elasticsearch/Kibana are running
4. Run OSTF 4. Run OSTF
5. Add one compute node (return previous state) and 5. Add one compute node (return previous state) and
update the cluster redeploy the cluster
6. Check that plugin is working 6. Check that Elasticsearch/Kibana are running
7. Run OSTF 7. Run OSTF
Duration 120m Duration 120m
Snapshot add_remove_compute_elasticsearch_kibana
""" """
self.env.revert_snapshot("deploy_ha_elasticsearch_kibana_plugin") self.env.revert_snapshot("deploy_ha_elasticsearch_kibana")
target_node = {'slave-04': ['compute', 'cinder']} target_node = {'slave-04': ['compute', 'cinder']}
# NOTE(vgusev): We set "check_services=False" and # Remove a compute node
# "should_fail=1" parameters in deploy_cluster_wait and run_ostf
# methods because after removing one node
# nova has been keeping it in service list
# Remove compute
self.helpers.remove_node_from_cluster(target_node) self.helpers.remove_node_from_cluster(target_node)
self.check_plugin_online() self.check_plugin_online()
# After removing a controller, one OSTF test should fail
self.helpers.run_ostf(should_fail=1) self.helpers.run_ostf(should_fail=1)
# Add compute # Add a compute node
self.helpers.add_node_to_cluster(target_node) self.helpers.add_node_to_cluster(target_node)
self.check_plugin_online() self.check_plugin_online()
self.helpers.run_ostf(should_fail=1) self.helpers.run_ostf(should_fail=1)
self.env.make_snapshot( self.env.make_snapshot("add_remove_compute_elasticsearch_kibana")
"add_remove_compute_elasticsearch_kibana_plugin")
@test(depends_on_groups=['deploy_ha_elasticsearch_kibana_plugin'], @test(depends_on_groups=['deploy_ha_elasticsearch_kibana'],
groups=["check_scaling_elasticsearch_kibana", "scaling", groups=["check_scaling_elasticsearch_kibana", "scaling",
"elasticsearch_kibana", "system", "elasticsearch_kibana", "system",
"add_remove_node_with_elasticsearch_kibana_plugin"]) "add_remove_elasticsearch_kibana_node"])
@log_snapshot_after_test @log_snapshot_after_test
def add_remove_node_with_elasticsearch_kibana_plugin(self): def add_remove_elasticsearch_kibana_node(self):
"""Verify that the number of Elasticsearch-Kibana nodes """Verify that the number of Elasticsearch-Kibana nodes
can scale up and down can scale up and down
Scenario: Scenario:
1. Revert snapshot with 9 deployed nodes in HA configuration 1. Revert the snapshot with 9 deployed nodes in HA configuration
2. Remove one Elasticsearch-Kibana node and update the cluster 2. Remove one Elasticsearch-Kibana node and redeploy the cluster
3. Check that plugin is working 3. Check that Elasticsearch/Kibana are running
4. Run OSTF 4. Run OSTF
5. Add one Elasticsearch-Kibana node (return previous state) and 5. Add one Elasticsearch-Kibana node (return previous state) and
update the cluster redeploy the cluster
6. Check that plugin is working 6. Check that Elasticsearch/Kibana are running
7. Run OSTF 7. Run OSTF
Duration 120m Duration 120m
Snapshot add_remove_elasticsearch_kibana_node
""" """
self.env.revert_snapshot("deploy_ha_elasticsearch_kibana_plugin") self.env.revert_snapshot("deploy_ha_elasticsearch_kibana")
self.check_elasticsearch_nodes_count(3) self.check_elasticsearch_nodes_count(3)
target_node = {'slave-07': self.settings.role_name} target_node = {'slave-07': self.settings.role_name}
# Remove Elasticsearch-Kibana node # Remove an Elasticsearch-Kibana node
self.helpers.remove_node_from_cluster(target_node) self.helpers.remove_node_from_cluster(target_node)
self.check_plugin_online() self.check_plugin_online()
@ -151,7 +144,7 @@ class TestNodesElasticsearshPlugin(api.ElasticsearchPluginApi):
self.fuel_web.run_ostf() self.fuel_web.run_ostf()
# Add Elasticsearch-Kibana node # Add an Elasticsearch-Kibana node
self.helpers.add_node_to_cluster(target_node) self.helpers.add_node_to_cluster(target_node)
self.check_plugin_online() self.check_plugin_online()
@ -160,5 +153,4 @@ class TestNodesElasticsearshPlugin(api.ElasticsearchPluginApi):
self.helpers.run_ostf() self.helpers.run_ostf()
self.env.make_snapshot( self.env.make_snapshot("add_remove_elasticsearch_kibana_node")
"add_remove_node_with_elasticsearch_kibana_plugin")