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])
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)), [])
def fetch_marathon_app(args, app_id): response = marathon_get_request(args, "/v2/apps" + app_id) return cleanup_json(response.json())['app']
def list_marathon_apps(args): response = marathon_get_request(args, "/v2/apps") return cleanup_json(response.json())['apps']
def load_app_json(args): with open(args.json) as content_file: return cleanup_json(json.load(content_file))