Add scale tests for elasticsearch_kibana
Change-Id: I415877540c56fbf2148bb43f67a6c592d3635a4b
This commit is contained in:
parent
a0611eb83e
commit
e607d16aac
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from fuelweb_test import logger
|
||||
from proboscis import asserts
|
||||
|
||||
from stacklight_tests import base_test
|
||||
from stacklight_tests.elasticsearch_kibana import plugin_settings
|
||||
@ -32,15 +33,29 @@ class ElasticsearchPluginApi(base_test.PluginApi):
|
||||
def get_plugin_vip(self):
|
||||
return self.helpers.get_plugin_vip(self.settings.vip_name)
|
||||
|
||||
def check_plugin_online(self):
|
||||
es_server_ip = self.get_plugin_vip()
|
||||
def get_elasticsearch_url(self, query=''):
|
||||
return "http://{}:9200/{}".format(self.get_plugin_vip(), query)
|
||||
|
||||
def get_kibana_url(self):
|
||||
return "http://{}:9200/".format(self.get_plugin_vip())
|
||||
|
||||
def check_plugin_online(self):
|
||||
logger.debug("Check that Elasticsearch is ready")
|
||||
msg = "Elasticsearch responded with {0}, expected {1}"
|
||||
self.checkers.check_http_get_response(
|
||||
self.settings.elasticsearch_url.format(es_server_ip), msg=msg)
|
||||
self.get_elasticsearch_url(), msg=msg)
|
||||
|
||||
logger.debug("Check that Kibana is running")
|
||||
msg = "Kibana responded with {0}, expected {1}"
|
||||
self.checkers.check_http_get_response(
|
||||
self.settings.kibana_url.format(es_server_ip), msg=msg)
|
||||
self.checkers.check_http_get_response(self.get_kibana_url(), msg=msg)
|
||||
|
||||
def check_elasticsearch_nodes_count(self, expected_count):
|
||||
logger.debug("Get information about Elasticsearch nodes")
|
||||
url = self.get_elasticsearch_url(query='_nodes')
|
||||
response = self.checkers.check_http_get_response(url)
|
||||
nodes_count = len(response.json()['nodes'])
|
||||
|
||||
logger.debug("Check that the number of nodes is equal to the expected")
|
||||
msg = ("Expected count of elasticsearch nodes {}, "
|
||||
"actual count {}".format(expected_count, nodes_count))
|
||||
asserts.assert_equal(expected_count, nodes_count, msg)
|
||||
|
@ -20,6 +20,3 @@ version = '0.9.0'
|
||||
role_name = ['elasticsearch_kibana']
|
||||
vip_name = 'es_vip_mgmt'
|
||||
plugin_path = settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH
|
||||
|
||||
elasticsearch_url = "http://{}:9200/"
|
||||
kibana_url = "http://{}/"
|
||||
|
164
stacklight_tests/elasticsearch_kibana/test_system.py
Normal file
164
stacklight_tests/elasticsearch_kibana/test_system.py
Normal file
@ -0,0 +1,164 @@
|
||||
# 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 proboscis import test
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
|
||||
from stacklight_tests.elasticsearch_kibana import api
|
||||
|
||||
|
||||
@test(groups=["plugins"])
|
||||
class TestNodesElasticsearshPlugin(api.ElasticsearchPluginApi):
|
||||
"""Class for system tests for Elasticsearch-Kibana plugin."""
|
||||
|
||||
@test(depends_on_groups=['deploy_ha_elasticsearch_kibana_plugin'],
|
||||
groups=["check_scaling_elasticsearch_kibana", "scaling",
|
||||
"elasticsearch_kibana", "system",
|
||||
"add_remove_controller_elasticsearch_kibana_plugin"])
|
||||
@log_snapshot_after_test
|
||||
def add_remove_controller_elasticsearch_kibana_plugin(self):
|
||||
"""Verify that the number of controllers can scale up and down
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot with 9 deployed nodes in HA configuration
|
||||
2. Remove one controller node and update the cluster
|
||||
3. Check that plugin is working
|
||||
4. Run OSTF
|
||||
5. Add one controller node (return previous state) and
|
||||
update the cluster
|
||||
6. Check that plugin is working
|
||||
7. Run OSTF
|
||||
|
||||
Duration 120m
|
||||
"""
|
||||
self.env.revert_snapshot("deploy_ha_elasticsearch_kibana_plugin")
|
||||
|
||||
target_node = {'slave-03': ['controller']}
|
||||
|
||||
# NOTE(vgusev): We set "check_services=False" and
|
||||
# "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.check_plugin_online()
|
||||
|
||||
self.helpers.run_ostf(should_fail=1)
|
||||
|
||||
# Add controller
|
||||
self.helpers.add_node_to_cluster(target_node)
|
||||
|
||||
self.check_plugin_online()
|
||||
|
||||
self.helpers.run_ostf(should_fail=1)
|
||||
|
||||
self.env.make_snapshot(
|
||||
"add_remove_controller_elasticsearch_kibana_plugin")
|
||||
|
||||
@test(depends_on_groups=['deploy_ha_elasticsearch_kibana_plugin'],
|
||||
groups=["check_scaling_elasticsearch_kibana", "scaling",
|
||||
"elasticsearch_kibana", "system",
|
||||
"add_remove_compute_elasticsearch_kibana_plugin"])
|
||||
@log_snapshot_after_test
|
||||
def add_remove_compute_elasticsearch_kibana_plugin(self):
|
||||
"""Verify that the number of computes can scale up and down
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot with 9 deployed nodes in HA configuration
|
||||
2. Remove one compute node and update the cluster
|
||||
3. Check that plugin is working
|
||||
4. Run OSTF
|
||||
5. Add one compute node (return previous state) and
|
||||
update the cluster
|
||||
6. Check that plugin is working
|
||||
7. Run OSTF
|
||||
|
||||
Duration 120m
|
||||
"""
|
||||
self.env.revert_snapshot("deploy_ha_elasticsearch_kibana_plugin")
|
||||
|
||||
target_node = {'slave-04': ['compute', 'cinder']}
|
||||
|
||||
# NOTE(vgusev): We set "check_services=False" and
|
||||
# "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.check_plugin_online()
|
||||
|
||||
self.helpers.run_ostf(should_fail=1)
|
||||
|
||||
# Add compute
|
||||
self.helpers.add_node_to_cluster(target_node)
|
||||
|
||||
self.check_plugin_online()
|
||||
|
||||
self.helpers.run_ostf(should_fail=1)
|
||||
|
||||
self.env.make_snapshot(
|
||||
"add_remove_compute_elasticsearch_kibana_plugin")
|
||||
|
||||
@test(depends_on_groups=['deploy_ha_elasticsearch_kibana_plugin'],
|
||||
groups=["check_scaling_elasticsearch_kibana", "scaling",
|
||||
"elasticsearch_kibana", "system",
|
||||
"add_remove_node_with_elasticsearch_kibana_plugin"])
|
||||
@log_snapshot_after_test
|
||||
def add_remove_node_with_elasticsearch_kibana_plugin(self):
|
||||
"""Verify that the number of Elasticsearch-Kibana nodes
|
||||
can scale up and down
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot with 9 deployed nodes in HA configuration
|
||||
2. Remove one Elasticsearch-Kibana node and update the cluster
|
||||
3. Check that plugin is working
|
||||
4. Run OSTF
|
||||
5. Add one Elasticsearch-Kibana node (return previous state) and
|
||||
update the cluster
|
||||
6. Check that plugin is working
|
||||
7. Run OSTF
|
||||
|
||||
Duration 120m
|
||||
"""
|
||||
self.env.revert_snapshot("deploy_ha_elasticsearch_kibana_plugin")
|
||||
|
||||
self.check_elasticsearch_nodes_count(3)
|
||||
|
||||
target_node = {'slave-07': self.settings.role_name}
|
||||
|
||||
# Remove Elasticsearch-Kibana node
|
||||
self.helpers.remove_node_from_cluster(target_node)
|
||||
|
||||
self.check_plugin_online()
|
||||
|
||||
self.check_elasticsearch_nodes_count(2)
|
||||
|
||||
self.fuel_web.run_ostf()
|
||||
|
||||
# Add Elasticsearch-Kibana node
|
||||
self.helpers.add_node_to_cluster(target_node)
|
||||
|
||||
self.check_plugin_online()
|
||||
|
||||
self.check_elasticsearch_nodes_count(3)
|
||||
|
||||
self.helpers.run_ostf()
|
||||
|
||||
self.env.make_snapshot(
|
||||
"add_remove_node_with_elasticsearch_kibana_plugin")
|
Loading…
x
Reference in New Issue
Block a user