Merge "Add smoke test for the Kafka plugin"
This commit is contained in:
commit
6f44fda9e0
66
stacklight_tests/kafka/api.py
Normal file
66
stacklight_tests/kafka/api.py
Normal file
@ -0,0 +1,66 @@
|
||||
# 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 import logger
|
||||
from proboscis import asserts
|
||||
from stacklight_tests import base_test
|
||||
|
||||
|
||||
from stacklight_tests.kafka import plugin_settings
|
||||
|
||||
|
||||
class KafkaPluginApi(base_test.PluginApi):
|
||||
def __init__(self):
|
||||
super(KafkaPluginApi, self).__init__()
|
||||
|
||||
def get_plugin_settings(self):
|
||||
return plugin_settings
|
||||
|
||||
def prepare_plugin(self):
|
||||
self.helpers.prepare_plugin(self.settings.plugin_path)
|
||||
|
||||
def activate_plugin(self, options=None):
|
||||
if options is None:
|
||||
options = self.settings.default_options
|
||||
self.helpers.activate_plugin(
|
||||
self.settings.name, self.settings.version, options)
|
||||
|
||||
def check_plugin_online(self):
|
||||
nodes = []
|
||||
for node in self.helpers.get_all_ready_nodes():
|
||||
if "kafka" in node["roles"]:
|
||||
nodes.append({"name": node["name"], "ip": node["ip"]})
|
||||
|
||||
for port in [
|
||||
{"name": "Zookeeper", "number": 2181},
|
||||
{"name": "Kafka", "number": 9092},
|
||||
{"name": "Kafka(JMX)", "number": 9990}
|
||||
]:
|
||||
for node in nodes:
|
||||
result = self.checkers.check_port(node["ip"], port["number"])
|
||||
logger.info("Check that {} (port {}) on node {} (IP: {}) is up"
|
||||
.format(port['name'], port['number'],
|
||||
node['name'], node['ip']))
|
||||
msg = "Port {} ({}) is {} on node {}".format(port['name'],
|
||||
port['number'],
|
||||
node['name'])
|
||||
asserts.assert_true(result, msg)
|
||||
|
||||
def uninstall_plugin(self):
|
||||
return self.helpers.uninstall_plugin(self.settings.name,
|
||||
self.settings.version)
|
||||
|
||||
def check_uninstall_failure(self):
|
||||
return self.helpers.check_plugin_cannot_be_uninstalled(
|
||||
self.settings.name, self.settings.version)
|
26
stacklight_tests/kafka/plugin_settings.py
Normal file
26
stacklight_tests/kafka/plugin_settings.py
Normal file
@ -0,0 +1,26 @@
|
||||
# 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 stacklight_tests.helpers import helpers
|
||||
from stacklight_tests import settings
|
||||
|
||||
|
||||
name = 'kafka'
|
||||
role_name = 'kafka'
|
||||
plugin_path = settings.KAFKA_PLUGIN_PATH
|
||||
version = helpers.get_plugin_version(plugin_path)
|
||||
|
||||
default_options = {}
|
||||
|
||||
toolchain_options = default_options
|
132
stacklight_tests/kafka/test_smoke_bvt.py
Normal file
132
stacklight_tests/kafka/test_smoke_bvt.py
Normal file
@ -0,0 +1,132 @@
|
||||
# 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.kafka import api
|
||||
|
||||
|
||||
@test(groups=["plugins"])
|
||||
class TestKafkaPlugin(api.KafkaPluginApi):
|
||||
"""Class for smoke testing the Kafka plugin."""
|
||||
|
||||
@test(depends_on_groups=['prepare_slaves_5'],
|
||||
groups=["install_kafka", "install",
|
||||
"kafka", "smoke"])
|
||||
@log_snapshot_after_test
|
||||
def install_kafka(self):
|
||||
"""Install Kafka plugin and check it exists
|
||||
|
||||
Scenario:
|
||||
1. Upload the Kafka plugin to the master node
|
||||
2. Install the plugin
|
||||
3. Create a cluster
|
||||
4. Check that the plugin can be enabled
|
||||
|
||||
Duration 90m
|
||||
"""
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
self.prepare_plugin()
|
||||
|
||||
self.helpers.create_cluster(name=self.__class__.__name__)
|
||||
|
||||
self.activate_plugin()
|
||||
|
||||
@test(depends_on_groups=["prepare_slaves_5"],
|
||||
groups=["deploy_kafka", "deploy",
|
||||
"kafka", "smoke"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_kafka(self):
|
||||
"""Deploy a cluster with the Kafka plugin
|
||||
|
||||
Scenario:
|
||||
1. Upload the Kafka plugin to the master node
|
||||
2. Install the plugin
|
||||
3. Create the cluster
|
||||
4. Add 3 nodes with controller and kafka roles
|
||||
5. Add 1 node with compute and cinder roles
|
||||
7. Deploy the cluster
|
||||
8. Check that Kafka is running
|
||||
9. Run OSTF
|
||||
|
||||
Duration 60m
|
||||
Snapshot deploy_kafka
|
||||
"""
|
||||
self.check_run("deploy_kafka")
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
self.prepare_plugin()
|
||||
|
||||
self.helpers.create_cluster(name=self.__class__.__name__)
|
||||
|
||||
self.activate_plugin()
|
||||
|
||||
self.helpers.deploy_cluster({
|
||||
'slave-01': ['controller', self.settings.role_name],
|
||||
'slave-02': ['controller', self.settings.role_name],
|
||||
'slave-03': ['controller', self.settings.role_name],
|
||||
'slave-04': ['compute', 'cinder'],
|
||||
'slave-05': ['compute', 'cinder']
|
||||
})
|
||||
|
||||
self.check_plugin_online()
|
||||
|
||||
self.helpers.run_ostf()
|
||||
|
||||
self.env.make_snapshot("deploy_kafka", is_make=True)
|
||||
|
||||
@test(depends_on_groups=["prepare_slaves_5"],
|
||||
groups=["uninstall_kafka", "uninstall",
|
||||
"kafka", "smoke"])
|
||||
@log_snapshot_after_test
|
||||
def uninstall_kafka(self):
|
||||
"""Uninstall the kafka plugin
|
||||
|
||||
Scenario:
|
||||
1. Install the plugin.
|
||||
2. Remove the plugin.
|
||||
|
||||
Duration 5m
|
||||
"""
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
self.prepare_plugin()
|
||||
|
||||
self.uninstall_plugin()
|
||||
|
||||
@test(depends_on_groups=[deploy_kafka],
|
||||
groups=["uninstall_deployed_kafka", "uninstall",
|
||||
"kafka", "smoke"])
|
||||
@log_snapshot_after_test
|
||||
def uninstall_deployed_kafka(self):
|
||||
"""Uninstall the Kafka plugin with a deployed
|
||||
environment
|
||||
|
||||
Scenario:
|
||||
1. Try to remove the plugin using the Fuel CLI
|
||||
2. Check plugin can't be uninstalled on deployed cluster.
|
||||
3. Remove the environment.
|
||||
4. Remove the plugin.
|
||||
|
||||
Duration 20m
|
||||
"""
|
||||
self.env.revert_snapshot("deploy_kafka")
|
||||
|
||||
self.check_uninstall_failure()
|
||||
|
||||
self.fuel_web.delete_env_wait(self.helpers.cluster_id)
|
||||
|
||||
self.uninstall_plugin()
|
@ -48,6 +48,7 @@ def import_tests():
|
||||
from stacklight_tests.influxdb_grafana import test_functional # noqa
|
||||
from stacklight_tests.influxdb_grafana import test_smoke_bvt # noqa
|
||||
from stacklight_tests.influxdb_grafana import test_system # noqa
|
||||
from stacklight_tests.kafka import test_smoke_bvt # noqa
|
||||
from stacklight_tests.lma_collector import test_smoke_bvt # noqa
|
||||
from stacklight_tests.lma_infrastructure_alerting import ( # noqa
|
||||
test_destructive)
|
||||
|
@ -7,6 +7,7 @@ LMA_INFRA_ALERTING_PLUGIN_PATH = os.environ.get(
|
||||
ELASTICSEARCH_KIBANA_PLUGIN_PATH = os.environ.get(
|
||||
'ELASTICSEARCH_KIBANA_PLUGIN_PATH')
|
||||
INFLUXDB_GRAFANA_PLUGIN_PATH = os.environ.get('INFLUXDB_GRAFANA_PLUGIN_PATH')
|
||||
KAFKA_PLUGIN_PATH = os.environ.get('KAFKA_PLUGIN_PATH')
|
||||
|
||||
# Ceilometer plugins
|
||||
CEILOMETER_REDIS_PLUGIN_PATH = os.environ.get('CEILOMETER_REDIS_PLUGIN_PATH')
|
||||
|
Loading…
Reference in New Issue
Block a user