Ejemplo n.º 1
0
def test_compose_timeout_message():
    remaining_instances = {
        "cluster1": ["instance1", "instance2"],
        "cluster2": ["instance3"],
        "cluster3": [],
    }

    message = mark_for_deployment.compose_timeout_message(
        remaining_instances,
        1,
        "fake_group",
        "someservice",
        DeploymentVersion(sha="some_git_sha", image_version="extrastuff"),
    )
    assert ("  paasta status -c cluster1 -s someservice -i instance1,instance2"
            in message)
    assert "  paasta status -c cluster2 -s someservice -i instance3" in message
    assert (
        "  paasta logs -c cluster1 -s someservice -i instance1,instance2 -C deploy -l 1000"
        in message)
    assert (
        "  paasta logs -c cluster2 -s someservice -i instance3 -C deploy -l 1000"
        in message)
    assert (
        " paasta wait-for-deployment -s someservice -l fake_group -c some_git_sha --image-version extrastuff"
        in message)
def test_compose_timeout_message():
    clusters_data = []
    clusters_data.append(
        mark_for_deployment.ClusterData(cluster='cluster1',
                                        service='someservice',
                                        git_sha='somesha',
                                        instances_queue=Queue()))
    clusters_data[0].instances_queue.put('instance1')
    clusters_data[0].instances_queue.put('instance2')
    clusters_data.append(
        mark_for_deployment.ClusterData(cluster='cluster2',
                                        service='someservice',
                                        git_sha='somesha',
                                        instances_queue=Queue()))
    clusters_data[1].instances_queue.put('instance3')
    clusters_data.append(
        mark_for_deployment.ClusterData(cluster='cluster3',
                                        service='someservice',
                                        git_sha='somesha',
                                        instances_queue=Queue()))
    message = mark_for_deployment.compose_timeout_message(
        clusters_data, 1, 'fake_group', 'someservice', 'some_git_sha')
    assert '  paasta status -c cluster1 -s someservice -i instance1,instance2' in message
    assert '  paasta status -c cluster2 -s someservice -i instance3' in message
    assert '  paasta logs -c cluster1 -s someservice -i instance1,instance2 -C deploy -l 1000' in message
    assert '  paasta logs -c cluster2 -s someservice -i instance3 -C deploy -l 1000' in message
Ejemplo n.º 3
0
def test_compose_timeout_message():
    clusters_data = []
    clusters_data.append(
        mark_for_deployment.ClusterData(
            cluster="cluster1",
            service="someservice",
            git_sha="somesha",
            instances_queue=Queue(),
        ))
    clusters_data[0].instances_queue.put(
        mock_marathon_instance_config("instance1"))
    clusters_data[0].instances_queue.put(
        mock_marathon_instance_config("instance2"))
    clusters_data.append(
        mark_for_deployment.ClusterData(
            cluster="cluster2",
            service="someservice",
            git_sha="somesha",
            instances_queue=Queue(),
        ))
    clusters_data[1].instances_queue.put(
        mock_marathon_instance_config("instance3"))
    clusters_data.append(
        mark_for_deployment.ClusterData(
            cluster="cluster3",
            service="someservice",
            git_sha="somesha",
            instances_queue=Queue(),
        ))
    message = mark_for_deployment.compose_timeout_message(
        clusters_data, 1, "fake_group", "someservice", "some_git_sha")
    assert ("  paasta status -c cluster1 -s someservice -i instance1,instance2"
            in message)
    assert "  paasta status -c cluster2 -s someservice -i instance3" in message
    assert (
        "  paasta logs -c cluster1 -s someservice -i instance1,instance2 -C deploy -l 1000"
        in message)
    assert (
        "  paasta logs -c cluster2 -s someservice -i instance3 -C deploy -l 1000"
        in message)