Remove all tests related to LMA plugins
These tests are hosted in a dedicated repository Closes-bug: #1587838 Change-Id: I1001ea45edce6b045d87b1776dca7760fc089412
This commit is contained in:
parent
628136142e
commit
08dea43d3e
18
MAINTAINERS
18
MAINTAINERS
|
@ -47,24 +47,6 @@ maintainers:
|
|||
email: akurenyshev@mirantis.com
|
||||
IRC: akurenyshev
|
||||
|
||||
- fuelweb_test/tests/plugins/plugin_elasticsearch: &lma_experts
|
||||
|
||||
- name: Swann Croiset
|
||||
email: scroiset@mirantis.com
|
||||
IRC: swann
|
||||
|
||||
- name: Simon Pasquier
|
||||
email: spasquier@mirantis.com
|
||||
IRC: pasquier-s
|
||||
|
||||
- name: Guillaume Thouvenin
|
||||
email: gthouvenin@mirantis.com
|
||||
IRC: tuvenen
|
||||
|
||||
- fuelweb_test/tests/plugins/plugin_lma_influxdb: *lma_experts
|
||||
- fuelweb_test/tests/plugins/plugin_lma_collector: *lma_experts
|
||||
- fuelweb_test/tests/plugins/plugin_lma_infra_alerting: *lma_experts
|
||||
|
||||
- fuelweb_test/tests/plugins/plugin_zabbix/:
|
||||
|
||||
- name: Swann Croiset
|
||||
|
|
|
@ -511,11 +511,6 @@ Contrail tests
|
|||
.. automodule:: fuelweb_test.tests.plugins.plugin_contrail.test_fuel_plugin_contrail
|
||||
:members:
|
||||
|
||||
Elasticsearch-Kibana tests
|
||||
--------------------------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_elasticsearch.test_plugin_elasticsearch
|
||||
:members:
|
||||
|
||||
Emc tests
|
||||
---------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_emc.test_plugin_emc
|
||||
|
@ -536,26 +531,11 @@ Glusterfs tests
|
|||
.. automodule:: fuelweb_test.tests.plugins.plugin_glusterfs.test_plugin_glusterfs
|
||||
:members:
|
||||
|
||||
InfluxDB-Grafana tests
|
||||
----------------------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_influxdb.test_plugin_influxdb
|
||||
:members:
|
||||
|
||||
Lbaas tests
|
||||
-----------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_lbaas.test_plugin_lbaas
|
||||
:members:
|
||||
|
||||
LMA collector tests
|
||||
-------------------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_lma_collector.test_plugin_lma_collector
|
||||
:members:
|
||||
|
||||
LMA infrastructure alerting tests
|
||||
---------------------------------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_lma_infra_alerting.test_plugin_lma_infra_alerting
|
||||
:members:
|
||||
|
||||
Reboot tests
|
||||
------------
|
||||
.. automodule:: fuelweb_test.tests.plugins.plugin_reboot.test_plugin_reboot_task
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
# Copyright 2015 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.
|
||||
import os
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_is_not_none
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
import requests
|
||||
|
||||
from fuelweb_test.helpers.checkers import check_plugin_path_env
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers import utils
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
from fuelweb_test.settings import ELASTICSEARCH_KIBANA_PLUGIN_PATH
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
@test(groups=["plugins"])
|
||||
class TestElasticsearchPlugin(TestBasic):
|
||||
"""Class for testing the Elasticsearch-Kibana plugin."""
|
||||
|
||||
def __init__(self):
|
||||
super(TestElasticsearchPlugin, self).__init__()
|
||||
check_plugin_path_env(
|
||||
var_name='ELASTICSEARCH_KIBANA_PLUGIN_PATH',
|
||||
plugin_path=ELASTICSEARCH_KIBANA_PLUGIN_PATH
|
||||
)
|
||||
|
||||
_name = 'elasticsearch_kibana'
|
||||
_version = '0.9.0'
|
||||
_role_name = 'elasticsearch_kibana'
|
||||
|
||||
def get_vip(self, cluster_id):
|
||||
networks = self.fuel_web.client.get_networks(cluster_id)
|
||||
return networks.get('vips').get('es_vip_mgmt', {}).get('ipaddr', None)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
|
||||
groups=["deploy_elasticsearch_kibana"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_elasticsearch_kibana_plugin(self):
|
||||
"""Deploy a cluster with the Elasticsearch-Kibana plugin
|
||||
|
||||
Scenario:
|
||||
1. Upload plugin to the master node
|
||||
2. Install plugin
|
||||
3. Create cluster
|
||||
4. Add 1 node with controller role
|
||||
5. Add 1 node with compute role
|
||||
6. Add 1 node with elasticsearch_kibana role
|
||||
7. Deploy the cluster
|
||||
8. Check that plugin is working
|
||||
9. Run OSTF
|
||||
|
||||
Duration 60m
|
||||
Snapshot deploy_elasticsearch_kibana_plugin
|
||||
"""
|
||||
self.env.revert_snapshot("ready_with_3_slaves")
|
||||
|
||||
# copy plugin to the master node
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=ELASTICSEARCH_KIBANA_PLUGIN_PATH,
|
||||
tar_target='/var'
|
||||
)
|
||||
|
||||
# install plugin
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(ELASTICSEARCH_KIBANA_PLUGIN_PATH))
|
||||
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=DEPLOYMENT_MODE,
|
||||
)
|
||||
|
||||
msg = "Plugin couldn't be enabled. Check plugin version. Test aborted"
|
||||
assert_true(
|
||||
self.fuel_web.check_plugin_exists(cluster_id, self._name),
|
||||
msg)
|
||||
|
||||
self.fuel_web.update_plugin_settings(cluster_id, self._name,
|
||||
self._version, {})
|
||||
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-01': ['controller'],
|
||||
'slave-02': ['compute'],
|
||||
'slave-03': [self._role_name]
|
||||
}
|
||||
)
|
||||
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
|
||||
es_server_ip = self.get_vip(cluster_id)
|
||||
assert_is_not_none(es_server_ip,
|
||||
"Failed to get the IP of Elasticsearch server")
|
||||
|
||||
logger.debug("Check that Elasticsearch is ready")
|
||||
|
||||
r = requests.get("http://{}:9200/".format(es_server_ip))
|
||||
msg = "Elasticsearch responded with {}".format(r.status_code)
|
||||
msg += ", expected 200"
|
||||
assert_equal(r.status_code, 200, msg)
|
||||
|
||||
logger.debug("Check that the HTTP server is running")
|
||||
|
||||
r = requests.get("http://{}/".format(es_server_ip))
|
||||
msg = "HTTP server responded with {}".format(r.status_code)
|
||||
msg += ", expected 200"
|
||||
assert_equal(r.status_code, 200, msg)
|
||||
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
|
||||
self.env.make_snapshot("deploy_elasticsearch_kibana_plugin")
|
|
@ -1,130 +0,0 @@
|
|||
# Copyright 2015 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.
|
||||
import os
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_is_not_none
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
import requests
|
||||
|
||||
from fuelweb_test.helpers.checkers import check_plugin_path_env
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers import utils
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
from fuelweb_test.settings import INFLUXDB_GRAFANA_PLUGIN_PATH
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
@test(groups=["plugins"])
|
||||
class TestInfluxdbPlugin(TestBasic):
|
||||
"""Class for testing the InfluxDB-Grafana plugin."""
|
||||
def __init__(self):
|
||||
super(TestInfluxdbPlugin, self).__init__()
|
||||
check_plugin_path_env(
|
||||
var_name='INFLUXDB_GRAFANA_PLUGIN_PATH',
|
||||
plugin_path=INFLUXDB_GRAFANA_PLUGIN_PATH
|
||||
)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
|
||||
groups=["deploy_influxdb_grafana"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_influxdb_grafana_plugin(self):
|
||||
"""Deploy a cluster with the InfluxDB-Grafana plugin
|
||||
|
||||
Scenario:
|
||||
1. Upload plugin to the master node
|
||||
2. Install plugin
|
||||
3. Create cluster
|
||||
4. Add 1 node with controller role
|
||||
5. Add 1 node with compute role
|
||||
6. Add 1 node with influxdb_grafana role
|
||||
7. Deploy the cluster
|
||||
8. Check that plugin is working
|
||||
9. Run OSTF
|
||||
|
||||
Duration 60m
|
||||
Snapshot deploy_influxdb_grafana_plugin
|
||||
"""
|
||||
self.env.revert_snapshot("ready_with_3_slaves")
|
||||
|
||||
# copy plugin to the master node and install it
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=INFLUXDB_GRAFANA_PLUGIN_PATH,
|
||||
tar_target='/var')
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(INFLUXDB_GRAFANA_PLUGIN_PATH))
|
||||
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=DEPLOYMENT_MODE,
|
||||
)
|
||||
|
||||
plugin_name = 'influxdb_grafana'
|
||||
options = {
|
||||
'metadata/enabled': True,
|
||||
'node_name/value': 'slave-03_influxdb_grafana',
|
||||
'influxdb_rootpass/value': 'lmapass',
|
||||
'influxdb_userpass/value': 'lmapass',
|
||||
'grafana_userpass/value': 'lmapass',
|
||||
}
|
||||
|
||||
assert_true(
|
||||
self.fuel_web.check_plugin_exists(cluster_id, plugin_name),
|
||||
"Plugin couldn't be enabled. Check plugin version. Test aborted")
|
||||
|
||||
self.fuel_web.update_plugin_data(cluster_id, plugin_name, options)
|
||||
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-01': ['controller'],
|
||||
'slave-02': ['compute'],
|
||||
'slave-03': ['influxdb_grafana']
|
||||
}
|
||||
)
|
||||
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
|
||||
influxdb_server = self.fuel_web.get_nailgun_node_by_name('slave-03')
|
||||
influxdb_server_ip = influxdb_server.get('ip')
|
||||
assert_is_not_none(influxdb_server_ip,
|
||||
"Failed to get the IP of InfluxDB server")
|
||||
|
||||
logger.debug("Check that InfluxDB is ready")
|
||||
|
||||
influxdb_url = "http://{0}:8086/query?db=lma&u={1}&p={2}&" + \
|
||||
"q=show+measurements"
|
||||
r = requests.get(influxdb_url.format(
|
||||
influxdb_server_ip, 'lma', options['influxdb_userpass/value']))
|
||||
msg = "InfluxDB responded with {}, expected 200".format(r.status_code)
|
||||
assert_equal(r.status_code, 200, msg)
|
||||
|
||||
logger.debug("Check that the Grafana server is running")
|
||||
|
||||
r = requests.get(
|
||||
"http://{0}:{1}@{2}:8000/api/org".format(
|
||||
'grafana', options['grafana_userpass/value'],
|
||||
influxdb_server_ip))
|
||||
msg = "Grafana server responded with {}, expected 200".format(
|
||||
r.status_code)
|
||||
assert_equal(r.status_code, 200, msg)
|
||||
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
|
||||
self.env.make_snapshot("deploy_influxdb_grafana_plugin")
|
|
@ -1,269 +0,0 @@
|
|||
# Copyright 2015 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.
|
||||
import os
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_is_not_none
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
import requests
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.helpers.checkers import check_plugin_path_env
|
||||
from fuelweb_test.helpers import utils
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
@test(groups=["plugins"])
|
||||
class TestLmaCollectorPlugin(TestBasic):
|
||||
"""Class for testing the LMA toolchain."""
|
||||
def __init__(self):
|
||||
super(TestLmaCollectorPlugin, self).__init__()
|
||||
check_plugin_path_env(
|
||||
var_name='LMA_COLLECTOR_PLUGIN_PATH',
|
||||
plugin_path=settings.LMA_COLLECTOR_PLUGIN_PATH
|
||||
)
|
||||
check_plugin_path_env(
|
||||
var_name='ELASTICSEARCH_KIBANA_PLUGIN_PATH',
|
||||
plugin_path=settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH
|
||||
)
|
||||
check_plugin_path_env(
|
||||
var_name='INFLUXDB_GRAFANA_PLUGIN_PATH',
|
||||
plugin_path=settings.INFLUXDB_GRAFANA_PLUGIN_PATH
|
||||
)
|
||||
check_plugin_path_env(
|
||||
var_name='LMA_INFRA_ALERTING_PLUGIN_PATH',
|
||||
plugin_path=settings.LMA_INFRA_ALERTING_PLUGIN_PATH
|
||||
)
|
||||
|
||||
def get_vip(self, cluster_id, name):
|
||||
networks = self.fuel_web.client.get_networks(cluster_id)
|
||||
return networks.get('vips').get(name, {}).get('ipaddr', None)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["deploy_lma_toolchain"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_lma_toolchain(self):
|
||||
"""Deploy cluster in HA mode with the LMA toolchain
|
||||
|
||||
This also deploys the Elasticsearch-Kibana plugin and the
|
||||
InfluxDB-Grafana plugin since they work together with the LMA collector
|
||||
plugin.
|
||||
|
||||
Scenario:
|
||||
1. Upload plugins to the master node
|
||||
2. Install plugins
|
||||
3. Create cluster
|
||||
4. Add 3 nodes with controller role
|
||||
5. Add 1 node with compute + cinder role
|
||||
6. Add 1 node with influxdb_grafana + elasticsearch_kibana +
|
||||
infrastructure_alerting roles
|
||||
7. Deploy the cluster
|
||||
8. Check that the plugins work
|
||||
9. Run OSTF
|
||||
|
||||
Duration 150m
|
||||
Snapshot deploy_lma_toolchain
|
||||
|
||||
"""
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
# TODO(scroiset): use actions fuel_actions.py
|
||||
# upload_plugin and install_plugin
|
||||
# copy plugins to the master node
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=settings.LMA_COLLECTOR_PLUGIN_PATH,
|
||||
tar_target="/var")
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH,
|
||||
tar_target="/var")
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=settings.INFLUXDB_GRAFANA_PLUGIN_PATH,
|
||||
tar_target="/var")
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=settings.LMA_INFRA_ALERTING_PLUGIN_PATH,
|
||||
tar_target="/var")
|
||||
|
||||
# install plugins
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(settings.LMA_COLLECTOR_PLUGIN_PATH))
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH))
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(settings.INFLUXDB_GRAFANA_PLUGIN_PATH))
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(settings.LMA_INFRA_ALERTING_PLUGIN_PATH))
|
||||
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=settings.DEPLOYMENT_MODE,
|
||||
)
|
||||
|
||||
influxdb_user = "influxdb"
|
||||
influxdb_pass = "influxdbpass"
|
||||
influxdb_rootpass = "r00tme"
|
||||
grafana_user = "grafana"
|
||||
grafana_pass = "grafanapass"
|
||||
mysql_dbname = "grafanalma"
|
||||
mysql_user = "grafanalma"
|
||||
mysql_pass = "mysqlpass"
|
||||
nagios_pass = "nagiospass"
|
||||
plugins = [
|
||||
{
|
||||
'name': 'lma_collector',
|
||||
'version': '0.9.0',
|
||||
'options': {
|
||||
'environment_label/value': 'deploy_lma_toolchain',
|
||||
'elasticsearch_mode/value': 'local',
|
||||
'influxdb_mode/value': 'local',
|
||||
'alerting_mode/value': 'local',
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'elasticsearch_kibana',
|
||||
'version': '0.9.0',
|
||||
'options': {
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'lma_infrastructure_alerting',
|
||||
'version': '0.9.0',
|
||||
'options': {
|
||||
'send_to/value': 'root@localhost',
|
||||
'send_from/value': 'nagios@localhost',
|
||||
'smtp_host/value': '127.0.0.1',
|
||||
'nagios_password/value': nagios_pass,
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'influxdb_grafana',
|
||||
'version': '0.9.0',
|
||||
'options': {
|
||||
'influxdb_rootpass/value': influxdb_rootpass,
|
||||
'influxdb_username/value': influxdb_user,
|
||||
'influxdb_userpass/value': influxdb_pass,
|
||||
'grafana_username/value': grafana_user,
|
||||
'grafana_userpass/value': grafana_pass,
|
||||
'mysql_mode/value': 'local',
|
||||
'mysql_dbname/value': mysql_dbname,
|
||||
'mysql_username/value': mysql_user,
|
||||
'mysql_password/value': mysql_pass,
|
||||
}
|
||||
},
|
||||
]
|
||||
for plugin in plugins:
|
||||
plugin_name = plugin['name']
|
||||
plugin_version = plugin['version']
|
||||
msg = "Plugin '{:s}' couldn't be found. " \
|
||||
"Test aborted".format(plugin_name)
|
||||
assert_true(
|
||||
self.fuel_web.check_plugin_exists(cluster_id, plugin_name),
|
||||
msg)
|
||||
logger.debug('{:s} plugin is installed'.format(plugin_name))
|
||||
self.fuel_web.update_plugin_settings(
|
||||
cluster_id, plugin_name,
|
||||
plugin_version, plugin['options'])
|
||||
|
||||
analytics_roles = ["influxdb_grafana",
|
||||
"elasticsearch_kibana",
|
||||
"infrastructure_alerting"]
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
"slave-01": ["controller"],
|
||||
"slave-02": ["controller"],
|
||||
"slave-03": ["controller"],
|
||||
"slave-04": ["compute", "cinder"],
|
||||
"slave-05": analytics_roles,
|
||||
}
|
||||
)
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id, timeout=9000)
|
||||
|
||||
analytics_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
||||
cluster_id, analytics_roles
|
||||
)
|
||||
msg = "One node with '{}' roles must be present, found {}".format(
|
||||
' + '.join(analytics_roles), len(analytics_nodes))
|
||||
|
||||
assert_true(len(analytics_nodes) == 1, msg)
|
||||
|
||||
elasticsearch_kibana_vip = self.get_vip(cluster_id, 'es_vip_mgmt')
|
||||
influxdb_grafana_vip = self.get_vip(cluster_id, 'influxdb')
|
||||
nagios_vip = self.get_vip(cluster_id, 'infrastructure_alerting')
|
||||
assert_is_not_none(
|
||||
elasticsearch_kibana_vip,
|
||||
"Fail to retrieve the Elasticsearch/Kibana cluster VIP address"
|
||||
)
|
||||
assert_is_not_none(
|
||||
influxdb_grafana_vip,
|
||||
"Fail to retrieve the InfluxDB/Grafana cluster VIP address"
|
||||
)
|
||||
assert_is_not_none(
|
||||
nagios_vip,
|
||||
"Fail to retrieve the Infrastructure Alerting cluster VIP address"
|
||||
)
|
||||
|
||||
def assert_http_get_response(url, expected=200):
|
||||
r = requests.get(url)
|
||||
assert_equal(r.status_code, expected,
|
||||
"{} responded with {}, expected {}".format(
|
||||
url, r.status_code, expected))
|
||||
|
||||
logger.debug("Check that Elasticsearch is ready")
|
||||
assert_http_get_response("http://{0}:9200/".format(
|
||||
elasticsearch_kibana_vip))
|
||||
|
||||
logger.debug("Check that Kibana is ready")
|
||||
assert_http_get_response("http://{0}/".format(
|
||||
elasticsearch_kibana_vip))
|
||||
|
||||
logger.debug("Check that the root user can access InfluxDB")
|
||||
influxdb_url = "http://{0}:8086/query?db=lma&u={1}&p={2}&" + \
|
||||
"q=show+measurements"
|
||||
assert_http_get_response(influxdb_url.format(influxdb_grafana_vip,
|
||||
'root',
|
||||
influxdb_rootpass))
|
||||
logger.debug("Check that the LMA user can access InfluxDB")
|
||||
assert_http_get_response(influxdb_url.format(influxdb_grafana_vip,
|
||||
influxdb_user,
|
||||
influxdb_pass))
|
||||
|
||||
logger.debug("Check that the LMA user can access Grafana")
|
||||
assert_http_get_response(
|
||||
"http://{0}:{1}@{2}:8000/api/org".format(grafana_user,
|
||||
grafana_pass,
|
||||
influxdb_grafana_vip))
|
||||
|
||||
nagios_url = "http://{}:{}".format(nagios_vip, '8001')
|
||||
r = requests.get(nagios_url, auth=('nagiosadmin',
|
||||
nagios_pass))
|
||||
assert_equal(
|
||||
r.status_code, 200,
|
||||
"Nagios HTTP response code {}, expected {}".format(
|
||||
r.status_code, 200)
|
||||
)
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
|
||||
self.env.make_snapshot("deploy_lma_toolchain")
|
|
@ -1,153 +0,0 @@
|
|||
# Copyright 2015 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.
|
||||
import os
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_is_not_none
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
import requests
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test.helpers.checkers import check_plugin_path_env
|
||||
from fuelweb_test.helpers import utils
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
@test(groups=["plugins", "lma_plugins"])
|
||||
class TestLmaInfraAlertingPlugin(TestBasic):
|
||||
"""Class for testing the LMA infrastructure plugin plugin."""
|
||||
|
||||
def __init__(self):
|
||||
super(TestLmaInfraAlertingPlugin, self).__init__()
|
||||
check_plugin_path_env(
|
||||
var_name='LMA_INFRA_ALERTING_PLUGIN_PATH',
|
||||
plugin_path=settings.LMA_INFRA_ALERTING_PLUGIN_PATH
|
||||
)
|
||||
|
||||
_name = 'lma_infrastructure_alerting'
|
||||
_version = '0.9.0'
|
||||
_role_name = 'infrastructure_alerting'
|
||||
_nagios_password = 'foopass'
|
||||
|
||||
def get_nagios_vip(self, cluster_id):
|
||||
networks = self.fuel_web.client.get_networks(cluster_id)
|
||||
return networks.get('vips').get(
|
||||
'infrastructure_alerting', {}).get('ipaddr', None)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["deploy_lma_infra_alerting_ha"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_lma_infra_alerting_ha(self):
|
||||
"""Deploy cluster in HA with the LMA infrastructure alerting plugin
|
||||
|
||||
Scenario:
|
||||
1. Upload plugin to the master node
|
||||
2. Install plugins
|
||||
3. Create cluster
|
||||
4. Add 3 nodes with controller role
|
||||
5. Add 1 node with compute + cinder roles
|
||||
6. Add 1 node with infrastructure_alerting
|
||||
7. Deploy the cluster
|
||||
8. Check that the plugins work
|
||||
9. Run OSTF
|
||||
|
||||
Duration 70m
|
||||
Snapshot deploy_lma_infra_alerting_ha
|
||||
|
||||
"""
|
||||
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
|
||||
cluster_id = self._bootstrap()
|
||||
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
"slave-01": ["controller"],
|
||||
"slave-02": ["controller"],
|
||||
"slave-03": ["controller"],
|
||||
"slave-04": ["compute", "cinder"],
|
||||
"slave-05": [self._role_name]
|
||||
}
|
||||
)
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
self._check_nagios(cluster_id)
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
self.env.make_snapshot("deploy_lma_infra_alerting_ha")
|
||||
|
||||
def _bootstrap(self):
|
||||
|
||||
# copy plugin to the master node
|
||||
utils.upload_tarball(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
tar_path=settings.LMA_INFRA_ALERTING_PLUGIN_PATH,
|
||||
tar_target="/var")
|
||||
|
||||
# install plugin
|
||||
utils.install_plugin_check_code(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
plugin=os.path.basename(settings.LMA_INFRA_ALERTING_PLUGIN_PATH))
|
||||
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=settings.DEPLOYMENT_MODE,
|
||||
)
|
||||
|
||||
plugin_options = {
|
||||
'send_to/value': 'root@localhost',
|
||||
'send_from/value': 'nagios@localhost',
|
||||
'smtp_host/value': '127.0.0.1',
|
||||
'nagios_password/value': self._nagios_password,
|
||||
}
|
||||
|
||||
msg = "Plugin couldn't be enabled. Check plugin version. Test aborted"
|
||||
assert_true(self.fuel_web.check_plugin_exists(cluster_id, self._name),
|
||||
msg)
|
||||
logger.debug(
|
||||
'{name:s} ({ver!s}) plugin is installed'
|
||||
''.format(name=self._name, ver=self._version))
|
||||
self.fuel_web.update_plugin_settings(cluster_id,
|
||||
self._name,
|
||||
self._version,
|
||||
plugin_options)
|
||||
|
||||
return cluster_id
|
||||
|
||||
def _check_nagios(self, cluster_id):
|
||||
nagios_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
||||
cluster_id, [self._role_name])
|
||||
|
||||
assert_true(
|
||||
len(nagios_nodes) == 1,
|
||||
"One node with '{}' role must be present, found {}".format(
|
||||
self._role_name, len(nagios_nodes)))
|
||||
|
||||
nagios_node_ip = self.get_nagios_vip(cluster_id)
|
||||
assert_is_not_none(
|
||||
nagios_node_ip,
|
||||
"Fail to retrieve the IP address for node with role {}".format(
|
||||
self._role_name))
|
||||
|
||||
nagios_url = "http://{}:{}".format(nagios_node_ip, '8001')
|
||||
r = requests.get(nagios_url, auth=('nagiosadmin',
|
||||
self._nagios_password))
|
||||
assert_equal(
|
||||
r.status_code, 200,
|
||||
"Nagios HTTP response code {}, expected {}".format(
|
||||
r.status_code, 200)
|
||||
)
|
Loading…
Reference in New Issue