def test_ip_per_container(dcos_api_session):
 (app_definition, test_uuid) = get_test_app_in_docker(ip_per_container=True)
 assert (len(dcos_api_session.slaves) >= 2), 'IP Per Container tests require 2 private agents to work'
 app_definition['instances'] = 2
 app_definition['constraints'] = [['hostname', 'UNIQUE']]
 with dcos_api_session.marathon.deploy_and_cleanup(app_definition, check_health=True) as service_points:
  app_port = app_definition['container']['docker']['portMappings'][0]['containerPort']
  cmd = '/opt/mesosphere/bin/curl -s -f -m 5 http://{}:{}/ping'.format(service_points[1].ip, app_port)
  ensure_routable(cmd, service_points)()

def test_ip_per_container ( dcos_api_session ) : ( app_definition , test_uuid ) = get_test_app_in_docker ( ip_per_container = True ) assert ( len ( dcos_api_session . slaves ) >= 2 ) , 'IP Per Container tests require 2 private agents to work' app_definition [ 'instances' ] = 2 app_definition [ 'constraints' ] = [ [ 'hostname' , 'UNIQUE' ] ] with dcos_api_session . marathon . deploy_and_cleanup ( app_definition , check_health = True ) as service_points : app_port = app_definition [ 'container' ] [ 'docker' ] [ 'portMappings' ] [ 0 ] [ 'containerPort' ] cmd = '/opt/mesosphere/bin/curl -s -f -m 5 http://{}:{}/ping' . format ( service_points [ 1 ] . ip , app_port ) ensure_routable ( cmd , service_points ) ( )
test if we are able to connect to a task with ip-per-container mode .