예제 #1
0
 def test_read_monitoring_config(self):
     fake_name = 'partial'
     fake_fname = 'acronyms'
     fake_path = 'ever_patched'
     fake_soa_dir = '/nail/cte/oas'
     fake_dict = {'e': 'quail', 'v': 'snail'}
     with contextlib.nested(
             mock.patch('os.path.abspath',
                        autospec=True,
                        return_value=fake_path),
             mock.patch('os.path.join',
                        autospec=True,
                        return_value=fake_fname),
             mock.patch('service_configuration_lib.read_monitoring',
                        autospec=True,
                        return_value=fake_dict)) as (abspath_patch,
                                                     join_patch,
                                                     read_monitoring_patch):
         actual = monitoring_tools.read_monitoring_config(
             fake_name, fake_soa_dir)
         assert fake_dict == actual
         abspath_patch.assert_called_once_with(fake_soa_dir)
         join_patch.assert_called_once_with(fake_path, fake_name,
                                            'monitoring.yaml')
         read_monitoring_patch.assert_called_once_with(fake_fname)
예제 #2
0
파일: tron_tools.py 프로젝트: Yelp/paasta
 def get_monitoring(self):
     srv_monitoring = dict(
         monitoring_tools.read_monitoring_config(self.service, soa_dir=self.soa_dir)
     )
     tron_monitoring = self.config_dict.get("monitoring", {})
     srv_monitoring.update(tron_monitoring)
     # filter out non-tron monitoring keys
     srv_monitoring = {
         k: v for k, v in srv_monitoring.items() if k in VALID_MONITORING_KEYS
     }
     return srv_monitoring
예제 #3
0
 def test_read_monitoring_config(self):
     fake_name = "partial"
     fake_fname = "acronyms"
     fake_path = "ever_patched"
     fake_soa_dir = "/nail/cte/oas"
     fake_dict = {"e": "quail", "v": "snail"}
     with mock.patch(
         "os.path.abspath", autospec=True, return_value=fake_path
     ) as abspath_patch, mock.patch(
         "os.path.join", autospec=True, return_value=fake_fname
     ) as join_patch, mock.patch(
         "service_configuration_lib.read_monitoring",
         autospec=True,
         return_value=fake_dict,
     ) as read_monitoring_patch:
         actual = monitoring_tools.read_monitoring_config(fake_name, fake_soa_dir)
         assert fake_dict == actual
         abspath_patch.assert_called_once_with(fake_soa_dir)
         join_patch.assert_called_once_with(fake_path, fake_name, "monitoring.yaml")
         read_monitoring_patch.assert_called_once_with(fake_fname)
예제 #4
0
 def test_read_monitoring_config(self):
     fake_name = 'partial'
     fake_fname = 'acronyms'
     fake_path = 'ever_patched'
     fake_soa_dir = '/nail/cte/oas'
     fake_dict = {'e': 'quail', 'v': 'snail'}
     with contextlib.nested(
         mock.patch('os.path.abspath', autospec=True, return_value=fake_path),
         mock.patch('os.path.join', autospec=True, return_value=fake_fname),
         mock.patch('service_configuration_lib.read_monitoring', autospec=True, return_value=fake_dict)
     ) as (
         abspath_patch,
         join_patch,
         read_monitoring_patch
     ):
         actual = monitoring_tools.read_monitoring_config(fake_name, fake_soa_dir)
         assert fake_dict == actual
         abspath_patch.assert_called_once_with(fake_soa_dir)
         join_patch.assert_called_once_with(fake_path, fake_name, 'monitoring.yaml')
         read_monitoring_patch.assert_called_once_with(fake_fname)