@pytest.mark.skipif((not lb_enabled()), reason='Load Balancer disabled')
def test_ip_per_container_with_named_vip(dcos_api_session):
 (origin_app, test_uuid) = get_test_app_in_docker(ip_per_container=True)
 origin_app['container']['docker']['portMappings'][0]['labels'] = {'VIP_0': 'foo:6000'}
 origin_app['healthChecks'][0]['port'] = origin_app['container']['docker']['portMappings'][0]['containerPort']
 del origin_app['container']['docker']['portMappings'][0]['hostPort']
 del origin_app['healthChecks'][0]['portIndex']
 with dcos_api_session.marathon.deploy_and_cleanup(origin_app):
  (proxy_app, proxy_uuid) = get_test_app()
  with dcos_api_session.marathon.deploy_and_cleanup(proxy_app) as service_points:
   cmd = '/opt/mesosphere/bin/curl -s -f -m 5 http://foo.marathon.l4lb.thisdcos.directory:6000/ping'
   ensure_routable(cmd, service_points)()

@ pytest . mark . skipif ( ( not lb_enabled ( ) ) , reason = 'Load Balancer disabled' ) def test_ip_per_container_with_named_vip ( dcos_api_session ) : ( origin_app , test_uuid ) = get_test_app_in_docker ( ip_per_container = True ) origin_app [ 'container' ] [ 'docker' ] [ 'portMappings' ] [ 0 ] [ 'labels' ] = { 'VIP_0' : 'foo:6000' } origin_app [ 'healthChecks' ] [ 0 ] [ 'port' ] = origin_app [ 'container' ] [ 'docker' ] [ 'portMappings' ] [ 0 ] [ 'containerPort' ] del origin_app [ 'container' ] [ 'docker' ] [ 'portMappings' ] [ 0 ] [ 'hostPort' ] del origin_app [ 'healthChecks' ] [ 0 ] [ 'portIndex' ] with dcos_api_session . marathon . deploy_and_cleanup ( origin_app ) : ( proxy_app , proxy_uuid ) = get_test_app ( ) with dcos_api_session . marathon . deploy_and_cleanup ( proxy_app ) as service_points : cmd = '/opt/mesosphere/bin/curl -s -f -m 5 http://foo.marathon.l4lb.thisdcos.directory:6000/ping' ensure_routable ( cmd , service_points ) ( )
test if we are able to connect to a task with ip-per-container mode using named vip .