Esempio n. 1
0
def test_nodes_increase_by_one():
    completed_plan = infinity_commons.get_and_verify_plan(
        lambda p: p['status'] == infinity_commons.PlanState.COMPLETE.value
    )
    mc = dcos.marathon.create_client()
    app = mc.get_app('/cassandra')
    app = infinity_commons.strip_meta(app)
    oe = app['env']
    env_node_count = int(oe['NODES']) + 1
    oe['NODES'] = str(env_node_count)
    app['env'] = oe
    print("Updated node count: {}".format(app['env']['NODES']))
    print(mc.update_app(app_id='/cassandra', payload=app, force=True))
    check_health()
    plan = infinity_commons.get_and_verify_plan(
        lambda p: (
            p['status'] == infinity_commons.PlanState.COMPLETE.value and
            len(infinity_commons.filter_phase(p, "Deploy")['steps']) == 4 and
            (
                infinity_commons.filter_phase(p, "Deploy")['steps'][env_node_count - 1]['status'] ==
                infinity_commons.PlanState.COMPLETE.value
            )
        )
    )
    print(plan)
    assert plan['status'] == infinity_commons.PlanState.COMPLETE.value
    # reinstall after increase:
    uninstall()
    install()
    check_health()
Esempio n. 2
0
def install_framework():
    uninstall()
    shakedown.install_package_and_wait(PACKAGE_NAME)
    check_health()
    yield

    uninstall()
def install_framework():
    uninstall()
    shakedown.install_package_and_wait(PACKAGE_NAME)
    check_health()
    yield

    uninstall()
Esempio n. 4
0
def test_marathon_max_one_per_hostname():
    install(additional_options={
        'service': {
            'placement_constraint': 'hostname:MAX_PER:1'
        }
    })
    check_health()
    plan = infinity_commons.get_and_verify_plan(
        lambda p: p['status'] == infinity_commons.PlanState.COMPLETE.value)
    assert plan['status'] == infinity_commons.PlanState.COMPLETE.value
    uninstall()
def test_marathon_rack_not_found():
    install(additional_options={"service": {"placement_constraint": "rack_id:LIKE:rack-foo-.*"}})
    try:
        check_health(wait_time=60)  # long enough for /plan to work and for a node to have been IN_PROGRESS
        assert False, "Should have failed healthcheck"
    except:
        pass  # expected to fail, just wanting to wait 30s
    plan = dcos.http.get(cassandra_api_url("plan"), is_success=allow_incomplete_plan).json()
    # check that first node is still (unsuccessfully) looking for a match:
    assert plan["status"] == infinity_commons.PlanState.IN_PROGRESS.value
    assert infinity_commons.filter_phase(plan, "Deploy")["steps"][0]["status"] == "PENDING"
    uninstall()
def test_nodes_increase_by_one():
    completed_plan = infinity_commons.get_and_verify_plan(lambda p: p['status'] == infinity_commons.PlanState.COMPLETE.value)
    mc = dcos.marathon.create_client()
    app = mc.get_app('/cassandra')
    app = infinity_commons.strip_meta(app)
    oe = app['env']
    env_node_count = int(oe['NODES']) + 1
    oe['NODES'] = str(env_node_count)
    app['env'] = oe
    print("Updated node count: {}".format(app['env']['NODES']))
    print(mc.update_app(app_id='/cassandra', payload=app, force=True))
    check_health()
    plan = infinity_commons.get_and_verify_plan(lambda p: p['status'] == infinity_commons.PlanState.COMPLETE.value and len(infinity_commons.filter_phase(p, "Deploy")['steps']) == 4 and infinity_commons.filter_phase(p, "Deploy")['steps'][env_node_count - 1]['status'] == infinity_commons.PlanState.COMPLETE.value)
    print(plan)
    assert plan['status'] == infinity_commons.PlanState.COMPLETE.value
    # reinstall after increase:
    uninstall()
    install()
    check_health()
def test_marathon_rack_not_found():
    # install without waiting, since the install should never succeed and a timeout would result in an
    # assertion failure
    install(additional_options={
        'service': {
            'placement_constraint': 'rack_id:LIKE:rack-foo-.*'
        }
    },
            wait=False)
    try:
        check_health(
            wait_time=60
        )  # long enough for /plan to work and for a node to have been IN_PROGRESS
        assert False, "Should have failed healthcheck"
    except:
        pass  # expected to fail, just wanting to wait 30s
    plan = dcos.http.get(cassandra_api_url('plan'),
                         is_success=allow_incomplete_plan).json()
    # check that first node is still (unsuccessfully) looking for a match:
    assert plan['status'] == infinity_commons.PlanState.IN_PROGRESS.value
    assert infinity_commons.filter_phase(
        plan, "Deploy")['steps'][0]['status'] == 'PENDING'
    uninstall()
Esempio n. 8
0
def teardown_module(module):
    uninstall()
Esempio n. 9
0
def setup_module(module):
    uninstall()
Esempio n. 10
0
def setup_module():
    unset_ssl_verification()

    uninstall()
    install()
    check_health()
def teardown_module():
    uninstall()
def setup_module():
    unset_ssl_verification()

    uninstall()
    install()
    check_health()
def setup_module(module):
    uninstall()
def test_marathon_max_one_per_hostname():
    install(additional_options={"service": {"placement_constraint": "hostname:MAX_PER:1"}})
    check_health()
    plan = infinity_commons.get_and_verify_plan(lambda p: p["status"] == infinity_commons.PlanState.COMPLETE.value)
    assert plan["status"] == infinity_commons.PlanState.COMPLETE.value
    uninstall()