Example #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()
Example #2
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_upgrade():
    test_repo_name, test_repo_url = get_test_repo_info()
    test_version = get_pkg_version()
    print('Found test version: {}'.format(test_version))
    remove_repo(test_repo_name, test_version)
    master_version = get_pkg_version()
    print('Found master version: {}'.format(master_version))

    print('Installing master version')
    install(package_version=master_version)
    check_health()
    infinity_commons.get_and_verify_plan(
        lambda p: p['status'] == infinity_commons.PlanState.COMPLETE.value)
    # TODO: write some data

    print('Upgrading to test version')
    destroy_service()
    add_repo(test_repo_name, test_repo_url, master_version)
    install(package_version=test_version)
    check_post_upgrade_health()
Example #6
0
def test_upgrade_downgrade():
    # Ensure both Universe and the test repo exist.
    if len(shakedown.get_package_repos()['repositories']) != 2:
        print('No cassandra test repo found.  Skipping test_upgrade_downgrade')
        return

    test_repo_name, test_repo_url = get_test_repo_info()
    test_version = get_pkg_version()
    print('Found test version: {}'.format(test_version))
    remove_repo(test_repo_name, test_version)
    master_version = get_pkg_version()
    print('Found master version: {}'.format(master_version))

    print('Installing master version')
    install(package_version=master_version)
    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

    # TODO: write some data

    print('Upgrading to test version')
    destroy_service()
    add_repo(test_repo_name, test_repo_url, master_version)
    install(package_version=test_version)
    check_post_version_change_health()

    print('Downgrading to master version')
    destroy_service()
    install(package_version=master_version)
    check_post_version_change_health()
def test_upgrade_downgrade():
    test_repo_name, test_repo_url = get_test_repo_info()
    test_version = get_pkg_version()
    print('Found test version: {}'.format(test_version))
    remove_repo(test_repo_name, test_version)
    master_version = get_pkg_version()
    print('Found master version: {}'.format(master_version))

    print('Installing master version')
    install(package_version = master_version)
    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

    # TODO: write some data

    print('Upgrading to test version')
    destroy_service()
    add_repo(test_repo_name, test_repo_url, master_version)
    install(package_version = test_version)
    check_post_version_change_health()

    print('Downgrading to master version')
    destroy_service()
    install(package_version = master_version)
    check_post_version_change_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()
Example #9
0
def setup_module():
    unset_ssl_verification()

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

    uninstall()
    install()
    check_health()
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()