当前位置: 首页>>代码示例>>Python>>正文


Python test_helpers.marathon_test_app函数代码示例

本文整理汇总了Python中test_helpers.marathon_test_app函数的典型用法代码示例。如果您正苦于以下问题:Python marathon_test_app函数的具体用法?Python marathon_test_app怎么用?Python marathon_test_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了marathon_test_app函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, container, network, host, vip=None, ipv6=False):
     self._network = network
     self._container = container
     if network in [marathon.Network.HOST, marathon.Network.BRIDGE]:
         # both of these cases will rely on marathon to assign ports
         self.app, self.uuid = test_helpers.marathon_test_app(
             network=network,
             host_constraint=host,
             vip=vip,
             container_type=container,
             healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP)
     elif network == marathon.Network.USER:
         self.app, self.uuid = test_helpers.marathon_test_app(
             network=marathon.Network.USER,
             network_name='dcos6' if ipv6 else 'dcos',
             host_port=unused_port(),
             host_constraint=host,
             vip=vip,
             container_type=container,
             healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP)
         if vip is not None and container == marathon.Container.DOCKER:
             del self.app['container']['docker']['portMappings'][0]['hostPort']
     # allow this app to run on public slaves
     self.app['acceptedResourceRoles'] = ['*', 'slave_public']
     self.id = self.app['id']
开发者ID:branden,项目名称:dcos,代码行数:25,代码来源:test_networking.py

示例2: test_service_discovery_docker_overlay

def test_service_discovery_docker_overlay(dcos_api_session):
    app_definition, test_uuid = test_helpers.marathon_test_app(
        container_type=marathon.Container.DOCKER,
        network=marathon.Network.USER,
        host_port=9080)
    del app_definition['container']['docker']['portMappings'][0]['hostPort']
    assert_service_discovery(dcos_api_session, app_definition, [DNSOverlay])
开发者ID:branden,项目名称:dcos,代码行数:7,代码来源:test_service_discovery.py

示例3: octarine_runner

def octarine_runner(dcos_api_session, mode, uuid, uri, bind_port=None):
    log.info("Running octarine(mode={}, uuid={}, uri={}".format(mode, uuid, uri))

    octarine = "/opt/mesosphere/bin/octarine"

    bind_port_str = ""
    if bind_port is not None:
        bind_port_str = "-bindPort {}".format(bind_port)

    server_cmd = "{} -mode {} {} {}".format(octarine, mode, bind_port_str, uuid)
    log.info("Server: {}".format(server_cmd))

    proxy = ('http://127.0.0.1:$({} --client --port {})'.format(octarine, uuid))
    curl_cmd = '''"$(curl --fail --proxy {} {})"'''.format(proxy, uri)
    expected_output = '''"$(printf "{\\n    \\"pong\\": true\\n}")"'''
    check_cmd = """sh -c '[ {} = {} ]'""".format(curl_cmd, expected_output)
    log.info("Check: {}".format(check_cmd))

    app, uuid = test_helpers.marathon_test_app()
    app['requirePorts'] = True
    app['cmd'] = server_cmd
    app['healthChecks'] = [{
        "protocol": "COMMAND",
        "command": {"value": check_cmd},
        'gracePeriodSeconds': 5,
        'intervalSeconds': 10,
        'timeoutSeconds': 10,
        'maxConsecutiveFailures': 30
    }]

    with dcos_api_session.marathon.deploy_and_cleanup(app):
        pass
开发者ID:kensipe,项目名称:dcos,代码行数:32,代码来源:test_applications.py

示例4: test_service_discovery_docker_overlay_port_mapping

def test_service_discovery_docker_overlay_port_mapping(dcos_api_session):
    app_definition, test_uuid = test_helpers.marathon_test_app(
        container_type=marathon.Container.DOCKER,
        healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP,
        network=marathon.Network.USER,
        host_port=9080)
    assert_service_discovery(dcos_api_session, app_definition, [DNSOverlay, DNSPortMap])
开发者ID:dcos,项目名称:dcos,代码行数:7,代码来源:test_service_discovery.py

示例5: test_service_discovery_mesos_overlay

def test_service_discovery_mesos_overlay(dcos_api_session):
    app_definition, test_uuid = test_helpers.marathon_test_app(
        container_type=marathon.Container.MESOS,
        healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP,
        network=marathon.Network.USER)

    assert_service_discovery(dcos_api_session, app_definition, [DNSOverlay])
开发者ID:dcos,项目名称:dcos,代码行数:7,代码来源:test_service_discovery.py

示例6: test_service_discovery_docker_bridge

def test_service_discovery_docker_bridge(dcos_api_session):
    app_definition, test_uuid = test_helpers.marathon_test_app(
        container_type=marathon.Container.DOCKER,
        network=marathon.Network.BRIDGE,
        container_port=2020,
        host_port=9080)
    assert_service_discovery(dcos_api_session, app_definition, [DNSPortMap])
开发者ID:branden,项目名称:dcos,代码行数:7,代码来源:test_service_discovery.py

示例7: vip_app

def vip_app(container: marathon.Container, network: marathon.Network, host: str, vip: str):
    # user_net_port is only actually used for USER network because this cannot be assigned
    # by marathon
    if network in [marathon.Network.HOST, marathon.Network.BRIDGE]:
        # both of these cases will rely on marathon to assign ports
        return test_helpers.marathon_test_app(
            network=network,
            host_constraint=host,
            vip=vip,
            container_type=container)
    elif network == marathon.Network.USER:
        return test_helpers.marathon_test_app(
            network=network,
            host_port=unused_port(marathon.Network.USER),
            host_constraint=host,
            vip=vip,
            container_type=container)
    else:
        raise AssertionError('Unexpected network: {}'.format(network.value))
开发者ID:hatred,项目名称:dcos,代码行数:19,代码来源:test_networking.py

示例8: test_dcos_diagnostics_bundle_create_download_delete

def test_dcos_diagnostics_bundle_create_download_delete(dcos_api_session):
    """
    test bundle create, read, delete workflow
    """
    app, test_uuid = test_helpers.marathon_test_app()
    with dcos_api_session.marathon.deploy_and_cleanup(app):
        bundle = _create_bundle(dcos_api_session)
        _check_diagnostics_bundle_status(dcos_api_session)
        _download_and_extract_bundle(dcos_api_session, bundle)
        _download_and_extract_bundle_from_another_master(dcos_api_session, bundle)
        _delete_bundle(dcos_api_session, bundle)
开发者ID:dcos,项目名称:dcos,代码行数:11,代码来源:test_dcos_diagnostics.py

示例9: test_if_ucr_app_can_be_deployed

def test_if_ucr_app_can_be_deployed(dcos_api_session, healthcheck):
    """Marathon app inside ucr deployment integration test.

    Verifies that a marathon docker app inside of a ucr container can be
    deployed and accessed as expected.
    """
    deploy_test_app_and_check(
        dcos_api_session,
        *test_helpers.marathon_test_app(
            container_type=marathon.Container.MESOS,
            healthcheck_protocol=healthcheck))
开发者ID:kensipe,项目名称:dcos,代码行数:11,代码来源:test_applications.py

示例10: test_files_api

def test_files_api(dcos_api_session):
    app, test_uuid = test_helpers.marathon_test_app()

    with dcos_api_session.marathon.deploy_and_cleanup(app):
        marathon_framework_id = dcos_api_session.marathon.get('/v2/info').json()['frameworkId']
        app_task = dcos_api_session.marathon.get('/v2/apps/{}/tasks'.format(app['id'])).json()['tasks'][0]

        for required_sandbox_file in ('stdout', 'stderr'):
            content = dcos_api_session.mesos_sandbox_file(
                app_task['slaveId'], marathon_framework_id, app_task['id'], required_sandbox_file)

            assert content, 'File {} should not be empty'.format(required_sandbox_file)
开发者ID:bernadinm,项目名称:dcos,代码行数:12,代码来源:test_mesos.py

示例11: test_if_docker_app_can_be_deployed

def test_if_docker_app_can_be_deployed(dcos_api_session):
    """Marathon app inside docker deployment integration test.

    Verifies that a marathon app inside of a docker daemon container can be
    deployed and accessed as expected.
    """
    deploy_test_app_and_check(
        dcos_api_session,
        *test_helpers.marathon_test_app(
            network=marathon.Network.BRIDGE,
            container_type=marathon.Container.DOCKER,
            container_port=9080))
开发者ID:kensipe,项目名称:dcos,代码行数:12,代码来源:test_applications.py

示例12: test_l4lb

def test_l4lb(dcos_api_session):
    '''Test l4lb is load balancing between all the backends
       * create 5 apps using the same VIP
       * get uuid from the VIP in parallel from many threads
       * verify that 5 uuids have been returned
       * only testing if all 5 are hit at least once
    '''
    if not lb_enabled():
        pytest.skip('Load Balancer disabled')
    numapps = 5
    numthreads = numapps * 4
    apps = []
    rvs = deque()
    backends = []
    dnsname = 'l4lbtest.marathon.l4lb.thisdcos.directory:5000'
    with contextlib.ExitStack() as stack:
        for _ in range(numapps):
            origin_app, origin_uuid = \
                test_helpers.marathon_test_app(
                    healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP)
            # same vip for all the apps
            origin_app['portDefinitions'][0]['labels'] = {'VIP_0': '/l4lbtest:5000'}
            apps.append(origin_app)
            stack.enter_context(dcos_api_session.marathon.deploy_and_cleanup(origin_app))
            sp = dcos_api_session.marathon.get_app_service_endpoints(origin_app['id'])
            backends.append({'port': sp[0].port, 'ip': sp[0].host})
            # make sure that the service point responds
            geturl('http://{}:{}/ping'.format(sp[0].host, sp[0].port))
            # make sure that the VIP is responding too
            geturl('http://{}/ping'.format(dnsname))
        vips = geturl("http://localhost:62080/v1/vips")
        [vip] = [vip for vip in vips if vip['vip'] == dnsname and vip['protocol'] == 'tcp']
        for backend in vip['backend']:
            backends.remove(backend)
        assert backends == []

        # do many requests in parallel.
        def thread_request():
            # deque is thread safe
            rvs.append(geturl('http://l4lbtest.marathon.l4lb.thisdcos.directory:5000/test_uuid'))

        threads = [threading.Thread(target=thread_request) for i in range(0, numthreads)]
        for t in threads:
            t.start()
        for t in threads:
            t.join()

    expected_uuids = [a['id'].split('-')[2] for a in apps]
    received_uuids = [r['test_uuid'] for r in rvs if r is not None]
    assert len(set(expected_uuids)) == numapps
    assert len(set(received_uuids)) == numapps
    assert set(expected_uuids) == set(received_uuids)
开发者ID:dcos,项目名称:dcos,代码行数:52,代码来源:test_networking.py

示例13: __init__

 def __init__(self, container, network, host, vip=None):
     self._network = network
     self._container = container
     if network in [marathon.Network.HOST, marathon.Network.BRIDGE]:
         # both of these cases will rely on marathon to assign ports
         self.app, self.uuid = test_helpers.marathon_test_app(
             network=network,
             host_constraint=host,
             vip=vip,
             container_type=container,
             healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP)
     elif network == marathon.Network.USER:
         self.app, self.uuid = test_helpers.marathon_test_app(
             network=network,
             host_port=unused_port(),
             host_constraint=host,
             vip=vip,
             container_type=container,
             healthcheck_protocol=marathon.Healthcheck.MESOS_HTTP)
     # allow this app to run on public slaves
     self.app['acceptedResourceRoles'] = ['*', 'slave_public']
     self.id = self.app['id']
开发者ID:mjkam,项目名称:dcos,代码行数:22,代码来源:test_networking.py

示例14: test_if_marathon_app_can_be_deployed

def test_if_marathon_app_can_be_deployed(dcos_api_session):
    """Marathon app deployment integration test

    This test verifies that marathon app can be deployed, and that service points
    returned by Marathon indeed point to the app that was deployed.

    The application being deployed is a simple http server written in python.
    Please test_server.py for more details.

    This is done by assigning an unique UUID to each app and passing it to the
    docker container as an env variable. After successful deployment, the
    "GET /test_uuid" request is issued to the app. If the returned UUID matches
    the one assigned to test - test succeeds.
    """
    deploy_test_app_and_check(dcos_api_session, *test_helpers.marathon_test_app())
开发者ID:kensipe,项目名称:dcos,代码行数:15,代码来源:test_applications.py

示例15: test_if_marathon_app_can_be_deployed_with_mesos_containerizer

def test_if_marathon_app_can_be_deployed_with_mesos_containerizer(dcos_api_session):
    """Marathon app deployment integration test using the Mesos Containerizer

    This test verifies that a Marathon app using the Mesos containerizer with
    a Docker image can be deployed.

    This is done by assigning an unique UUID to each app and passing it to the
    docker container as an env variable. After successfull deployment, the
    "GET /test_uuid" request is issued to the app. If the returned UUID matches
    the one assigned to test - test succeds.

    When port mapping is available (MESOS-4777), this test should be updated to
    reflect that.
    """
    deploy_test_app_and_check(
        dcos_api_session,
        *test_helpers.marathon_test_app(container_type=marathon.Container.MESOS))
开发者ID:kensipe,项目名称:dcos,代码行数:17,代码来源:test_applications.py


注:本文中的test_helpers.marathon_test_app函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。