Ejemplo n.º 1
0
def install_framework():
    uninstall()
    shakedown.install_package_and_wait(PACKAGE_NAME)
    check_health()
    yield

    uninstall()
Ejemplo n.º 2
0
def install(additional_options={}):
    merged_options = _nested_dict_merge(DEFAULT_OPTIONS_DICT,
                                        additional_options)
    print('Installing {} with options: {}'.format(PACKAGE_NAME,
                                                  merged_options))
    shakedown.install_package_and_wait(PACKAGE_NAME,
                                       options_json=merged_options)
Ejemplo n.º 3
0
def test_install_marathon():
    """Install the Marathon package for DC/OS.
    """

    # Install
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(PACKAGE_NAME), 'Package failed to install'

    end_time = time.time() + WAIT_TIME_IN_SECS
    found = False
    while time.time() < end_time:
        found = shakedown.get_service(PACKAGE_NAME) is not None
        if found and shakedown.service_healthy(SERVICE_NAME):
            break
        time.sleep(1)

    assert found, 'Service did not register with DCOS'
    shakedown.deployment_wait()

    # Uninstall
    uninstall('marathon-user')
    shakedown.deployment_wait()

    # Reinstall
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(PACKAGE_NAME), 'Package failed to reinstall'
    #
    try:
        shakedown.install_package(PACKAGE_NAME)
    except Exception as e:
        pass
    else:
        # Exception is not raised -> exit code was 0
        assert False, "Error: CLI returns 0 when asked to install Marathon"
Ejemplo n.º 4
0
def test_install_marathon():
    """Install the Marathon package for DC/OS.
    """

    # Install
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(PACKAGE_NAME), 'Package failed to install'

    end_time = time.time() + WAIT_TIME_IN_SECS
    found = False
    while time.time() < end_time:
        found = shakedown.get_service(PACKAGE_NAME) is not None
        if found and shakedown.service_healthy(SERVICE_NAME):
            break
        time.sleep(1)

    assert found, 'Service did not register with DCOS'
    shakedown.deployment_wait()

    # Uninstall
    uninstall('marathon-user')
    shakedown.deployment_wait()

    # Reinstall
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(PACKAGE_NAME), 'Package failed to reinstall'
Ejemplo n.º 5
0
def test_install_marathon():
    """Install the Marathon package for DC/OS.
    """

    # Install
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(PACKAGE_NAME), 'Package failed to install'

    end_time = time.time() + WAIT_TIME_IN_SECS
    found = False
    while time.time() < end_time:
        found = shakedown.get_service(PACKAGE_NAME) is not None
        if found and shakedown.service_healthy(SERVICE_NAME):
            break
        time.sleep(1)

    assert found, 'Service did not register with DCOS'
    shakedown.deployment_wait()

    # Uninstall
    uninstall('marathon-user')
    shakedown.deployment_wait()

    # Reinstall
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(PACKAGE_NAME), 'Package failed to reinstall'
    #
    try:
        shakedown.install_package(PACKAGE_NAME)
    except Exception as e:
        pass
    else:
        # Exception is not raised -> exit code was 0
        assert False, "Error: CLI returns 0 when asked to install Marathon"
Ejemplo n.º 6
0
def install_framework():
    uninstall()
    shakedown.install_package_and_wait(PACKAGE_NAME)
    check_health()
    yield

    uninstall()
Ejemplo n.º 7
0
def test_install_chronos():
    """ installs the latest version of chronos
    """
    shakedown.install_package_and_wait('chronos')
    assert shakedown.package_installed('chronos'), 'Package failed to install'

    stdout, stderr, return_code = shakedown.run_dcos_command('package list')
    assert "chronos" in stdout

    uninstall()
def test_install_universe_package(package):
    """ Marathon is responsible for installing packages from the universe.
        This test confirms that several packages are installed into a healty state.
    """

    shakedown.install_package_and_wait(package)
    assert shakedown.package_installed(package), 'Package failed to install'

    common.deployment_wait(max_attempts=300)
    assert shakedown.service_healthy(package)
Ejemplo n.º 9
0
def test_install_universe_package(package):
    """ Marathon is responsible for installing packages from the universe.
        This test confirms that several packages are installed into a healty state.
    """

    shakedown.install_package_and_wait(package)
    assert shakedown.package_installed(package), 'Package failed to install'

    shakedown.deployment_wait(timeout=timedelta(minutes=5).total_seconds())
    assert shakedown.service_healthy(package)
Ejemplo n.º 10
0
def install(additional_options={}, package_version=None, wait=True):
    merged_options = _nested_dict_merge(DEFAULT_OPTIONS_DICT,
                                        additional_options)
    print('Installing {} with options: {} {}'.format(PACKAGE_NAME,
                                                     merged_options,
                                                     package_version))
    shakedown.install_package_and_wait(PACKAGE_NAME,
                                       package_version,
                                       options_json=merged_options,
                                       wait_for_completion=wait)
Ejemplo n.º 11
0
def test_install_universe_package(package):
    """ Marathon is responsible for installing packages from the universe.
        This test confirms that several packages are installed into a healty state.
    """

    shakedown.install_package_and_wait(package)
    assert shakedown.package_installed(package), 'Package failed to install'

    shakedown.deployment_wait(timeout=timedelta(minutes=5).total_seconds())
    assert shakedown.service_healthy(package)
Ejemplo n.º 12
0
def install(additional_options = {}, package_version = None, wait = True):
    print ('Default_options {} \n'.format(DEFAULT_OPTIONS_DICT))
    print ('Additional_options {} \n'.format(additional_options))
    merged_options = _merge_dictionary(DEFAULT_OPTIONS_DICT, additional_options)
    print ('Merged_options {} \n'.format(merged_options))
    print('Installing {} with options: {} {}'.format(PACKAGE_NAME, merged_options, package_version))
    shakedown.install_package_and_wait(
        PACKAGE_NAME,
        package_version,
        options_json=merged_options,
        wait_for_completion=wait)
Ejemplo n.º 13
0
def install(package_version=None):
    strict_mode = os.getenv('SECURITY', 'permissive')
    if strict_mode == 'strict':
        shakedown.install_package_and_wait(
            package_name=PACKAGE_NAME,
            package_version=package_version,
            options_file=os.path.dirname(
                os.path.abspath(inspect.getfile(inspect.currentframe()))) +
            "/strict.json")
    else:
        shakedown.install_package_and_wait(package_name=PACKAGE_NAME,
                                           package_version=package_version,
                                           options_file=None)
Ejemplo n.º 14
0
def setup_module(module):
    uninstall()

    if strict_mode == 'strict':
        shakedown.install_package_and_wait(
            package_name=PACKAGE_NAME,
            options_file=os.path.dirname(
                os.path.abspath(inspect.getfile(inspect.currentframe()))) +
            "/strict.json")
    else:
        shakedown.install_package_and_wait(package_name=PACKAGE_NAME,
                                           options_file=None)

    check_health()
Ejemplo n.º 15
0
def ensure_mom():
    if not is_mom_installed():
        # if there is an active deployment... wait for it.
        # it is possible that mom is currently in the process of being uninstalled
        # in which case it will not report as installed however install will fail
        # until the deployment is finished.
        shakedown.deployment_wait()

        try:
            shakedown.install_package_and_wait('marathon')
            shakedown.deployment_wait()
        except Exception:
            pass

        if not shakedown.wait_for_service_endpoint('marathon-user'):
            print('ERROR: Timeout waiting for endpoint')
Ejemplo n.º 16
0
def ensure_mom():
    if not is_mom_installed():
        # if there is an active deployment... wait for it.
        # it is possible that mom is currently in the process of being uninstalled
        # in which case it will not report as installed however install will fail
        # until the deployment is finished.
        shakedown.deployment_wait()

        try:
            shakedown.install_package_and_wait('marathon')
            shakedown.deployment_wait()
        except Exception:
            pass

        if not shakedown.wait_for_service_endpoint('marathon-user'):
            print('ERROR: Timeout waiting for endpoint')
Ejemplo n.º 17
0
def ensure_mom():
    if not is_mom_installed():
        # if there is an active deployment... wait for it.
        # it is possible that mom is currently in the process of being uninstalled
        # in which case it will not report as installed however install will fail
        # until the deployment is finished.
        deployment_wait()

        try:
            shakedown.install_package_and_wait('marathon')
            deployment_wait(service_id='/marathon-user')
        except Exception:
            logger.exception('Error while waiting for MoM to deploy')
            pass

        if not wait_for_service_endpoint('marathon-user', path="ping"):
            logger.error('Timeout waiting for endpoint')
def test_neo4j_universe_package_install(neo_package):
    """ Neo4j used to be 1 of the universe packages tested above, largely
        because there was a bug in marathon for a short period of time
        which was realized through neo4j.  However neo4j is so strongly different
        that we can't test it like the other services.  It is NOT a framework
        so framework health checks do not work with neo4j.
    """
    package = neo_package
    shakedown.install_package_and_wait(package)
    assert shakedown.package_installed(package), 'Package failed to install'

    shakedown.deployment_wait(timeout=timedelta(minutes=5).total_seconds())

    marathon_client = marathon.create_client()
    tasks = marathon_client.get_tasks('neo4j/core')

    for task in tasks:
        assert task['healthCheckResults'][0]['lastSuccess'] is not None
        assert task['healthCheckResults'][0]['consecutiveFailures'] == 0
def test_neo4j_universe_package_install(neo_package):
    """ Neo4j used to be 1 of the universe packages tested above, largely
        because there was a bug in marathon for a short period of time
        which was realized through neo4j.  However neo4j is so strongly different
        that we can't test it like the other services.  It is NOT a framework
        so framework health checks do not work with neo4j.
    """
    package = neo_package
    shakedown.install_package_and_wait(package)
    assert shakedown.package_installed(package), 'Package failed to install'

    shakedown.deployment_wait(timeout=timedelta(minutes=5).total_seconds())

    marathon_client = marathon.create_client()
    tasks = marathon_client.get_tasks('neo4j/core')

    for task in tasks:
        assert task['healthCheckResults'][0]['lastSuccess'] is not None
        assert task['healthCheckResults'][0]['consecutiveFailures'] == 0
Ejemplo n.º 20
0
def test_job():

    shakedown.install_package_and_wait('chronos')

    # 0 tasks
    tasks = shakedown.get_service('chronos')['completed_tasks']
    assert len(tasks) == 0

    if is_before_version("3.0"):
        url = shakedown.dcos_service_url('chronos/scheduler/jobs')
    else:
        url = shakedown.dcos_service_url('chronos/v1/scheduler/jobs')

    jobs = http.get(url).json()
    assert len(jobs) == 0

    # add a job
    if is_before_version("3.0"):
        url = shakedown.dcos_service_url('chronos/scheduler/iso8601')
    else:
        url = shakedown.dcos_service_url('chronos/v1/scheduler/iso8601')

    data = default_job()
    headers = {'Content-Type': 'application/json'}
    http.post(url, data=data, headers=headers)

    # give it a couple of seconds
    time.sleep(5)

    tasks = shakedown.get_service('chronos')['completed_tasks']
    assert len(tasks) > 0

    id = tasks[0]['id']
    status, out = shakedown.run_command_on_master('date')
    sdate = out[:10]
    stdout, stderr, return_code = shakedown.run_dcos_command(
        'task log --completed {}'.format(id))
    assert sdate in stdout
Ejemplo n.º 21
0
def test_install_marathon():
    """Install the Marathon package for DC/OS.
    """

    # Install
    @retrying.retry(wait_fixed=1000,
                    stop_max_attempt_number=30,
                    retry_on_exception=DCOSException)
    def install_marathon():
        shakedown.install_package_and_wait(PACKAGE_NAME)

    install_marathon()
    assert shakedown.package_installed(
        PACKAGE_NAME), 'Package failed to install'

    # 5000ms = 5 seconds, 5 seconds * 60 attempts = 300 seconds = WAIT_TIME_IN_SECS
    @retrying.retry(wait_fixed=5000,
                    stop_max_attempt_number=60,
                    retry_on_exception=DCOSException)
    def assert_service_registration(package, service):
        found = shakedown.get_service(package) is not None
        assert found and shakedown.service_healthy(
            service
        ), f"Service {package} did not register with DCOS"  # NOQA E999

    assert_service_registration(PACKAGE_NAME, SERVICE_NAME)
    shakedown.deployment_wait()

    # Uninstall
    uninstall('marathon-user')
    shakedown.deployment_wait()

    # Reinstall
    shakedown.install_package_and_wait(PACKAGE_NAME)
    assert shakedown.package_installed(
        PACKAGE_NAME), 'Package failed to reinstall'
Ejemplo n.º 22
0
def static_port_config():
    shakedown.install_package_and_wait(test_utils.PACKAGE_NAME,
                                       options_file=STATIC_PORT_OPTIONS_FILE)
Ejemplo n.º 23
0
def install(additional_options = {}):
    merged_options = _nested_dict_merge(DEFAULT_OPTIONS_DICT, additional_options)
    print('Installing {} with options: {}'.format(PACKAGE_NAME, merged_options))
    shakedown.install_package_and_wait(PACKAGE_NAME, options_json=merged_options)
Ejemplo n.º 24
0
 def install_marathon():
     shakedown.install_package_and_wait(PACKAGE_NAME)
Ejemplo n.º 25
0
def dynamic_port_config():
    shakedown.install_package_and_wait(test_utils.PACKAGE_NAME,
                                       options_file=DYNAMIC_PORT_OPTIONS_FILE)
    yield
    test_utils.uninstall()
Ejemplo n.º 26
0
def setup_module(module):
    uninstall()
    shakedown.install_package_and_wait(PACKAGE_NAME,
                                       options_file=DYNAMIC_PORT_OPTIONS_FILE)
    check_health()
Ejemplo n.º 27
0
def install(additional_options={}, package_version=None):
    merged_options = _nested_dict_merge(DEFAULT_OPTIONS_DICT, additional_options)
    print("Installing {} with options: {} {}".format(PACKAGE_NAME, merged_options, package_version))
    shakedown.install_package_and_wait(PACKAGE_NAME, package_version, options_json=merged_options)