def test_dcos_log_v2_sse(mocked_dcos_log_enabled, mocked_http_get, mocked_get_config_val, mocked_follow_logs): mocked_dcos_log_enabled.return_value = True m = mock.MagicMock() m.status_code = 200 mocked_http_get.return_value = m mocked_get_config_val.return_value = 'http://127.0.0.1' main._dcos_log_v2(True, 20, False, 'mesos-id', None, []) mocked_follow_logs.assert_called_with( 'http://127.0.0.1/system/v1/agent/mesos-id/logs/v2/component?skip=-20')
def test_dcos_log_v2_leader_mesos(mocked_dcos_log_enabled, mocked_http_get, mocked_get_config_val): mocked_dcos_log_enabled.return_value = True m = mock.MagicMock() m.status_code = 200 mocked_http_get.return_value = m mocked_get_config_val.return_value = 'http://127.0.0.1' main._dcos_log_v2(False, 10, True, '', None, []) mocked_http_get.assert_called_with( 'http://127.0.0.1/system/v1/leader/mesos/logs/v2/component?skip=-10', headers={'Accept': 'text/plain'})
def test_dcos_log_v2_leader_marathon(mocked_dcos_log_enabled, mocked_http_get, mocked_get_config_val): mocked_dcos_log_enabled.return_value = True m = mock.MagicMock() m.status_code = 200 mocked_http_get.return_value = m mocked_get_config_val.return_value = 'http://127.0.0.1' main._dcos_log_v2(False, 10, True, '', 'dcos-marathon', []) mocked_http_get.assert_called_with( 'http://127.0.0.1/system/v1/leader/marathon/logs/v2/component/' 'dcos-marathon.service?skip=-10', headers={'Accept': 'text/plain'}, is_success=is_success)
def test_dcos_log_v2_filters(mocked_dcos_log_enabled, mocked_http_get, mocked_get_config_val, mocked_follow_logs): mocked_dcos_log_enabled.return_value = True m = mock.MagicMock() m.status_code = 200 mocked_http_get.return_value = m mocked_get_config_val.return_value = 'http://127.0.0.1' main._dcos_log_v2(True, 20, False, 'mesos-id', 'dcos-mesos-master', ['key1:value1', 'key2:value2']) mocked_follow_logs.assert_called_with( 'http://127.0.0.1/system/v1/agent/mesos-id/logs/v2/component/' 'dcos-mesos-master.service?skip=-20&filter=key1:value1&' 'filter=key2:value2')