From 744dd7e49d0ef50a0c7c4ab2e92446e4e4f19c36 Mon Sep 17 00:00:00 2001 From: Quentin Madec Date: Wed, 22 Apr 2015 14:05:05 -0400 Subject: [PATCH] [tests] split tests/ into two subdirectories Separate agent core tests and all integration tests. Also : - remove unused `run_check` in checks/__init__.py, which was importing from tests.common... - add a Resources class in tests.integrations.common to ease the use of fixtures --- .gitignore | 1 + checks/__init__.py | 26 --- tests/agent/__init__.py | 0 .../benchmark_aggregator.py | 0 tests/agent/resources/__init__.py | 0 tests/{ => agent/resources}/badconfig.conf | 0 .../resources}/flare/datadog-agent-1.tar.bz2 | Bin tests/{ => agent/resources}/target_module.py | 0 tests/{ => agent}/test_autorestart.py | 4 - tests/{ => agent}/test_bucket_aggregator.py | 0 tests/{ => agent}/test_check_status.py | 9 +- tests/{ => agent}/test_common.py | 6 +- tests/{ => agent}/test_config.py | 6 +- tests/{ => agent}/test_count_type.py | 0 tests/{ => agent}/test_datadog.py | 24 +-- tests/{ => agent}/test_ec2.py | 0 tests/{ => agent}/test_emitter.py | 0 tests/{ => agent}/test_flare.py | 1 + tests/{ => agent}/test_histogram.py | 0 tests/{ => agent}/test_laconic.py | 0 tests/{ => agent}/test_modules.py | 21 +- tests/{ => agent}/test_service_checks.py | 2 +- tests/{ => agent}/test_tail.py | 0 tests/{ => agent}/test_transaction.py | 0 tests/{ => agent}/test_win32.py | 0 tests/cassandra/cfstats | 194 ------------------ tests/cassandra/info | 5 - tests/cassandra/info.8 | 9 - tests/cassandra/info.opp | 10 - tests/cassandra/tpstats | 14 -- tests/cassandra/tpstats.8 | 25 --- tests/functional/dogstatsd_functional.py | 13 -- tests/integrations/__init__.py | 0 tests/{ => integrations}/common.py | 38 +++- .../resources}/cacti/whitelist.txt | 0 .../resources/cassandra_jmx}/cassandra.yaml | 0 .../resources/ganglia}/ganglia.txt | 0 .../resources}/go_expvar/expvar_output | 0 .../resources/nagios}/host-perfdata | 0 .../resources/nagios}/nagios.log | 0 .../resources/nagios}/service-perfdata | 0 .../resources/nginx}/nginx_plus_in.json | 0 .../resources/nginx}/nginx_plus_out.python | 0 .../resources/riakcs}/riakcs_in.json | 0 .../resources/riakcs}/riakcs_metrics.python | 0 .../resources/riakcs}/riakcs_out.python | 0 .../resources/solr}/solr.yaml | 0 .../resources}/varnish/dump.xml | 0 .../resources}/varnish/v_dump | 0 .../resources}/varnish/varnishadm_dump | 0 tests/{ => integrations}/test_activemq_xml.py | 2 +- tests/{ => integrations}/test_apache.py | 2 +- tests/{ => integrations}/test_cacti.py | 6 +- tests/{ => integrations}/test_cassandra.py | 0 .../{ => integrations}/test_cassandra_jmx.py | 4 +- tests/{ => integrations}/test_couch.py | 2 +- tests/{ => integrations}/test_couchbase.py | 2 +- tests/{ => integrations}/test_directory.py | 2 +- tests/{ => integrations}/test_docker.py | 2 +- tests/{ => integrations}/test_dogstatsd.py | 0 tests/{ => integrations}/test_elastic.py | 2 +- tests/{ => integrations}/test_etcd.py | 2 +- tests/{ => integrations}/test_fluentd.py | 2 +- tests/{ => integrations}/test_ganglia.py | 8 +- tests/{ => integrations}/test_gearman.py | 6 +- tests/{ => integrations}/test_go_expvar.py | 5 +- tests/{ => integrations}/test_haproxy.py | 2 +- tests/{ => integrations}/test_http_check.py | 2 +- tests/{ => integrations}/test_iis.py | 2 +- tests/{ => integrations}/test_java_jmx.py | 0 tests/{ => integrations}/test_jenkins.py | 2 +- tests/{ => integrations}/test_lighttpd.py | 2 +- tests/{ => integrations}/test_mcache.py | 2 +- tests/{ => integrations}/test_mongo.py | 2 +- tests/{ => integrations}/test_mysql.py | 2 +- tests/{ => integrations}/test_nagios.py | 10 +- tests/{ => integrations}/test_nginx.py | 8 +- tests/{ => integrations}/test_pgbouncer.py | 2 +- tests/{ => integrations}/test_php_fpm.py | 2 +- tests/{ => integrations}/test_postfix.py | 0 tests/{ => integrations}/test_postgres.py | 2 +- tests/{ => integrations}/test_process.py | 2 +- tests/{ => integrations}/test_rabbitmq.py | 2 +- tests/{ => integrations}/test_redis.py | 10 +- tests/{ => integrations}/test_riak.py | 2 +- tests/{ => integrations}/test_riakcs.py | 14 +- tests/{ => integrations}/test_snmp.py | 2 +- tests/{ => integrations}/test_solr.py | 8 +- tests/{ => integrations}/test_sqlserver.py | 2 +- tests/{ => integrations}/test_ssh_check.py | 2 +- tests/{ => integrations}/test_supervisord.py | 4 +- tests/{ => integrations}/test_system.py | 0 tests/{ => integrations}/test_system_core.py | 2 +- tests/{ => integrations}/test_system_swap.py | 2 +- tests/{ => integrations}/test_teamcity.py | 2 +- tests/{ => integrations}/test_tokumx.py | 2 +- tests/{ => integrations}/test_tomcat.py | 0 tests/{ => integrations}/test_varnish.py | 11 +- tests/{ => integrations}/test_watchdog.py | 0 .../test_win32_event_log.py | 2 +- .../test_windows_service.py | 2 +- tests/{ => integrations}/test_wmi.py | 2 +- tests/{ => integrations}/test_zookeeper.py | 2 +- 103 files changed, 149 insertions(+), 421 deletions(-) create mode 100644 tests/agent/__init__.py rename tests/{performance => agent}/benchmark_aggregator.py (100%) create mode 100644 tests/agent/resources/__init__.py rename tests/{ => agent/resources}/badconfig.conf (100%) rename tests/{ => agent/resources}/flare/datadog-agent-1.tar.bz2 (100%) rename tests/{ => agent/resources}/target_module.py (100%) rename tests/{ => agent}/test_autorestart.py (97%) rename tests/{ => agent}/test_bucket_aggregator.py (100%) rename tests/{ => agent}/test_check_status.py (98%) rename tests/{ => agent}/test_common.py (99%) rename tests/{ => agent}/test_config.py (96%) rename tests/{ => agent}/test_count_type.py (100%) rename tests/{ => agent}/test_datadog.py (99%) rename tests/{ => agent}/test_ec2.py (100%) rename tests/{ => agent}/test_emitter.py (100%) rename tests/{ => agent}/test_flare.py (99%) rename tests/{ => agent}/test_histogram.py (100%) rename tests/{ => agent}/test_laconic.py (100%) rename tests/{ => agent}/test_modules.py (71%) rename tests/{ => agent}/test_service_checks.py (99%) rename tests/{ => agent}/test_tail.py (100%) rename tests/{ => agent}/test_transaction.py (100%) rename tests/{ => agent}/test_win32.py (100%) delete mode 100644 tests/cassandra/cfstats delete mode 100644 tests/cassandra/info delete mode 100644 tests/cassandra/info.8 delete mode 100644 tests/cassandra/info.opp delete mode 100644 tests/cassandra/tpstats delete mode 100644 tests/cassandra/tpstats.8 delete mode 100644 tests/functional/dogstatsd_functional.py create mode 100644 tests/integrations/__init__.py rename tests/{ => integrations}/common.py (94%) rename tests/{ => integrations/resources}/cacti/whitelist.txt (100%) rename tests/{jmx_yamls => integrations/resources/cassandra_jmx}/cassandra.yaml (100%) rename tests/{ => integrations/resources/ganglia}/ganglia.txt (100%) rename tests/{ => integrations/resources}/go_expvar/expvar_output (100%) rename tests/{ => integrations/resources/nagios}/host-perfdata (100%) rename tests/{ => integrations/resources/nagios}/nagios.log (100%) rename tests/{ => integrations/resources/nagios}/service-perfdata (100%) rename tests/{data => integrations/resources/nginx}/nginx_plus_in.json (100%) rename tests/{data => integrations/resources/nginx}/nginx_plus_out.python (100%) rename tests/{data => integrations/resources/riakcs}/riakcs_in.json (100%) rename tests/{data => integrations/resources/riakcs}/riakcs_metrics.python (100%) rename tests/{data => integrations/resources/riakcs}/riakcs_out.python (100%) rename tests/{jmx_yamls => integrations/resources/solr}/solr.yaml (100%) rename tests/{ => integrations/resources}/varnish/dump.xml (100%) rename tests/{ => integrations/resources}/varnish/v_dump (100%) rename tests/{ => integrations/resources}/varnish/varnishadm_dump (100%) rename tests/{ => integrations}/test_activemq_xml.py (99%) rename tests/{ => integrations}/test_apache.py (97%) rename tests/{ => integrations}/test_cacti.py (96%) rename tests/{ => integrations}/test_cassandra.py (100%) rename tests/{ => integrations}/test_cassandra_jmx.py (95%) rename tests/{ => integrations}/test_couch.py (96%) rename tests/{ => integrations}/test_couchbase.py (98%) rename tests/{ => integrations}/test_directory.py (99%) rename tests/{ => integrations}/test_docker.py (97%) rename tests/{ => integrations}/test_dogstatsd.py (100%) rename tests/{ => integrations}/test_elastic.py (99%) rename tests/{ => integrations}/test_etcd.py (96%) rename tests/{ => integrations}/test_fluentd.py (97%) rename tests/{ => integrations}/test_ganglia.py (82%) rename tests/{ => integrations}/test_gearman.py (97%) rename tests/{ => integrations}/test_go_expvar.py (97%) rename tests/{ => integrations}/test_haproxy.py (99%) rename tests/{ => integrations}/test_http_check.py (98%) rename tests/{ => integrations}/test_iis.py (99%) rename tests/{ => integrations}/test_java_jmx.py (100%) rename tests/{ => integrations}/test_jenkins.py (99%) rename tests/{ => integrations}/test_lighttpd.py (96%) rename tests/{ => integrations}/test_mcache.py (98%) rename tests/{ => integrations}/test_mongo.py (99%) rename tests/{ => integrations}/test_mysql.py (98%) rename tests/{ => integrations}/test_nagios.py (98%) rename tests/{ => integrations}/test_nginx.py (90%) rename tests/{ => integrations}/test_pgbouncer.py (97%) rename tests/{ => integrations}/test_php_fpm.py (97%) rename tests/{ => integrations}/test_postfix.py (100%) rename tests/{ => integrations}/test_postgres.py (99%) rename tests/{ => integrations}/test_process.py (99%) rename tests/{ => integrations}/test_rabbitmq.py (98%) rename tests/{ => integrations}/test_redis.py (99%) rename tests/{ => integrations}/test_riak.py (98%) rename tests/{ => integrations}/test_riakcs.py (80%) rename tests/{ => integrations}/test_snmp.py (99%) rename tests/{ => integrations}/test_solr.py (95%) rename tests/{ => integrations}/test_sqlserver.py (98%) rename tests/{ => integrations}/test_ssh_check.py (97%) rename tests/{ => integrations}/test_supervisord.py (99%) rename tests/{ => integrations}/test_system.py (100%) rename tests/{ => integrations}/test_system_core.py (97%) rename tests/{ => integrations}/test_system_swap.py (94%) rename tests/{ => integrations}/test_teamcity.py (98%) rename tests/{ => integrations}/test_tokumx.py (99%) rename tests/{ => integrations}/test_tomcat.py (100%) rename tests/{ => integrations}/test_varnish.py (93%) rename tests/{ => integrations}/test_watchdog.py (100%) rename tests/{ => integrations}/test_win32_event_log.py (98%) rename tests/{ => integrations}/test_windows_service.py (98%) rename tests/{ => integrations}/test_wmi.py (99%) rename tests/{ => integrations}/test_zookeeper.py (97%) diff --git a/.gitignore b/.gitignore index 5bcc2fec37..2c179642cb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ node_modules/* venv/* *.swp *.log +!nagios.log *.pid *.deb *.rpm diff --git a/checks/__init__.py b/checks/__init__.py index cd1afcb399..404eff738e 100644 --- a/checks/__init__.py +++ b/checks/__init__.py @@ -682,32 +682,6 @@ def agent_formatter(metric, value, timestamp, tags, hostname, device_name=None, return (metric, int(timestamp), value) -def run_check(name, path=None): - from tests.common import get_check - - # Read the config file - confd_path = path or os.path.join(get_confd_path(get_os()), '%s.yaml' % name) - - try: - f = open(confd_path) - except IOError: - raise Exception('Unable to open configuration at %s' % confd_path) - - config_str = f.read() - f.close() - - # Run the check - check, instances = get_check(name, config_str) - if not instances: - raise Exception('YAML configuration returned no instances.') - for instance in instances: - check.check(instance) - if check.has_events(): - print "Events:\n" - pprint(check.get_events(), indent=4) - print "Metrics:\n" - pprint(check.get_metrics(), indent=4) - def create_service_check(check_name, status, tags=None, timestamp=None, hostname=None, check_run_id=None, message=None): """ Create a service_check dict. See AgentCheck.service_check() for diff --git a/tests/agent/__init__.py b/tests/agent/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/performance/benchmark_aggregator.py b/tests/agent/benchmark_aggregator.py similarity index 100% rename from tests/performance/benchmark_aggregator.py rename to tests/agent/benchmark_aggregator.py diff --git a/tests/agent/resources/__init__.py b/tests/agent/resources/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/badconfig.conf b/tests/agent/resources/badconfig.conf similarity index 100% rename from tests/badconfig.conf rename to tests/agent/resources/badconfig.conf diff --git a/tests/flare/datadog-agent-1.tar.bz2 b/tests/agent/resources/flare/datadog-agent-1.tar.bz2 similarity index 100% rename from tests/flare/datadog-agent-1.tar.bz2 rename to tests/agent/resources/flare/datadog-agent-1.tar.bz2 diff --git a/tests/target_module.py b/tests/agent/resources/target_module.py similarity index 100% rename from tests/target_module.py rename to tests/agent/resources/target_module.py diff --git a/tests/test_autorestart.py b/tests/agent/test_autorestart.py similarity index 97% rename from tests/test_autorestart.py rename to tests/agent/test_autorestart.py index 375178678c..0b0e74066f 100644 --- a/tests/test_autorestart.py +++ b/tests/agent/test_autorestart.py @@ -1,14 +1,10 @@ import time import unittest -import logging import subprocess import shlex import os import signal -from nose.plugins.skip import SkipTest - -from daemon import AgentSupervisor class TestAutoRestart(unittest.TestCase): """ Test the auto-restart and forking of the agent """ diff --git a/tests/test_bucket_aggregator.py b/tests/agent/test_bucket_aggregator.py similarity index 100% rename from tests/test_bucket_aggregator.py rename to tests/agent/test_bucket_aggregator.py diff --git a/tests/test_check_status.py b/tests/agent/test_check_status.py similarity index 98% rename from tests/test_check_status.py rename to tests/agent/test_check_status.py index c6e0079f4b..68931b5f3f 100644 --- a/tests/test_check_status.py +++ b/tests/agent/test_check_status.py @@ -11,34 +11,34 @@ def check(self, instance): raise Exception("failure") - def test_check_status_fail(): instances = [ {'pass':True}, {'pass':False}, {'pass':True} ] - + check = DummyAgentCheck('dummy_agent_check', {}, {}, instances) instance_statuses = check.run() assert len(instance_statuses) == 3 assert instance_statuses[0].status == STATUS_OK assert instance_statuses[1].status == STATUS_ERROR assert instance_statuses[2].status == STATUS_OK - + def test_check_status_pass(): instances = [ {'pass':True}, {'pass':True}, ] - + check = DummyAgentCheck('dummy_agent_check', {}, {}, instances) instances_status = check.run() assert len(instances_status) == 2 for i in instances_status: assert i.status == STATUS_OK + def test_persistence(): i1 = InstanceStatus(1, STATUS_OK) chk1 = CheckStatus("dummy", [i1], 1, 2) @@ -53,6 +53,7 @@ def test_persistence(): assert chk2.metric_count == 1 assert chk2.event_count == 2 + def test_persistence_fail(): # Assert remove doesn't crap out if a file doesn't exist. diff --git a/tests/test_common.py b/tests/agent/test_common.py similarity index 99% rename from tests/test_common.py rename to tests/agent/test_common.py index 35ce50aeb4..2388eea0b7 100644 --- a/tests/test_common.py +++ b/tests/agent/test_common.py @@ -11,16 +11,16 @@ AgentCheck, Check, CheckException, - CheckException, Infinity, UnknownValue, ) from checks.collector import Collector -from tests.common import load_check +from tests.integrations.common import load_check from util import get_hostname logger = logging.getLogger() + class TestCore(unittest.TestCase): "Tests to validate the core check logic" @@ -193,7 +193,7 @@ def test_no_proxy(self): from requests.utils import get_environ_proxies import dogstatsd from os import environ as env - + env["http_proxy"] = "http://localhost:3128" env["https_proxy"] = env["http_proxy"] env["HTTP_PROXY"] = env["http_proxy"] diff --git a/tests/test_config.py b/tests/agent/test_config.py similarity index 96% rename from tests/test_config.py rename to tests/agent/test_config.py index 87823ae569..c96f01910f 100644 --- a/tests/test_config.py +++ b/tests/agent/test_config.py @@ -1,4 +1,4 @@ -## -*- coding: latin-1 -*- +# -*- coding: latin-1 -*- import unittest import os import os.path @@ -8,11 +8,13 @@ from util import PidFile, is_valid_hostname, Platform, windows_friendly_colon_split + class TestConfig(unittest.TestCase): def testWhiteSpaceConfig(self): """Leading whitespace confuse ConfigParser """ - agentConfig = get_config(cfg_path=os.path.join(os.path.dirname(os.path.realpath(__file__)), "badconfig.conf")) + agentConfig = get_config(cfg_path=os.path.join(os.path.dirname(os.path.realpath(__file__)), + 'resources', 'badconfig.conf')) self.assertEquals(agentConfig["dd_url"], "https://app.datadoghq.com") self.assertEquals(agentConfig["api_key"], "1234") self.assertEquals(agentConfig["nagios_log"], "/var/log/nagios3/nagios.log") diff --git a/tests/test_count_type.py b/tests/agent/test_count_type.py similarity index 100% rename from tests/test_count_type.py rename to tests/agent/test_count_type.py diff --git a/tests/test_datadog.py b/tests/agent/test_datadog.py similarity index 99% rename from tests/test_datadog.py rename to tests/agent/test_datadog.py index baaebbf2a4..1e7be6880f 100644 --- a/tests/test_datadog.py +++ b/tests/agent/test_datadog.py @@ -2,9 +2,8 @@ import unittest from tempfile import NamedTemporaryFile import re -import os -from checks.datadog import Dogstreams, EventDefaults, point_sorter +from checks.datadog import Dogstreams, EventDefaults log = logging.getLogger('datadog.test') @@ -55,7 +54,7 @@ def parse_line(self, line): "RECOVERY": "success" } def parse_events(logger, line): - """ Expecting lines like this: + """ Expecting lines like this: 2012-05-14 12:46:01 [ERROR] - host0 is down (broke its collarbone) """ match = log_event_pattern.match(line) @@ -78,7 +77,7 @@ class TailTestCase(unittest.TestCase): def setUp(self): self.log_file = NamedTemporaryFile() self.logger = logging.getLogger('test.dogstream') - + def _write_log(self, log_data): for data in log_data: print >> self.log_file, data @@ -101,7 +100,7 @@ def setUp(self): log.info("Test config: %s" % self.config) self.dogstream = Dogstreams.init(self.logger, self.config) self.maxDiff = None - + def test_dogstream_gauge(self): log_data = [ # bucket 0 @@ -116,21 +115,21 @@ def test_dogstream_gauge(self): ('test.metric.a', '1000000006', '7', 'metric_type=gauge'), ('test.metric.a', '1000000007', '8', 'metric_type=gauge'), ] - + expected_output = { "dogstream": [ ('test.metric.a', 1000000000, 5.0, self.gauge), ('test.metric.a', 1000000005, 8.0, self.gauge), ] } - + self._write_log((' '.join(data) for data in log_data)) actual_output = self.dogstream.check(self.config, move_end=False) self.assertEquals(expected_output, actual_output) for metric, timestamp, val, attr in expected_output['dogstream']: assert isinstance(val, float) - + def test_dogstream_counter(self): log_data = [ # bucket 0 @@ -145,14 +144,14 @@ def test_dogstream_counter(self): ('test.metric.a', '1000000006', '7', 'metric_type=counter'), ('test.metric.a', '1000000007', '8', 'metric_type=counter'), ] - + expected_output = { "dogstream": [ ('test.metric.a', 1000000000, 42, self.counter), ('test.metric.a', 1000000005, 27, self.counter), ] } - + self._write_log((' '.join(data) for data in log_data)) actual_output = self.dogstream.check(self.config, move_end=False) @@ -170,9 +169,9 @@ def test_dogstream_bad_input(self): expected_output = {"dogstream": [('test_metric.e', 1000000000, 10, self.gauge)] } - + self._write_log(log_data) - + actual_output = self.dogstream.check(self.config, move_end=False) self.assertEquals(expected_output, actual_output) @@ -280,7 +279,6 @@ def test_dogstream_events(self): ] } - self._write_log(log_data) dogstream = Dogstreams.init(self.logger, {'dogstreams': '%s:tests.test_datadog:parse_events' % self.log_file.name}) diff --git a/tests/test_ec2.py b/tests/agent/test_ec2.py similarity index 100% rename from tests/test_ec2.py rename to tests/agent/test_ec2.py diff --git a/tests/test_emitter.py b/tests/agent/test_emitter.py similarity index 100% rename from tests/test_emitter.py rename to tests/agent/test_emitter.py diff --git a/tests/test_flare.py b/tests/agent/test_flare.py similarity index 99% rename from tests/test_flare.py rename to tests/agent/test_flare.py index 4fdb45871f..23195a5bf3 100644 --- a/tests/test_flare.py +++ b/tests/agent/test_flare.py @@ -18,6 +18,7 @@ def get_mocked_version(): def get_mocked_temp(): return os.path.join( os.path.dirname(os.path.realpath(__file__)), + 'resources', 'flare' ) diff --git a/tests/test_histogram.py b/tests/agent/test_histogram.py similarity index 100% rename from tests/test_histogram.py rename to tests/agent/test_histogram.py diff --git a/tests/test_laconic.py b/tests/agent/test_laconic.py similarity index 100% rename from tests/test_laconic.py rename to tests/agent/test_laconic.py diff --git a/tests/test_modules.py b/tests/agent/test_modules.py similarity index 71% rename from tests/test_modules.py rename to tests/agent/test_modules.py index f61963d4a9..bb398d76b7 100644 --- a/tests/test_modules.py +++ b/tests/agent/test_modules.py @@ -7,16 +7,18 @@ log = logging.getLogger('datadog.test') +TARGET_MODULE = 'tests.agent.resources.target_module' default_target = 'DEFAULT' specified_target = 'SPECIFIED' has_been_mutated = False + class TestModuleLoad(unittest.TestCase): def setUp(self): sys.modules[__name__].has_been_mutated = True - if 'tests.target_module' in sys.modules: - del sys.modules['tests.target_module'] + if TARGET_MODULE in sys.modules: + del sys.modules[TARGET_MODULE] def tearDown(self): sys.modules[__name__].has_been_mutated = False @@ -27,16 +29,16 @@ def test_cached_module(self): def test_cache_population(self): """Python module cache should be populated""" - self.assertTrue(not 'tests.target_module' in sys.modules) - modules.load('tests.target_module') - self.assertTrue('tests.target_module' in sys.modules) + self.assertTrue(TARGET_MODULE not in sys.modules) + modules.load(TARGET_MODULE) + self.assertTrue(TARGET_MODULE in sys.modules) def test_modname_load_default(self): """When the specifier contains no module name, any provided default should be used""" self.assertEquals( modules.load( - 'tests.target_module', + TARGET_MODULE, 'default_target'), 'DEFAULT' ) @@ -46,7 +48,7 @@ def test_modname_load_specified(self): should be overridden""" self.assertEquals( modules.load( - 'tests.target_module:specified_target', + '{0}:specified_target'.format(TARGET_MODULE), 'default_target'), 'SPECIFIED' ) @@ -54,8 +56,9 @@ def test_modname_load_specified(self): def test_pathname_load_finds_package(self): """"Loading modules by absolute path should correctly set the name of the loaded module to include any package containing it.""" - m = modules.load(os.getcwd() + '/tests/target_module.py') - self.assertEquals(m.__name__, 'tests.target_module') + m = modules.load(os.path.join(os.getcwd(), + TARGET_MODULE.replace('.', '/'))) + self.assertEquals(m.__name__, TARGET_MODULE) if __name__ == '__main__': unittest.main() diff --git a/tests/test_service_checks.py b/tests/agent/test_service_checks.py similarity index 99% rename from tests/test_service_checks.py rename to tests/agent/test_service_checks.py index 72e15a81b9..acecee84b4 100644 --- a/tests/test_service_checks.py +++ b/tests/agent/test_service_checks.py @@ -1,7 +1,7 @@ from Queue import Empty import unittest import time -from tests.common import load_check +from tests.integrations.common import load_check import nose.tools as nt from config import AGENT_VERSION from util import headers as agent_headers diff --git a/tests/test_tail.py b/tests/agent/test_tail.py similarity index 100% rename from tests/test_tail.py rename to tests/agent/test_tail.py diff --git a/tests/test_transaction.py b/tests/agent/test_transaction.py similarity index 100% rename from tests/test_transaction.py rename to tests/agent/test_transaction.py diff --git a/tests/test_win32.py b/tests/agent/test_win32.py similarity index 100% rename from tests/test_win32.py rename to tests/agent/test_win32.py diff --git a/tests/cassandra/cfstats b/tests/cassandra/cfstats deleted file mode 100644 index 6bbbc0f8a9..0000000000 --- a/tests/cassandra/cfstats +++ /dev/null @@ -1,194 +0,0 @@ -Keyspace: system - Read Count: 10 - Read Latency: 5.4211 ms. - Write Count: 3 - Write Latency: 0.02766666666666667 ms. - Pending Tasks: 0 - Column Family: Schema - SSTable count: 2 - Space used (live): 16326 - Space used (total): 16326 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 3 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 2 - Key cache size: 2 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 149 - Compacted row maximum size: 3311 - Compacted row mean size: 149 - - Column Family: Migrations - SSTable count: 1 - Space used (live): 12407 - Space used (total): 12407 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 1 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 6866 - Compacted row maximum size: 8239 - Compacted row mean size: 6866 - - Column Family: IndexInfo - SSTable count: 0 - Space used (live): 0 - Space used (total): 0 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 1 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 0 - Compacted row maximum size: 0 - Compacted row mean size: 0 - - Column Family: LocationInfo - SSTable count: 3 - Space used (live): 17890 - Space used (total): 17890 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 2 - Read Count: 7 - Read Latency: NaN ms. - Write Count: 3 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 3 - Key cache size: 3 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 124 - Compacted row maximum size: 310 - Compacted row mean size: 132 - - Column Family: HintsColumnFamily - SSTable count: 0 - Space used (live): 0 - Space used (total): 0 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 1 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 0 - Compacted row maximum size: 0 - Compacted row mean size: 0 - ----------------- -Keyspace: Intake - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Column Family: Events - SSTable count: 3 - Space used (live): 6623 - Space used (total): 6623 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 200000 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 0 - Compacted row maximum size: 372 - Compacted row mean size: 103 - - Column Family: Encodings - SSTable count: 2 - Space used (live): 19497 - Space used (total): 19497 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 200000 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 149 - Compacted row maximum size: 179 - Compacted row mean size: 149 - - Column Family: Metrics - SSTable count: 2 - Space used (live): 42521 - Space used (total): 42521 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 200000 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 642 - Compacted row maximum size: 770 - Compacted row mean size: 642 - - Column Family: Processes - SSTable count: 2 - Space used (live): 352725 - Space used (total): 352725 - Memtable Columns Count: 0 - Memtable Data Size: 0 - Memtable Switch Count: 0 - Read Count: 0 - Read Latency: NaN ms. - Write Count: 0 - Write Latency: NaN ms. - Pending Tasks: 0 - Key cache capacity: 200000 - Key cache size: 0 - Key cache hit rate: NaN - Row cache: disabled - Compacted row minimum size: 5722 - Compacted row maximum size: 9887 - Compacted row mean size: 6866 - ----------------- diff --git a/tests/cassandra/info b/tests/cassandra/info deleted file mode 100644 index eda67b5944..0000000000 --- a/tests/cassandra/info +++ /dev/null @@ -1,5 +0,0 @@ -36299342986353445520010708318471778930 -Load : 457.02 KB -Generation No : 1295816448 -Uptime (seconds) : 95 -Heap Memory (MB) : 521.86 / 1019.88 diff --git a/tests/cassandra/info.8 b/tests/cassandra/info.8 deleted file mode 100644 index b2756ef327..0000000000 --- a/tests/cassandra/info.8 +++ /dev/null @@ -1,9 +0,0 @@ -Token : 51022655878160265769426795515063697984 -Gossip active : true -Load : 283.87 GB -Generation No : 1331653944 -Uptime (seconds) : 188319 -Heap Memory (MB) : 2527.04 / 3830.00 -Data Center : 28 -Rack : 76 -Exceptions : 0 diff --git a/tests/cassandra/info.opp b/tests/cassandra/info.opp deleted file mode 100644 index 68015ca7b7..0000000000 --- a/tests/cassandra/info.opp +++ /dev/null @@ -1,10 +0,0 @@ -Token : Token(bytes[56713727820156410577229101240436610842]) -Generation No : 1331653944 -Gossip active : true -Load : 283.87 GB -Generation No : 1331653944 -Uptime (seconds) : 188319 -Heap Memory (MB) : 2527.04 / 3830.00 -Data Center : 28 -Rack : 76 -Exceptions : 0 diff --git a/tests/cassandra/tpstats b/tests/cassandra/tpstats deleted file mode 100644 index 0202ce032e..0000000000 --- a/tests/cassandra/tpstats +++ /dev/null @@ -1,14 +0,0 @@ -Pool Name Active Pending Completed -ReadStage 0 0 1 -RequestResponseStage 0 0 0 -MutationStage 0 0 3 -ReadRepair 0 0 0 -GossipStage 0 0 0 -AntiEntropyStage 0 0 0 -MigrationStage 0 0 0 -MemtablePostFlusher 0 0 2 -StreamStage 0 0 0 -FlushWriter 0 0 2 -MiscStage 0 0 0 -FlushSorter 0 0 0 -InternalResponseStage 0 0 0 diff --git a/tests/cassandra/tpstats.8 b/tests/cassandra/tpstats.8 deleted file mode 100644 index 0ad1c0cbbc..0000000000 --- a/tests/cassandra/tpstats.8 +++ /dev/null @@ -1,25 +0,0 @@ -Pool Name Active Pending Completed Blocked All time blocked -ReadStage 0 0 13931979 0 0 -RequestResponseStage 0 0 61825583 0 0 -MutationStage 0 0 63053347 0 0 -ReadRepairStage 0 0 4197438 0 0 -ReplicateOnWriteStage 0 0 0 0 0 -GossipStage 0 0 2942066 0 0 -AntiEntropyStage 0 0 0 0 0 -MigrationStage 0 0 0 0 0 -MemtablePostFlusher 0 0 10938 0 0 -StreamStage 0 0 0 0 0 -FlushWriter 0 0 10938 0 12 -FILEUTILS-DELETE-POOL 0 0 1379 0 0 -MiscStage 0 0 0 0 0 -FlushSorter 0 0 0 0 0 -InternalResponseStage 0 0 0 0 0 -HintedHandoff 0 0 9 0 0 - -Message type Dropped -RANGE_SLICE 0 -READ_REPAIR 0 -BINARY 0 -READ 20234 -MUTATION 0 -REQUEST_RESPONSE 0 diff --git a/tests/functional/dogstatsd_functional.py b/tests/functional/dogstatsd_functional.py deleted file mode 100644 index 996a98d4e3..0000000000 --- a/tests/functional/dogstatsd_functional.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Functional tests for dogstatsd. -""" - - - - - - - - - - diff --git a/tests/integrations/__init__.py b/tests/integrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/common.py b/tests/integrations/common.py similarity index 94% rename from tests/common.py rename to tests/integrations/common.py index 9e88c5bfb8..48b9031546 100644 --- a/tests/common.py +++ b/tests/integrations/common.py @@ -17,6 +17,7 @@ log = logging.getLogger('tests') + def get_check_class(name): checksd_path = get_checksd_path(get_os()) if checksd_path not in sys.path: @@ -37,6 +38,7 @@ def get_check_class(name): return check_class + def load_check(name, config, agentConfig): checksd_path = get_checksd_path(get_os()) if checksd_path not in sys.path: @@ -67,6 +69,7 @@ def load_check(name, config, agentConfig): except Exception as e: raise Exception("Check is using old API, {0}".format(e)) + def kill_subprocess(process_obj): try: process_obj.terminate() @@ -76,12 +79,13 @@ def kill_subprocess(process_obj): import ctypes PROCESS_TERMINATE = 1 handle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, False, - process_obj.pid) + process_obj.pid) ctypes.windll.kernel32.TerminateProcess(handle, -1) ctypes.windll.kernel32.CloseHandle(handle) else: os.kill(process_obj.pid, signal.SIGKILL) + def get_check(name, config_str): checksd_path = get_checksd_path(get_os()) if checksd_path not in sys.path: @@ -102,10 +106,34 @@ def get_check(name, config_str): } return check_class.from_yaml(yaml_text=config_str, check_name=name, - agentConfig=agentConfig) - -def read_data_from_file(filename): - return open(os.path.join(os.path.dirname(__file__), 'data', filename)).read() + agentConfig=agentConfig) + + +class Resources(object): + + @staticmethod + def integration_name(): + for stack in inspect.stack(): + # stack[1] is the file path + file_name = os.path.basename(stack[1]) + if 'test_' in file_name: + # test_name.py + # 5 -3 + return file_name[5:-3] + raise Exception('No integration test file in stack') + + @staticmethod + def directory(): + return os.path.join(os.path.dirname(__file__), 'resources', + Resources.integration_name()) + + @staticmethod + def file(file_name): + return os.path.join(Resources.directory(), file_name) + + @staticmethod + def read_file(file_name): + return open(Resources.file(file_name)).read() class AgentCheckTest(unittest.TestCase): diff --git a/tests/cacti/whitelist.txt b/tests/integrations/resources/cacti/whitelist.txt similarity index 100% rename from tests/cacti/whitelist.txt rename to tests/integrations/resources/cacti/whitelist.txt diff --git a/tests/jmx_yamls/cassandra.yaml b/tests/integrations/resources/cassandra_jmx/cassandra.yaml similarity index 100% rename from tests/jmx_yamls/cassandra.yaml rename to tests/integrations/resources/cassandra_jmx/cassandra.yaml diff --git a/tests/ganglia.txt b/tests/integrations/resources/ganglia/ganglia.txt similarity index 100% rename from tests/ganglia.txt rename to tests/integrations/resources/ganglia/ganglia.txt diff --git a/tests/go_expvar/expvar_output b/tests/integrations/resources/go_expvar/expvar_output similarity index 100% rename from tests/go_expvar/expvar_output rename to tests/integrations/resources/go_expvar/expvar_output diff --git a/tests/host-perfdata b/tests/integrations/resources/nagios/host-perfdata similarity index 100% rename from tests/host-perfdata rename to tests/integrations/resources/nagios/host-perfdata diff --git a/tests/nagios.log b/tests/integrations/resources/nagios/nagios.log similarity index 100% rename from tests/nagios.log rename to tests/integrations/resources/nagios/nagios.log diff --git a/tests/service-perfdata b/tests/integrations/resources/nagios/service-perfdata similarity index 100% rename from tests/service-perfdata rename to tests/integrations/resources/nagios/service-perfdata diff --git a/tests/data/nginx_plus_in.json b/tests/integrations/resources/nginx/nginx_plus_in.json similarity index 100% rename from tests/data/nginx_plus_in.json rename to tests/integrations/resources/nginx/nginx_plus_in.json diff --git a/tests/data/nginx_plus_out.python b/tests/integrations/resources/nginx/nginx_plus_out.python similarity index 100% rename from tests/data/nginx_plus_out.python rename to tests/integrations/resources/nginx/nginx_plus_out.python diff --git a/tests/data/riakcs_in.json b/tests/integrations/resources/riakcs/riakcs_in.json similarity index 100% rename from tests/data/riakcs_in.json rename to tests/integrations/resources/riakcs/riakcs_in.json diff --git a/tests/data/riakcs_metrics.python b/tests/integrations/resources/riakcs/riakcs_metrics.python similarity index 100% rename from tests/data/riakcs_metrics.python rename to tests/integrations/resources/riakcs/riakcs_metrics.python diff --git a/tests/data/riakcs_out.python b/tests/integrations/resources/riakcs/riakcs_out.python similarity index 100% rename from tests/data/riakcs_out.python rename to tests/integrations/resources/riakcs/riakcs_out.python diff --git a/tests/jmx_yamls/solr.yaml b/tests/integrations/resources/solr/solr.yaml similarity index 100% rename from tests/jmx_yamls/solr.yaml rename to tests/integrations/resources/solr/solr.yaml diff --git a/tests/varnish/dump.xml b/tests/integrations/resources/varnish/dump.xml similarity index 100% rename from tests/varnish/dump.xml rename to tests/integrations/resources/varnish/dump.xml diff --git a/tests/varnish/v_dump b/tests/integrations/resources/varnish/v_dump similarity index 100% rename from tests/varnish/v_dump rename to tests/integrations/resources/varnish/v_dump diff --git a/tests/varnish/varnishadm_dump b/tests/integrations/resources/varnish/varnishadm_dump similarity index 100% rename from tests/varnish/varnishadm_dump rename to tests/integrations/resources/varnish/varnishadm_dump diff --git a/tests/test_activemq_xml.py b/tests/integrations/test_activemq_xml.py similarity index 99% rename from tests/test_activemq_xml.py rename to tests/integrations/test_activemq_xml.py index 1f9edbefbc..f0eeecde14 100644 --- a/tests/test_activemq_xml.py +++ b/tests/integrations/test_activemq_xml.py @@ -2,7 +2,7 @@ import mock -from tests.common import get_check +from tests.integrations.common import get_check class ActiveMQXMLTestCase(unittest.TestCase): diff --git a/tests/test_apache.py b/tests/integrations/test_apache.py similarity index 97% rename from tests/test_apache.py rename to tests/integrations/test_apache.py index 9e975f2541..5538c579c2 100644 --- a/tests/test_apache.py +++ b/tests/integrations/test_apache.py @@ -3,7 +3,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr(requires='apache') diff --git a/tests/test_cacti.py b/tests/integrations/test_cacti.py similarity index 96% rename from tests/test_cacti.py rename to tests/integrations/test_cacti.py index edc6f579c2..f265c86024 100644 --- a/tests/test_cacti.py +++ b/tests/integrations/test_cacti.py @@ -1,9 +1,8 @@ -from common import get_check +from tests.integrations.common import get_check, Resources import unittest import os import logging -import subprocess import shutil log = logging.getLogger() @@ -16,7 +15,8 @@ mysql_user: root rrd_path: /tmp/cacti_test/rrds rrd_whitelist: %s -""" % (os.path.join(os.path.dirname(__file__), "cacti", "whitelist.txt")) +""" % Resources.file('whitelist.txt') + class TestCacti(unittest.TestCase): def setUp(self): diff --git a/tests/test_cassandra.py b/tests/integrations/test_cassandra.py similarity index 100% rename from tests/test_cassandra.py rename to tests/integrations/test_cassandra.py diff --git a/tests/test_cassandra_jmx.py b/tests/integrations/test_cassandra_jmx.py similarity index 95% rename from tests/test_cassandra_jmx.py rename to tests/integrations/test_cassandra_jmx.py index 5c073b02ca..9e4dd8daf7 100644 --- a/tests/test_cassandra_jmx.py +++ b/tests/integrations/test_cassandra_jmx.py @@ -7,7 +7,7 @@ from util import PidFile import os from jmxfetch import JMXFetch - +from tests.integrations.common import Resources STATSD_PORT = 8121 @@ -43,7 +43,7 @@ def setUp(self): self.t1 = threading.Thread(target=self.server.start) self.t1.start() - confd_path = os.path.realpath(os.path.join(os.path.abspath(__file__), "..", "jmx_yamls")) + confd_path = Resources.directory() self.jmx_daemon = JMXFetch(confd_path, {'dogstatsd_port': STATSD_PORT}) self.t2 = threading.Thread(target=self.jmx_daemon.run) diff --git a/tests/test_couch.py b/tests/integrations/test_couch.py similarity index 96% rename from tests/test_couch.py rename to tests/integrations/test_couch.py index b63b24fe61..abc6001860 100644 --- a/tests/test_couch.py +++ b/tests/integrations/test_couch.py @@ -1,4 +1,4 @@ -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest from nose.plugins.attrib import attr from checks import AgentCheck diff --git a/tests/test_couchbase.py b/tests/integrations/test_couchbase.py similarity index 98% rename from tests/test_couchbase.py rename to tests/integrations/test_couchbase.py index e893238fbc..fbe5868638 100644 --- a/tests/test_couchbase.py +++ b/tests/integrations/test_couchbase.py @@ -1,5 +1,5 @@ import unittest -from tests.common import load_check +from tests.integrations.common import load_check from checks import AgentCheck from nose.plugins.attrib import attr diff --git a/tests/test_directory.py b/tests/integrations/test_directory.py similarity index 99% rename from tests/test_directory.py rename to tests/integrations/test_directory.py index 8e67c00d9e..f8e894ef39 100644 --- a/tests/test_directory.py +++ b/tests/integrations/test_directory.py @@ -4,7 +4,7 @@ import shutil -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest class DirectoryTestCase(AgentCheckTest): diff --git a/tests/test_docker.py b/tests/integrations/test_docker.py similarity index 97% rename from tests/test_docker.py rename to tests/integrations/test_docker.py index 3d1d927b77..819fe751dd 100644 --- a/tests/test_docker.py +++ b/tests/integrations/test_docker.py @@ -2,7 +2,7 @@ from mock import patch -from tests.common import get_check_class +from tests.integrations.common import get_check_class def _mocked_find_cgroup(*args, **kwargs): return diff --git a/tests/test_dogstatsd.py b/tests/integrations/test_dogstatsd.py similarity index 100% rename from tests/test_dogstatsd.py rename to tests/integrations/test_dogstatsd.py diff --git a/tests/test_elastic.py b/tests/integrations/test_elastic.py similarity index 99% rename from tests/test_elastic.py rename to tests/integrations/test_elastic.py index fbd5b697c1..9e49aea27b 100644 --- a/tests/test_elastic.py +++ b/tests/integrations/test_elastic.py @@ -7,7 +7,7 @@ from nose.plugins.attrib import attr # project -from tests.common import AgentCheckTest, load_check +from tests.integrations.common import AgentCheckTest, load_check from checks import AgentCheck from config import get_version diff --git a/tests/test_etcd.py b/tests/integrations/test_etcd.py similarity index 96% rename from tests/test_etcd.py rename to tests/integrations/test_etcd.py index a9ada0f75d..0d6db65e30 100644 --- a/tests/test_etcd.py +++ b/tests/integrations/test_etcd.py @@ -1,4 +1,4 @@ -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest from nose.plugins.attrib import attr from time import sleep from checks import AgentCheck diff --git a/tests/test_fluentd.py b/tests/integrations/test_fluentd.py similarity index 97% rename from tests/test_fluentd.py rename to tests/integrations/test_fluentd.py index 1b3d232f1e..73a7ac743b 100644 --- a/tests/test_fluentd.py +++ b/tests/integrations/test_fluentd.py @@ -3,7 +3,7 @@ from nose.plugins.attrib import attr logger = logging.getLogger(__file__) -from tests.common import load_check +from tests.integrations.common import load_check @attr(requires='fluentd') class TestFluentd(unittest.TestCase): diff --git a/tests/test_ganglia.py b/tests/integrations/test_ganglia.py similarity index 82% rename from tests/test_ganglia.py rename to tests/integrations/test_ganglia.py index ff15cec58b..1fc78a1fd6 100644 --- a/tests/test_ganglia.py +++ b/tests/integrations/test_ganglia.py @@ -7,19 +7,19 @@ import profile import pstats import tempfile -from util import json, md5 import time import xml.etree.ElementTree as tree from cStringIO import StringIO from checks.ganglia import Ganglia +from tests.integrations.common import Resources -TEST_FN = "tests/ganglia.txt" class TestGanglia(unittest.TestCase): def testSpeed(self): # Pretend to be gmetad and serve a large piece of content - server = subprocess.Popen("nc -l 8651 < %s" % TEST_FN, shell=True) + original_file = Resources.file('ganglia.txt') + server = subprocess.Popen("nc -l 8651 < %s" % original_file, shell=True) # Wait for 1 second time.sleep(1) @@ -30,7 +30,7 @@ def testSpeed(self): # p = pstats.Stats(pfile.name) # p.sort_stats('time').print_stats() parsed = StringIO(g.check({'ganglia_host': 'localhost', 'ganglia_port': 8651})) - original = open(TEST_FN) + original = Resources.file('ganglia.txt') x1 = tree.parse(parsed) x2 = tree.parse(original) # Cursory test diff --git a/tests/test_gearman.py b/tests/integrations/test_gearman.py similarity index 97% rename from tests/test_gearman.py rename to tests/integrations/test_gearman.py index 762fdac86a..312731dd2d 100644 --- a/tests/test_gearman.py +++ b/tests/integrations/test_gearman.py @@ -1,6 +1,6 @@ # Agent from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest # 3rd party from nose.plugins.attrib import attr @@ -28,7 +28,7 @@ def test_metrics(self): self.assertServiceCheck("gearman.can_connect", status=AgentCheck.OK, tags=service_checks_tags, count=1) self.coverage_report() - + def test_service_checks(self): config = { @@ -36,7 +36,7 @@ def test_service_checks(self): {'host': '127.0.0.1', 'port': 4730}, {'host': '127.0.0.1', 'port': 4731}] } - + self.assertRaises(Exception, self.run_check, config) service_checks_tags_ok = ['server:127.0.0.1', 'port:4730'] service_checks_tags_not_ok = ['server:127.0.0.1', 'port:4731'] diff --git a/tests/test_go_expvar.py b/tests/integrations/test_go_expvar.py similarity index 97% rename from tests/test_go_expvar.py rename to tests/integrations/test_go_expvar.py index b98fe82d9b..2f5e850d31 100644 --- a/tests/test_go_expvar.py +++ b/tests/integrations/test_go_expvar.py @@ -1,12 +1,11 @@ from collections import defaultdict import copy from nose.plugins.attrib import attr -import os.path import simplejson as json import time -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest, Resources def _get_data_mock(url): @@ -60,7 +59,7 @@ class TestGoExpVar(AgentCheckTest): def __init__(self, *args, **kwargs): AgentCheckTest.__init__(self, *args, **kwargs) - self._expvar_url = os.path.join(os.path.dirname(__file__), "go_expvar", "expvar_output") + self._expvar_url = Resources.file('expvar_output') self.mock_config = { "instances": [{ "expvar_url": self._expvar_url, diff --git a/tests/test_haproxy.py b/tests/integrations/test_haproxy.py similarity index 99% rename from tests/test_haproxy.py rename to tests/integrations/test_haproxy.py index cee20b1523..2746da5def 100644 --- a/tests/test_haproxy.py +++ b/tests/integrations/test_haproxy.py @@ -1,6 +1,6 @@ from checks import AgentCheck from nose.plugins.attrib import attr -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest from util import get_hostname diff --git a/tests/test_http_check.py b/tests/integrations/test_http_check.py similarity index 98% rename from tests/test_http_check.py rename to tests/integrations/test_http_check.py index 83425c3404..aa852288ed 100644 --- a/tests/test_http_check.py +++ b/tests/integrations/test_http_check.py @@ -2,7 +2,7 @@ import mock from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest RESULTS_TIMEOUT = 5 diff --git a/tests/test_iis.py b/tests/integrations/test_iis.py similarity index 99% rename from tests/test_iis.py rename to tests/integrations/test_iis.py index aee530dc95..0fe6abdb84 100644 --- a/tests/test_iis.py +++ b/tests/integrations/test_iis.py @@ -2,7 +2,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest Win32_PerfFormattedData_W3SVC_WebService_attr = { diff --git a/tests/test_java_jmx.py b/tests/integrations/test_java_jmx.py similarity index 100% rename from tests/test_java_jmx.py rename to tests/integrations/test_java_jmx.py diff --git a/tests/test_jenkins.py b/tests/integrations/test_jenkins.py similarity index 99% rename from tests/test_jenkins.py rename to tests/integrations/test_jenkins.py index a116d240e1..48b0457a57 100644 --- a/tests/test_jenkins.py +++ b/tests/integrations/test_jenkins.py @@ -7,7 +7,7 @@ import logging import xml.etree.ElementTree as ET -from tests.common import get_check +from tests.integrations.common import get_check logger = logging.getLogger(__file__) diff --git a/tests/test_lighttpd.py b/tests/integrations/test_lighttpd.py similarity index 96% rename from tests/test_lighttpd.py rename to tests/integrations/test_lighttpd.py index 16326cd09e..1b97f9ed30 100644 --- a/tests/test_lighttpd.py +++ b/tests/integrations/test_lighttpd.py @@ -1,7 +1,7 @@ from nose.plugins.attrib import attr from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr(requires='lighttpd') diff --git a/tests/test_mcache.py b/tests/integrations/test_mcache.py similarity index 98% rename from tests/test_mcache.py rename to tests/integrations/test_mcache.py index a6a3666f34..0e2bd1c8ea 100644 --- a/tests/test_mcache.py +++ b/tests/integrations/test_mcache.py @@ -4,7 +4,7 @@ import time from subprocess import Popen, PIPE -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest from checks import AgentCheck diff --git a/tests/test_mongo.py b/tests/integrations/test_mongo.py similarity index 99% rename from tests/test_mongo.py rename to tests/integrations/test_mongo.py index e23a27e50f..de3e372f19 100644 --- a/tests/test_mongo.py +++ b/tests/integrations/test_mongo.py @@ -4,7 +4,7 @@ import pymongo -from tests.common import load_check +from tests.integrations.common import load_check PORT1 = 37017 PORT2 = 37018 diff --git a/tests/test_mysql.py b/tests/integrations/test_mysql.py similarity index 98% rename from tests/test_mysql.py rename to tests/integrations/test_mysql.py index afd5a1d8a6..112a4cfa03 100644 --- a/tests/test_mysql.py +++ b/tests/integrations/test_mysql.py @@ -3,7 +3,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr(requires='mysql') diff --git a/tests/test_nagios.py b/tests/integrations/test_nagios.py similarity index 98% rename from tests/test_nagios.py rename to tests/integrations/test_nagios.py index e278e424b4..5209dc783b 100644 --- a/tests/test_nagios.py +++ b/tests/integrations/test_nagios.py @@ -1,18 +1,16 @@ # stdlib -import os import tempfile import time # project -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest, Resources class NagiosTestCase(AgentCheckTest): CHECK_NAME = 'nagios' - - NAGIOS_TEST_LOG = os.path.join(os.path.dirname(__file__), "nagios.log") - NAGIOS_TEST_HOST = os.path.join(os.path.dirname(__file__), "host-perfdata") - NAGIOS_TEST_SVC = os.path.join(os.path.dirname(__file__), "service-perfdata") + NAGIOS_TEST_LOG = Resources.file('nagios.log') + NAGIOS_TEST_HOST = Resources.file('host-perfdata') + NAGIOS_TEST_SVC = Resources.file('service-perfdata') NAGIOS_TEST_HOST_TEMPLATE = "[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$" NAGIOS_TEST_SVC_TEMPLATE = "[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$" diff --git a/tests/test_nginx.py b/tests/integrations/test_nginx.py similarity index 90% rename from tests/test_nginx.py rename to tests/integrations/test_nginx.py index 0d0068286c..4f3fa400a2 100644 --- a/tests/test_nginx.py +++ b/tests/integrations/test_nginx.py @@ -1,7 +1,8 @@ import unittest from nose.plugins.attrib import attr -from tests.common import load_check, read_data_from_file +from tests.integrations.common import load_check, Resources + @attr(requires='nginx') class TestNginx(unittest.TestCase): @@ -29,7 +30,6 @@ def setUp(self): ] } - def test_nginx(self): nginx = load_check('nginx', self.config, self.agent_config) nginx.check(self.config['instances'][0]) @@ -45,8 +45,8 @@ def test_nginx(self): self.assertEquals(set(can_connect[i]['tags']), set(['host:localhost', 'port:44441']), service_checks) def test_nginx_plus(self): - test_data = read_data_from_file('nginx_plus_in.json') - expected = eval(read_data_from_file('nginx_plus_out.python')) + test_data = Resources.read_file('nginx_plus_in.json') + expected = eval(Resources.read_file('nginx_plus_out.python')) nginx = load_check('nginx', self.config, self.agent_config) parsed = nginx.parse_json(test_data) parsed.sort() diff --git a/tests/test_pgbouncer.py b/tests/integrations/test_pgbouncer.py similarity index 97% rename from tests/test_pgbouncer.py rename to tests/integrations/test_pgbouncer.py index 69558a643b..aeeaaf0bc3 100644 --- a/tests/test_pgbouncer.py +++ b/tests/integrations/test_pgbouncer.py @@ -1,4 +1,4 @@ -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest import time import psycopg2 as pg diff --git a/tests/test_php_fpm.py b/tests/integrations/test_php_fpm.py similarity index 97% rename from tests/test_php_fpm.py rename to tests/integrations/test_php_fpm.py index fb8ec553d9..b92f29f941 100644 --- a/tests/test_php_fpm.py +++ b/tests/integrations/test_php_fpm.py @@ -6,7 +6,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest # sample from /status?json # { diff --git a/tests/test_postfix.py b/tests/integrations/test_postfix.py similarity index 100% rename from tests/test_postfix.py rename to tests/integrations/test_postfix.py diff --git a/tests/test_postgres.py b/tests/integrations/test_postgres.py similarity index 99% rename from tests/test_postgres.py rename to tests/integrations/test_postgres.py index 0f2553659f..e286881df1 100644 --- a/tests/test_postgres.py +++ b/tests/integrations/test_postgres.py @@ -6,7 +6,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr(requires='postgres') diff --git a/tests/test_process.py b/tests/integrations/test_process.py similarity index 99% rename from tests/test_process.py rename to tests/integrations/test_process.py index 0df6b6284b..f5d8dbd18d 100644 --- a/tests/test_process.py +++ b/tests/integrations/test_process.py @@ -2,7 +2,7 @@ from nose.plugins.attrib import attr from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr('process') diff --git a/tests/test_rabbitmq.py b/tests/integrations/test_rabbitmq.py similarity index 98% rename from tests/test_rabbitmq.py rename to tests/integrations/test_rabbitmq.py index 232fc1d43d..f049810eee 100644 --- a/tests/test_rabbitmq.py +++ b/tests/integrations/test_rabbitmq.py @@ -2,7 +2,7 @@ from nose.plugins.attrib import attr # project -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest CONFIG = { 'init_config': {}, diff --git a/tests/test_redis.py b/tests/integrations/test_redis.py similarity index 99% rename from tests/test_redis.py rename to tests/integrations/test_redis.py index 9d323b00f2..5d2b1a41c4 100644 --- a/tests/test_redis.py +++ b/tests/integrations/test_redis.py @@ -7,7 +7,7 @@ import redis import random -from tests.common import load_check, AgentCheckTest +from tests.integrations.common import load_check, AgentCheckTest logger = logging.getLogger() MAX_WAIT = 20 @@ -236,7 +236,7 @@ def test_slowlog(self): } db = redis.Redis(port=port, db=14) # Datadog's test db - + # Tweaking Redis's config to have the test run faster old_sl_thresh = db.config_get('slowlog-log-slower-than')['slowlog-log-slower-than'] db.config_set('slowlog-log-slower-than', 0) @@ -250,7 +250,7 @@ def test_slowlog(self): db.sort(test_key) self.assertTrue(db.slowlog_len() > 0) - + db.config_set('slowlog-log-slower-than', old_sl_thresh) self.run_check({"init_config": {}, "instances": [instance]}) @@ -288,10 +288,10 @@ def test_custom_slowlog(self): self.assertTrue(db.slowlog_len() > 0) self.run_check({"init_config": {}, "instances": [instance]}) - + assert self.metrics, "No metrics returned" - # Let's check that we didn't put more than one slowlog entry in the + # Let's check that we didn't put more than one slowlog entry in the # payload, as specified in the above agent configuration self.assertMetric("redis.slowlog.micros.count", tags=["command:SORT", "redis_host:localhost", "redis_port:{0}".format(port)], value=1.0) diff --git a/tests/test_riak.py b/tests/integrations/test_riak.py similarity index 98% rename from tests/test_riak.py rename to tests/integrations/test_riak.py index ee662ef71b..7e614be371 100644 --- a/tests/test_riak.py +++ b/tests/integrations/test_riak.py @@ -1,6 +1,6 @@ from nose.plugins.attrib import attr import socket -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr(requires='riak') diff --git a/tests/test_riakcs.py b/tests/integrations/test_riakcs.py similarity index 80% rename from tests/test_riakcs.py rename to tests/integrations/test_riakcs.py index ee5b9c1466..08586dbcae 100644 --- a/tests/test_riakcs.py +++ b/tests/integrations/test_riakcs.py @@ -1,12 +1,14 @@ import unittest -from tests.common import load_check, read_data_from_file, AgentCheckTest +from tests.integrations.common import load_check, Resources, AgentCheckTest from mock import Mock from socket import error from checks import AgentCheck + class RiakCSTest(AgentCheckTest): CHECK_NAME = "riakcs" + def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) self.config = {"instances": [{ @@ -14,20 +16,20 @@ def __init__(self, *args, **kwargs): "access_secret": "bar"}]} self.check = load_check(self.CHECK_NAME, self.config, {}) self.check._connect = Mock(return_value=(None, None, ["aggregation_key:localhost:8080"])) - self.check._get_stats = Mock(return_value=self.check.load_json(read_data_from_file("riakcs_in.json"))) + self.check._get_stats = Mock(return_value=self.check.load_json( + Resources.read_file('riakcs_in.json'))) def test_parser(self): - input_json = read_data_from_file("riakcs_in.json") - output_python = read_data_from_file("riakcs_out.python") + input_json = Resources.read_file('riakcs_in.json') + output_python = Resources.read_file('riakcs_out.python') self.assertEquals(self.check.load_json(input_json), eval(output_python)) def test_metrics(self): self.run_check(self.config) - expected = eval(read_data_from_file("riakcs_metrics.python")) + expected = Resources.read_file('riakcs_metrics.json') for m in expected: self.assertMetric(m[0], m[2], m[3].get('tags', [])) - def test_service_checks(self): self.check = load_check(self.CHECK_NAME, self.config, {}) self.assertRaises(error, lambda: self.run_check(self.config)) diff --git a/tests/test_snmp.py b/tests/integrations/test_snmp.py similarity index 99% rename from tests/test_snmp.py rename to tests/integrations/test_snmp.py index a3774925db..3027561a27 100644 --- a/tests/test_snmp.py +++ b/tests/integrations/test_snmp.py @@ -5,7 +5,7 @@ # agent from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest # This test is dependent of having a fully open snmpd responding at localhost:161 # with an authentication by the Community String "public" diff --git a/tests/test_solr.py b/tests/integrations/test_solr.py similarity index 95% rename from tests/test_solr.py rename to tests/integrations/test_solr.py index 34d9ba39aa..1067ebc994 100644 --- a/tests/test_solr.py +++ b/tests/integrations/test_solr.py @@ -8,6 +8,8 @@ import os from jmxfetch import JMXFetch +from tests.integrations.common import Resources + STATSD_PORT = 8127 @@ -21,7 +23,6 @@ def __init__(self, metrics_aggregator): self.finished = False self.start() - def run(self): while not self.finished: time.sleep(self.interval) @@ -32,6 +33,7 @@ def flush(self): if metrics: self.metrics = metrics + @attr(requires='solr') class JMXTestCase(unittest.TestCase): def setUp(self): @@ -43,7 +45,7 @@ def setUp(self): self.t1 = threading.Thread(target=self.server.start) self.t1.start() - confd_path = os.path.realpath(os.path.join(os.path.abspath(__file__), "..", "jmx_yamls")) + confd_path = Resources.directory() self.jmx_daemon = JMXFetch(confd_path, {'dogstatsd_port': STATSD_PORT}) self.t2 = threading.Thread(target=self.jmx_daemon.run) self.t2.start() @@ -53,7 +55,6 @@ def tearDown(self): self.reporter.finished = True self.jmx_daemon.terminate() - def testTomcatMetrics(self): count = 0 while self.reporter.metrics is None: @@ -64,7 +65,6 @@ def testTomcatMetrics(self): metrics = self.reporter.metrics - self.assertTrue(type(metrics) == type([])) self.assertTrue(len(metrics) > 8, metrics) self.assertEquals(len([t for t in metrics if 'instance:solr_instance' in t['tags'] and t['metric'] == "jvm.thread_count"]), 1, metrics) diff --git a/tests/test_sqlserver.py b/tests/integrations/test_sqlserver.py similarity index 98% rename from tests/test_sqlserver.py rename to tests/integrations/test_sqlserver.py index f413c26725..5e07f8d8a7 100644 --- a/tests/test_sqlserver.py +++ b/tests/integrations/test_sqlserver.py @@ -2,7 +2,7 @@ import logging from nose.plugins.attrib import attr -from tests.common import get_check +from tests.integrations.common import get_check logging.basicConfig() diff --git a/tests/test_ssh_check.py b/tests/integrations/test_ssh_check.py similarity index 97% rename from tests/test_ssh_check.py rename to tests/integrations/test_ssh_check.py index d952217c0c..6f7e07601e 100644 --- a/tests/test_ssh_check.py +++ b/tests/integrations/test_ssh_check.py @@ -1,6 +1,6 @@ import unittest from nose.plugins.attrib import attr -from tests.common import load_check +from tests.integrations.common import load_check from checks import AgentCheck @attr(requires='ssh') diff --git a/tests/test_supervisord.py b/tests/integrations/test_supervisord.py similarity index 99% rename from tests/test_supervisord.py rename to tests/integrations/test_supervisord.py index a1c35a109b..997f12f7e0 100644 --- a/tests/test_supervisord.py +++ b/tests/integrations/test_supervisord.py @@ -8,7 +8,7 @@ import xmlrpclib from checks import AgentCheck -from tests.common import get_check +from tests.integrations.common import get_check class TestSupervisordCheck(unittest.TestCase): @@ -469,4 +469,4 @@ def _validate_request(self, proc=None): 'Unauthorized', None) elif proc is not None and 'invalid' in proc: # Simulate xmlrpc exception for process not found - raise xmlrpclib.Fault(10, 'BAD_NAME') \ No newline at end of file + raise xmlrpclib.Fault(10, 'BAD_NAME') diff --git a/tests/test_system.py b/tests/integrations/test_system.py similarity index 100% rename from tests/test_system.py rename to tests/integrations/test_system.py diff --git a/tests/test_system_core.py b/tests/integrations/test_system_core.py similarity index 97% rename from tests/test_system_core.py rename to tests/integrations/test_system_core.py index 0ee44ba9e3..7fc61c8fdd 100644 --- a/tests/test_system_core.py +++ b/tests/integrations/test_system_core.py @@ -1,7 +1,7 @@ import mock import psutil -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest from util import Platform if Platform.is_mac(): diff --git a/tests/test_system_swap.py b/tests/integrations/test_system_swap.py similarity index 94% rename from tests/test_system_swap.py rename to tests/integrations/test_system_swap.py index e0b511a9bd..d289179d2d 100644 --- a/tests/test_system_swap.py +++ b/tests/integrations/test_system_swap.py @@ -1,6 +1,6 @@ import mock -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest class _PSUtilSwapStatsMock(object): def __init__(self, sin, sout): diff --git a/tests/test_teamcity.py b/tests/integrations/test_teamcity.py similarity index 98% rename from tests/test_teamcity.py rename to tests/integrations/test_teamcity.py index 13f6701476..f4f84fea41 100644 --- a/tests/test_teamcity.py +++ b/tests/integrations/test_teamcity.py @@ -5,7 +5,7 @@ from mock import MagicMock, patch # project -from tests.common import load_check +from tests.integrations.common import load_check CONFIG = { 'init_config': {}, diff --git a/tests/test_tokumx.py b/tests/integrations/test_tokumx.py similarity index 99% rename from tests/test_tokumx.py rename to tests/integrations/test_tokumx.py index cdabd167a6..780ccb93af 100644 --- a/tests/test_tokumx.py +++ b/tests/integrations/test_tokumx.py @@ -3,7 +3,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest GAUGES = [ diff --git a/tests/test_tomcat.py b/tests/integrations/test_tomcat.py similarity index 100% rename from tests/test_tomcat.py rename to tests/integrations/test_tomcat.py diff --git a/tests/test_varnish.py b/tests/integrations/test_varnish.py similarity index 93% rename from tests/test_varnish.py rename to tests/integrations/test_varnish.py index b9ca81cf95..932b09ebea 100644 --- a/tests/test_varnish.py +++ b/tests/integrations/test_varnish.py @@ -1,19 +1,13 @@ -# stdlib -import os - # 3p from nose.plugins.attrib import attr # project -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest, Resources from utils.shell import which -VARNISH_DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'varnish') - - def mocked_varnishstatoutput(cmd): - return open(os.path.join(VARNISH_DATA_DIR, 'dump.xml'), 'r').read() + return Resources.read_file('dump.xml') COMMON_METRICS = [ @@ -97,6 +91,7 @@ def mocked_varnishstatoutput(cmd): 'varnish.SMF.s0.g_smf_frag', ] + class VarnishCheckTest(AgentCheckTest): CHECK_NAME = 'varnish' diff --git a/tests/test_watchdog.py b/tests/integrations/test_watchdog.py similarity index 100% rename from tests/test_watchdog.py rename to tests/integrations/test_watchdog.py diff --git a/tests/test_win32_event_log.py b/tests/integrations/test_win32_event_log.py similarity index 98% rename from tests/test_win32_event_log.py rename to tests/integrations/test_win32_event_log.py index 3e34afeb45..2d0bb0f9d2 100644 --- a/tests/test_win32_event_log.py +++ b/tests/integrations/test_win32_event_log.py @@ -2,7 +2,7 @@ import logging from nose.plugins.attrib import attr -from tests.common import get_check +from tests.integrations.common import get_check logging.basicConfig() diff --git a/tests/test_windows_service.py b/tests/integrations/test_windows_service.py similarity index 98% rename from tests/test_windows_service.py rename to tests/integrations/test_windows_service.py index d003cb1de7..b2e4a420c0 100644 --- a/tests/test_windows_service.py +++ b/tests/integrations/test_windows_service.py @@ -3,7 +3,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest WinHttpAutoProxySvc_attr = { # Running Windows Service diff --git a/tests/test_wmi.py b/tests/integrations/test_wmi.py similarity index 99% rename from tests/test_wmi.py rename to tests/integrations/test_wmi.py index c28fb20b56..c1793601c8 100644 --- a/tests/test_wmi.py +++ b/tests/integrations/test_wmi.py @@ -1,5 +1,5 @@ # project -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest Win32_OperatingSystem_attr = { diff --git a/tests/test_zookeeper.py b/tests/integrations/test_zookeeper.py similarity index 97% rename from tests/test_zookeeper.py rename to tests/integrations/test_zookeeper.py index db6a003dec..2c6f184c4a 100644 --- a/tests/test_zookeeper.py +++ b/tests/integrations/test_zookeeper.py @@ -3,7 +3,7 @@ # project from checks import AgentCheck -from tests.common import AgentCheckTest +from tests.integrations.common import AgentCheckTest @attr(requires='zookeeper')