Merge "Fix the number of collector services for 0.10"
This commit is contained in:
@@ -38,8 +38,8 @@ def check_http_get_response(url, expected_code=200, msg=None, **kwargs):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def verify_services(remote, service_name, count):
|
def check_process_count(remote, process, count):
|
||||||
"""Check that a process is running on a host.
|
"""Check that the expected number of processes is running on a host.
|
||||||
|
|
||||||
:param remote: SSH connection to the node.
|
:param remote: SSH connection to the node.
|
||||||
:type remote: SSHClient
|
:type remote: SSHClient
|
||||||
@@ -50,8 +50,9 @@ def verify_services(remote, service_name, count):
|
|||||||
:returns: list of PIDs.
|
:returns: list of PIDs.
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
msg = "{0} count not equal to {1}, received instead {2}."
|
msg = "Got {got} instances instead of {count} for process {process}."
|
||||||
pids = remote_ops.get_pids_of_process(remote, service_name)
|
pids = remote_ops.get_pids_of_process(remote, process)
|
||||||
asserts.assert_equal(
|
asserts.assert_equal(
|
||||||
len(pids), count, msg.format(service_name, count, len(pids)))
|
len(pids), count,
|
||||||
|
msg.format(process=process, count=count, got=len(pids)))
|
||||||
return pids
|
return pids
|
||||||
|
@@ -336,20 +336,6 @@ class PluginHelper(object):
|
|||||||
for cmd in cmds:
|
for cmd in cmds:
|
||||||
remote.check_call(cmd)
|
remote.check_call(cmd)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_services_for_version(services_mapping, version):
|
|
||||||
"""Returns processes for needed version only.
|
|
||||||
|
|
||||||
:param services_mapping: full services mapping.
|
|
||||||
:type services_mapping: dict
|
|
||||||
:param version: plugin's version.
|
|
||||||
:type version: str
|
|
||||||
"""
|
|
||||||
def get_major_version():
|
|
||||||
return ".".join(version.split(".")[:2])
|
|
||||||
major_version = get_major_version()
|
|
||||||
return services_mapping[major_version]
|
|
||||||
|
|
||||||
def fuel_create_repositories(self, nodes):
|
def fuel_create_repositories(self, nodes):
|
||||||
"""Start task to setup repositories on provided nodes
|
"""Start task to setup repositories on provided nodes
|
||||||
|
|
||||||
|
@@ -34,27 +34,33 @@ class LMACollectorPluginApi(base_test.PluginApi):
|
|||||||
def get_plugin_vip(self):
|
def get_plugin_vip(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_services_to_check(self):
|
|
||||||
services_to_check = self.helpers.get_services_for_version(
|
|
||||||
self.settings.services_to_check,
|
|
||||||
self.settings.version)
|
|
||||||
return services_to_check
|
|
||||||
|
|
||||||
def verify_services(self):
|
def verify_services(self):
|
||||||
"""Check that LMA services started in the right quantity."""
|
"""Check that the correct amount of collector processes are running.
|
||||||
nodes = self.helpers.get_all_ready_nodes()
|
|
||||||
|
:returns: list of process IDs indexed by node and process
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
pids = {}
|
pids = {}
|
||||||
services_to_check = self.get_services_to_check()
|
processes_count = {
|
||||||
for node in nodes:
|
"collectd": 1,
|
||||||
logger.info("Check {services} services on the {name} node".format(
|
"collectdmon": 1
|
||||||
name=node['name'],
|
}
|
||||||
services=', '.join(services_to_check.keys()),))
|
if self.settings.version == "0.9":
|
||||||
services_pids = {}
|
processes_count["hekad"] = 1
|
||||||
with self.env.d_env.get_ssh_to_remote(node['ip']) as remote:
|
else:
|
||||||
for service, count in services_to_check.items():
|
# Starting with 0.10, there are one collector for logs and one for
|
||||||
services_pids[service] = (
|
# metrics
|
||||||
self.checkers.verify_services(remote, service, count))
|
processes_count["hekad"] = 2
|
||||||
pids[node['name']] = services_pids
|
for node in self.helpers.get_all_ready_nodes():
|
||||||
|
pids[node["name"]] = {}
|
||||||
|
with self.env.d_env.get_ssh_to_remote(node["ip"]) as remote:
|
||||||
|
for process, count in processes_count.items():
|
||||||
|
logger.info("Checking process {0} on node {1}".format(
|
||||||
|
process, node["name"]
|
||||||
|
))
|
||||||
|
pids[node["name"]][process] = (
|
||||||
|
self.checkers.check_process_count(
|
||||||
|
remote, process, count))
|
||||||
return pids
|
return pids
|
||||||
|
|
||||||
def check_plugin_online(self):
|
def check_plugin_online(self):
|
||||||
|
@@ -16,32 +16,24 @@ from stacklight_tests.helpers import helpers
|
|||||||
from stacklight_tests import settings
|
from stacklight_tests import settings
|
||||||
|
|
||||||
|
|
||||||
name = 'lma_collector'
|
name = "lma_collector"
|
||||||
role_name = [] # NOTE(rpromyshlennikov): there is no role name
|
role_name = [] # NOTE(rpromyshlennikov): there is no role name
|
||||||
# because lma collector is installed on all nodes in cluster
|
# because lma collector is installed on all nodes in cluster
|
||||||
plugin_path = settings.LMA_COLLECTOR_PLUGIN_PATH
|
plugin_path = settings.LMA_COLLECTOR_PLUGIN_PATH
|
||||||
version = helpers.get_plugin_version(plugin_path)
|
version = helpers.get_plugin_version(plugin_path)
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
'environment_label/value': 'deploy_lma_toolchain',
|
"environment_label/value": "deploy_lma_toolchain",
|
||||||
'elasticsearch_mode/value': 'remote',
|
"elasticsearch_mode/value": "remote",
|
||||||
'influxdb_mode/value': 'remote',
|
"influxdb_mode/value": "remote",
|
||||||
'alerting_mode/value': 'local',
|
"alerting_mode/value": "local",
|
||||||
'elasticsearch_address/value': '127.0.0.1',
|
"elasticsearch_address/value": "127.0.0.1",
|
||||||
'influxdb_address/value': '127.0.0.1'
|
"influxdb_address/value": "127.0.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_options = {
|
toolchain_options = {
|
||||||
'environment_label/value': 'deploy_lma_toolchain',
|
"environment_label/value": "deploy_lma_toolchain",
|
||||||
'elasticsearch_mode/value': 'local',
|
"elasticsearch_mode/value": "local",
|
||||||
'influxdb_mode/value': 'local',
|
"influxdb_mode/value": "local",
|
||||||
'alerting_mode/value': 'local'
|
"alerting_mode/value": "local"
|
||||||
}
|
|
||||||
|
|
||||||
services_to_check = {
|
|
||||||
"0.9": {
|
|
||||||
"hekad": 1,
|
|
||||||
"collectd": 1,
|
|
||||||
"collectdmon": 1
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@@ -213,7 +213,7 @@ class TestNodesToolchain(api.ToolchainApi):
|
|||||||
|
|
||||||
pids_before = self.get_pids_of_services()
|
pids_before = self.get_pids_of_services()
|
||||||
|
|
||||||
# NOTE(rpromyshlennikov): fuel-createmirror cmd is depricated
|
# NOTE(rpromyshlennikov): fuel-createmirror cmd is deprecated
|
||||||
# since fuel-8.0 release
|
# since fuel-8.0 release
|
||||||
self.helpers.replace_ubuntu_mirror_with_mos()
|
self.helpers.replace_ubuntu_mirror_with_mos()
|
||||||
self.helpers.fuel_create_repositories(ready_nodes_before)
|
self.helpers.fuel_create_repositories(ready_nodes_before)
|
||||||
|
Reference in New Issue
Block a user