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