def test_main( mock_get_instance_config, mock_send_sensu_event, mock_get_services_for_cluster, mock_load_system_paasta_config, mock_scribereader, scribereader_output, ): mock_scribereader.get_default_scribe_hosts.return_value = [{'host': '', 'port': ''}] mock_scribereader.get_stream_tailer.return_value = scribereader_output mock_get_services_for_cluster.return_value = [ ('fake_service1', 'fake_instance1'), ('fake_service2', 'fake_instance2'), ('fake_service3', 'fake_instance3'), ] main(['', '-s', 'some_superregion', '-d', 'soa_dir']) assert mock_send_sensu_event.call_count == 3
def test_main( mock_get_instance_config, mock_send_sensu_event, mock_get_services_for_cluster, mock_latest_oom_events, scribereader_output, ): mock_get_services_for_cluster.return_value = [ ("fake_service1", "fake_instance1"), ("fake_service2", "fake_instance2"), ("fake_service3", "fake_instance3"), ] main(["", "-s", "some_superregion", "-d", "soa_dir", "--check-interval", "3"]) assert mock_send_sensu_event.call_count == 3 mock_latest_oom_events.assert_called_once_with( cluster="fake_cluster", superregion="some_superregion", interval=180, )
def test_main( mock_get_instance_config, mock_send_sensu_event, mock_get_services_for_cluster, mock_load_system_paasta_config, mock_scribereader, scribereader_output, ): mock_scribereader.get_default_scribe_hosts.return_value = [{ "host": "", "port": "" }] mock_scribereader.get_stream_tailer.return_value = scribereader_output mock_get_services_for_cluster.return_value = [ ("fake_service1", "fake_instance1"), ("fake_service2", "fake_instance2"), ("fake_service3", "fake_instance3"), ] main(["", "-s", "some_superregion", "-d", "soa_dir"]) assert mock_send_sensu_event.call_count == 3