How to use add_image_tag method in tempest

Best Python code snippet using tempest_python

test_images_rbac.py

Source:test_images_rbac.py Github

copy

Full Screen

...114 RBAC test for the glance add_image_tag endpoint115 """116 image = self._create_image()117 self.rbac_utils.switch_role(self, toggle_rbac_role=True)118 self.image_client.add_image_tag(119 image['id'],120 data_utils.rand_name(self.__class__.__name__ + '-tag'))121 @decorators.idempotent_id('c4a0bf9c-b78b-48c6-a31f-72c95f943c6e')122 @rbac_rule_validation.action(service="glance",123 rule="modify_image")124 def test_delete_image_tag(self):125 """Delete image tag126 RBAC test for the glance delete_image_tag endpoint127 """128 image = self._create_image()129 tag_name = data_utils.rand_name(self.__class__.__name__ + '-tag')130 self.image_client.add_image_tag(image['id'], tag_name)131 self.rbac_utils.switch_role(self, toggle_rbac_role=True)132 self.image_client.delete_image_tag(image['id'], tag_name)133 @rbac_rule_validation.action(service="glance",134 rule="publicize_image")135 @decorators.idempotent_id('0ea4809c-6461-11e6-ac4f-080027d0d606')136 def test_publicize_image(self):137 """Publicize Image Test138 RBAC test for the glance publicize_image endpoint139 """140 self.rbac_utils.switch_role(self, toggle_rbac_role=True)141 self._create_image(visibility='public')142 @decorators.idempotent_id('0f2d8427-134a-4d3c-a102-5fcdf5443d09')143 @rbac_rule_validation.action(service="glance",144 rule="communitize_image")...

Full Screen

Full Screen

convert.py

Source:convert.py Github

copy

Full Screen

...8 image: Optional[str]9 build: Optional[Build]10class ComposeYml(TypedDict):11 services: Dict[str, Service]12def add_image_tag(context_name: str, compose: ComposeYml) -> ComposeYml:13 for name, service in compose["services"].items():14 if not service.get("build"):15 continue16 image_tag = f"{context_name}_{name}:latest"17 if "image" not in service:18 service["image"] = image_tag19 return compose20def replace_image_tag_to_local(context_name: str, compose: ComposeYml) -> ComposeYml:21 for name, service in compose["services"].items():22 if not service.get("build"):23 continue24 image_tag = f"{context_name}_{name}:latest"25 service["image"] = f"localhost:5000/{image_tag}"26 return compose...

Full Screen

Full Screen

function.py

Source:function.py Github

copy

Full Screen

...18 logging.error("Unexpected error")19 raise error20 image_info = image_info_list["images"][0]21 return image_info22def add_image_tag(repo, manifest, digest):23 """Add 'vulnerable' tag prefix to image."""24 try:25 response = client.put_image(26 repositoryName=repo,27 imageManifest=manifest,28 imageTag="vulnerable-" + digest[7:],29 imageDigest=digest,30 )31 except ClientError as error:32 logging.error("Unexpected error")33 raise error34 LOGGER.info("Image tag 'vulnerable' added!")35 return response36def lambda_handler(event, _):37 """Lambda handler."""38 image = event["resources"][0]39 image_tags = event["detail"]["image-tags"]40 image_digest = event["detail"]["image-digest"]41 image_repository = event["detail"]["repository-name"]42 LOGGER.info(f"Image: {image} with tag(s) {image_tags} contains vulnerabilities.")43 image_info = get_image_info(image_repository, image_digest)44 response = add_image_tag(45 image_repository, image_info["imageManifest"], image_digest46 )47 return {48 "statusCode": response["ResponseMetadata"]["HTTPStatusCode"],...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful