Skip to content

Commit

Permalink
[tests] fixing for new dd_integrations path, instead of 3rd-party.
Browse files Browse the repository at this point in the history
  • Loading branch information
truthbk committed Jul 20, 2016
1 parent b1a6227 commit 03846f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,14 +738,14 @@ def get_checksd_path(osname=None):
return _unix_checksd_path()


def get_3rd_party_path(osname=None):
def get_dd_integrations_path(osname=None):
if not osname:
osname = get_os()
if osname in ['windows', 'mac']:
raise PathNotFound()

cur_path = os.path.dirname(os.path.realpath(__file__))
path = os.path.join(cur_path, '../3rd-party')
path = os.path.join(cur_path, '../dd-integrations')
if os.path.exists(path):
return path
raise PathNotFound(path)
Expand Down Expand Up @@ -905,10 +905,10 @@ def get_checks_places(osname, agentConfig):
places = [lambda name: os.path.join(agentConfig['additional_checksd'], '%s.py' % name)]

try:
third_party_path = get_3rd_party_path(osname)
places.append(lambda name: os.path.join(third_party_path, name, 'check.py'))
dd_integrations = get_dd_integrations_path(osname)
places.append(lambda name: os.path.join(dd_integrations, name, 'check.py'))
except PathNotFound:
log.debug('No 3rd-party path found')
log.debug('No dd-integrations path found')

places.append(lambda name: os.path.join(checksd_path, '%s.py' % name))
return places
Expand Down
10 changes: 5 additions & 5 deletions tests/core/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def testDefaultChecks(self):

TMP_DIR = tempfile.gettempdir()
DD_AGENT_TEST_DIR = 'dd-agent-tests'
TEMP_3RD_PARTY_CHECKS_DIR = os.path.join(TMP_DIR, DD_AGENT_TEST_DIR, '3rd-party')
TEMP_DD_INTEGRATIONS_CHECKS_DIR = os.path.join(TMP_DIR, DD_AGENT_TEST_DIR, 'dd-integrations')
TEMP_ETC_CHECKS_DIR = os.path.join(TMP_DIR, DD_AGENT_TEST_DIR, 'etc', 'checks.d')
TEMP_ETC_CONF_DIR = os.path.join(TMP_DIR, DD_AGENT_TEST_DIR, 'etc', 'conf.d')
TEMP_AGENT_CHECK_DIR = os.path.join(TMP_DIR, DD_AGENT_TEST_DIR)
Expand All @@ -164,11 +164,11 @@ def testDefaultChecks(self):

@mock.patch('config.get_checksd_path', return_value=TEMP_AGENT_CHECK_DIR)
@mock.patch('config.get_confd_path', return_value=TEMP_ETC_CONF_DIR)
@mock.patch('config.get_3rd_party_path', return_value=TEMP_3RD_PARTY_CHECKS_DIR)
@mock.patch('config.get_dd_integrations_path', return_value=TEMP_DD_INTEGRATIONS_CHECKS_DIR)
class TestConfigLoadCheckDirectory(unittest.TestCase):

TEMP_DIRS = [
'%s/test_check' % TEMP_3RD_PARTY_CHECKS_DIR,
'%s/test_check' % TEMP_DD_INTEGRATIONS_CHECKS_DIR,
TEMP_ETC_CHECKS_DIR, TEMP_ETC_CONF_DIR, TEMP_AGENT_CHECK_DIR
]

Expand Down Expand Up @@ -262,7 +262,7 @@ def testConfig3rdPartyAgent(self, *args):
copyfile('%s/valid_check_2.py' % FIXTURE_PATH,
'%s/test_check.py' % TEMP_AGENT_CHECK_DIR)
copyfile('%s/valid_check_1.py' % FIXTURE_PATH,
'%s/test_check/check.py' % TEMP_3RD_PARTY_CHECKS_DIR)
'%s/test_check/check.py' % TEMP_DD_INTEGRATIONS_CHECKS_DIR)
checks = load_check_directory({"additional_checksd": TEMP_ETC_CHECKS_DIR}, "foo")
self.assertEquals(1, len(checks['initialized_checks']))
self.assertEquals('valid_check_1', checks['initialized_checks'][0].check(None))
Expand All @@ -271,7 +271,7 @@ def testConfigETC3rdParty(self, *args):
copyfile('%s/valid_conf.yaml' % FIXTURE_PATH,
'%s/test_check.yaml' % TEMP_ETC_CONF_DIR)
copyfile('%s/valid_check_2.py' % FIXTURE_PATH,
'%s/test_check/check.py' % TEMP_3RD_PARTY_CHECKS_DIR)
'%s/test_check/check.py' % TEMP_DD_INTEGRATIONS_CHECKS_DIR)
copyfile('%s/valid_check_1.py' % FIXTURE_PATH,
'%s/test_check.py' % TEMP_ETC_CHECKS_DIR)
checks = load_check_directory({"additional_checksd": TEMP_ETC_CHECKS_DIR}, "foo")
Expand Down

0 comments on commit 03846f4

Please sign in to comment.