def test_install_marathon(): """Install the Marathon package for DC/OS. """ # Install install_package_and_wait(PACKAGE_NAME) assert package_installed(PACKAGE_NAME), 'Package failed to install' end_time = time.time() + WAIT_TIME_IN_SECS found = False while time.time() < end_time: found = get_service(PACKAGE_NAME) is not None if found and service_healthy(SERVICE_NAME): break time.sleep(1) assert found, 'Service did not register with DCOS' deployment_wait() # Uninstall cosmos = cosmospackage.Cosmos(get_cosmos_url()) uninstall('marathon-user') deployment_wait() # Reinstall install_package_and_wait(PACKAGE_NAME) assert package_installed(PACKAGE_NAME), 'Package failed to reinstall' # try: 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"
def test_custom_service_name(): cosmos = cosmospackage.Cosmos(get_cosmos_url()) pkg = cosmos.get_package_version('marathon', None) options = {'service': {'name': "test-marathon"}} install_package('marathon', options_json=options) deployment_wait() assert wait_for_service_endpoint('test-marathon')
def _get_cosmos(): """ Get an instance of Cosmos with the correct URL. :return: Cosmos instance :rtype: cosmospackage.Cosmos """ return cosmospackage.Cosmos(get_cosmos_url())
def test_custom_service_name(): cosmos = cosmospackage.Cosmos(get_cosmos_url()) pkg = cosmos.get_package_version('marathon', None) options = { 'service': {'name': "test-marathon"} } install_package('marathon', options_json=options) deployment_wait() assert wait_for_service_endpoint('test-marathon')
def _check_capability(): """ The function checks if cluster has metronome capability. :raises: DCOSException if cluster does not have metronome capability """ cosmos = cosmospackage.Cosmos(get_cosmos_url()) if not cosmos.has_capability('METRONOME'): raise DCOSException( 'DC/OS backend does not support metronome capabilities in this ' 'version. Must be DC/OS >= 1.8')
def uninstall(service, package=PACKAGE_NAME): try: task = get_service_task(package, service) if task is not None: cosmos = cosmospackage.Cosmos(get_cosmos_url()) cosmos.uninstall_app(package, True, service) deployment_wait() assert wait_for_service_endpoint_removal('test-marathon') delete_zk_node('/universe/{}'.format(service)) except Exception as e: pass
def _check_3dt_version(): """ The function checks if cluster has diagnostics capability. :raises: DCOSException if cluster does not have diagnostics capability """ cosmos = cosmospackage.Cosmos(get_cosmos_url()) if not cosmos.has_capability('SUPPORT_CLUSTER_REPORT'): raise DCOSException( 'DC/OS backend does not support diagnostics capabilities in this ' 'version. Must be DC/OS >= 1.8')
def test_custom_service_name(): cosmos = cosmospackage.Cosmos(get_cosmos_url()) pkg = cosmos.get_package_version('marathon', None) options = { 'service': {'name': "test-marathon"} } uninstall('test-marathon') deployment_wait() assert wait_for_service_url('test-marathon') cosmos.uninstall_app('marathon', True, 'test-marathon') deployment_wait() assert wait_for_service_url_removal('test-marathon')