|
@@ -49,9 +49,10 @@ class TestAlerts(TestCase):
|
|
|
def test_start(self, aps_add_interval_job_mock, aps_start_mock):
|
|
|
test_file_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_stack_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
+ test_common_services_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_host_scripts_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
|
|
|
- ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_host_scripts_path)
|
|
|
+ ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_common_services_path, test_host_scripts_path)
|
|
|
ash.start()
|
|
|
|
|
|
self.assertTrue(aps_add_interval_job_mock.called)
|
|
@@ -212,6 +213,7 @@ class TestAlerts(TestCase):
|
|
|
|
|
|
# normally set by AlertSchedulerHandler
|
|
|
json['source']['stacks_directory'] = os.path.join('ambari_agent', 'dummy_files')
|
|
|
+ json['source']['common_services_directory'] = os.path.join('ambari_agent', 'common-services')
|
|
|
json['source']['host_scripts_directory'] = os.path.join('ambari_agent', 'host_scripts')
|
|
|
|
|
|
collector = AlertCollector()
|
|
@@ -219,6 +221,7 @@ class TestAlerts(TestCase):
|
|
|
sa.set_helpers(collector, {'foo-site/bar': 'rendered-bar', 'foo-site/baz':'rendered-baz'} )
|
|
|
self.assertEquals(json['source']['path'], sa.path)
|
|
|
self.assertEquals(json['source']['stacks_directory'], sa.stacks_dir)
|
|
|
+ self.assertEquals(json['source']['common_services_directory'], sa.common_services_dir)
|
|
|
self.assertEquals(json['source']['host_scripts_directory'], sa.host_scripts_dir)
|
|
|
|
|
|
sa.collect()
|
|
@@ -480,9 +483,10 @@ class TestAlerts(TestCase):
|
|
|
def test_reschedule(self):
|
|
|
test_file_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_stack_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
+ test_common_services_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_host_scripts_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
|
|
|
- ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_host_scripts_path)
|
|
|
+ ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_common_services_path, test_host_scripts_path)
|
|
|
ash.start()
|
|
|
|
|
|
self.assertEquals(1, ash.get_job_count())
|
|
@@ -535,9 +539,10 @@ class TestAlerts(TestCase):
|
|
|
def test_disabled_definitions(self):
|
|
|
test_file_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_stack_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
+ test_common_services_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_host_scripts_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
|
|
|
- ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_host_scripts_path)
|
|
|
+ ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_common_services_path, test_host_scripts_path)
|
|
|
ash.start()
|
|
|
|
|
|
self.assertEquals(1, ash.get_job_count())
|
|
@@ -587,9 +592,10 @@ class TestAlerts(TestCase):
|
|
|
def test_immediate_alert(self):
|
|
|
test_file_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_stack_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
+ test_common_services_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
test_host_scripts_path = os.path.join('ambari_agent', 'dummy_files')
|
|
|
|
|
|
- ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_host_scripts_path)
|
|
|
+ ash = AlertSchedulerHandler(test_file_path, test_stack_path, test_common_services_path, test_host_scripts_path)
|
|
|
ash.start()
|
|
|
|
|
|
self.assertEquals(1, ash.get_job_count())
|
|
@@ -646,6 +652,7 @@ class TestAlerts(TestCase):
|
|
|
|
|
|
# normally set by AlertSchedulerHandler
|
|
|
json['source']['stacks_directory'] = os.path.join('ambari_agent', 'dummy_files')
|
|
|
+ json['source']['common_services_directory'] = os.path.join('ambari_agent', 'common-services')
|
|
|
json['source']['host_scripts_directory'] = os.path.join('ambari_agent', 'host_scripts')
|
|
|
|
|
|
collector = AlertCollector()
|
|
@@ -656,6 +663,7 @@ class TestAlerts(TestCase):
|
|
|
|
|
|
self.assertEquals(json['source']['path'], sa.path)
|
|
|
self.assertEquals(json['source']['stacks_directory'], sa.stacks_dir)
|
|
|
+ self.assertEquals(json['source']['common_services_directory'], sa.common_services_dir)
|
|
|
self.assertEquals(json['source']['host_scripts_directory'], sa.host_scripts_dir)
|
|
|
|
|
|
# ensure that it was skipped
|