예제 #1
0
def test_get_marathon_status(
    mock_load_marathon_config,
    mock_get_marathon_client,
):
    mock_load_marathon_config.return_value = MarathonConfig({
        'url':
        'fakeurl',
        'user':
        '******',
        'password':
        '******',
    })
    client = mock_get_marathon_client.return_value
    client.list_apps.return_value = ["MarathonApp::1", "MarathonApp::2"]
    client.list_deployments.return_value = [
        "MarathonDeployment::1",
    ]
    client.list_tasks.return_value = [
        "MarathonTask::1", "MarathonTask::2", "MarathonTask::3"
    ]
    expected_apps_output = ("marathon apps: 2", True)
    expected_deployment_output = ("marathon deployments: 1", True)
    expected_tasks_output = ("marathon tasks: 3", True)

    results = metastatus_lib.get_marathon_status(client)

    assert expected_apps_output in results
    assert expected_deployment_output in results
    assert expected_tasks_output in results
예제 #2
0
def test_get_marathon_client():
    fake_config = MarathonConfig({
        'url': 'fakeurl',
        'user': '******',
        'password': '******',
    })
    client = metastatus_lib.get_marathon_client(fake_config)
    assert client.servers == ['fakeurl']
    assert client.auth == ('fakeuser', 'fakepass')
예제 #3
0
def test_get_marathon_client():
    fake_config = MarathonConfig({
        'url': 'fakeurl',
        'user': '******',
        'password': '******',
    }, '/fake_config/fake_marathon.json')
    client = paasta_metastatus.get_marathon_client(fake_config)
    assert client.servers == ['fakeurl']
    assert client.auth == ('fakeuser', 'fakepass')