Exemplo n.º 1
0
 def test_ip_per_task_portMappings_null(self):
     app = {
         'ipAddress': {},
         'container': {
             'type': 'DOCKER',
             'docker': {
                 'network': 'USER',
                 'portMappings': None,
             },
         },
         'tasks': [{
             "id": "testtaskid",
             "ipAddresses": [{"ipAddress": "1.2.3.4"}]
         }],
         "portDefinitions": [
             {
                 'port': 10000,
             },
             {
                 'port': 10001,
             },
         ],
     }
     # Calling cleanup_json because all entrypoints to get_service_ports
     # also call cleanup_json, so None isn't expected at runtime
     self.assertEquals(self.assigner.get_service_ports(cleanup_json(app)),
                       [10000, 10001])
Exemplo n.º 2
0
 def test_ip_per_task_portMappings_null_marathon15(self):
     app = {
         'container': {
             'type': 'DOCKER',
             'docker': {
                 'image': 'nginx'
             },
             'portMappings': None
         },
         'networks': [
             {
                 'mode': 'container',
                 'name': 'dcos'
             }
         ],
         'tasks': [{
             "id": "testtaskid",
             "ipAddresses": [{"ipAddress": "1.2.3.4"}]
         }],
     }
     # Calling cleanup_json because all entrypoints to get_service_ports
     # also call cleanup_json, so None isn't expected at runtime
     self.assertEquals(self.assigner.get_service_ports(cleanup_json(app)),
                       [])
Exemplo n.º 3
0
def fetch_marathon_app(args, app_id):
    response = marathon_get_request(args, "/v2/apps" + app_id)
    return cleanup_json(response.json())['app']
Exemplo n.º 4
0
def list_marathon_apps(args):
    response = marathon_get_request(args, "/v2/apps")
    return cleanup_json(response.json())['apps']
Exemplo n.º 5
0
def load_app_json(args):
    with open(args.json) as content_file:
        return cleanup_json(json.load(content_file))
Exemplo n.º 6
0
def fetch_marathon_app(args, app_id):
    response = marathon_get_request(args, "/v2/apps" + app_id)
    return cleanup_json(response.json())['app']
Exemplo n.º 7
0
def list_marathon_apps(args):
    response = marathon_get_request(args, "/v2/apps")
    return cleanup_json(response.json())['apps']
Exemplo n.º 8
0
def load_app_json(args):
    with open(args.json) as content_file:
        return cleanup_json(json.load(content_file))