def test_no_volumes_key(self): """Updated definition preserves the lack of volumes key""" task_dfn = TestContainerDefinitionsUpdate.task_dfn_no_volumes_key ret_val = run(task_dfn, 'container=sleep,image=busybox', '') updated_obj = json.loads(ret_val) self.validate_container_definitions(updated_obj) self.assertIsNone(updated_obj[0].get('volumes')) self.validate_no_change_made(task_dfn, updated_obj)
def test_empty_requires_compatibilities_key(self): """Updated definition preserves the empty requiresCompatibilities""" task_dfn = TestContainerDefinitionsUpdate.task_dfn_empty_requires_compatibilities ret_val = run(task_dfn, '', '') updated_obj = json.loads(ret_val) self.validate_container_definitions(updated_obj) self.assertEqual(len(updated_obj[0]['requiresCompatibilities']), 0) self.validate_no_change_made(task_dfn, updated_obj)
def test_empty_placement_constraints_key(self): """Updated definition preserves the empty placementConstraints""" task_dfn = TestContainerDefinitionsUpdate.task_dfn_empty_placement_constraints ret_val = run(task_dfn, '', '') updated_obj = json.loads(ret_val) self.validate_container_definitions(updated_obj) self.assertEqual(len(updated_obj[0]['placementConstraints']), 0) self.validate_no_change_made(task_dfn, updated_obj)
def test_no_requires_compatibilities_key(self): """Updated definition preserves the lack of requiresCompatibilities key""" task_dfn = TestContainerDefinitionsUpdate.task_dfn_no_placement_constraints_key ret_val = run(task_dfn, '', '') updated_obj = json.loads(ret_val) self.validate_container_definitions(updated_obj) self.assertIsNone(updated_obj[0].get('requiresCompatibilities')) self.validate_no_change_made(task_dfn, updated_obj)
def _test_image_update(self, task_dfn, image_update_param, ev_update_param, updated_containers, expected_image_names, expected_diff): """Image names are correctly updated""" ret_val = run(task_dfn, image_update_param, ev_update_param) updated_obj = json.loads(ret_val) self.validate_container_definitions(updated_obj) for i, v in enumerate(expected_image_names): self.assertEqual(self.get_container_definition( updated_containers[i], updated_obj)['image'], expected_image_names[i]) self.assertEqual(self.get_diff( task_dfn, updated_obj, True), expected_diff)