Skip to content
Snippets Groups Projects
Commit 55df381e authored by MJB's avatar MJB
Browse files

fixed merge conflicts causing rspec check failure in telegraf-agents test

parent 2d27ecda
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ import pytest
'nginx',
'mongo',
'ffmpeg',
'ipendpoint'
'host'
])
def test_service_name(telegraf_agent_config, service_name):
"""
......
#!/usr/bin/python3
import pytest
from subprocess import run
from platform import system
from influxdb import InfluxDBClient
@pytest.mark.parametrize("service_name", [
......@@ -15,10 +17,22 @@ def test_service_name(telegraf_agent_config, service_name):
assert any(s['name'] == service_name for s in telegraf_agent_config['hosts']), "{0} not in list of hosts".format(service_name)
def test_ping(telegraf_agent_config):
"""This test will only run on linux as the process call is not portable, there's a better way"""
for host in telegraf_agent_config['hosts']:
response = os.system("ping -c 1 " + host['ip_address'])
assert response == 0, "Could not ping {0} on ip address {1}".format(host['name'], host['ip_address'])
"""
Pings each service to test for liveliness
:param streaming_sim_config: the configuration fixture collected from conftest.py
"""
print("\n") # blank line printed for formatting purposes
ping_count = 1
system_dependent_param = "-n" if system().lower() == "windows" else "-c"
for service in telegraf_agent_config['hosts']:
command = ["ping", system_dependent_param, str(ping_count), service['ip_address']]
assert run(command).returncode == 0, "Service ping test failed for {0} with ip address {1}".format(service['name'], service['ip_address'])
print("\nSuccessfully passed ping test for service: {0}\n".format(service['name']))
@pytest.mark.parametrize("measurement, query, expected_result", [
('nginx', 'SELECT mean("requests") AS "mean" FROM "CLMCMetrics"."autogen"."nginx"', 0),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment