Corrects ECRClient.batch_get_image tag handling (#6230)
This commit is contained in:
parent
f1286506be
commit
ff48188362
@ -624,7 +624,7 @@ class ECRBackend(BaseBackend):
|
||||
"imageDigest" in image_id
|
||||
and image.get_image_digest() == image_id["imageDigest"]
|
||||
) or (
|
||||
"imageTag" in image_id and image.image_tag == image_id["imageTag"]
|
||||
"imageTag" in image_id and image_id["imageTag"] in image.image_tags
|
||||
):
|
||||
found = True
|
||||
response["images"].append(image.response_batch_get_image)
|
||||
|
@ -1065,6 +1065,37 @@ def test_batch_get_image_that_doesnt_exist():
|
||||
response["failures"][0]["imageId"]["imageTag"].should.equal("v5")
|
||||
|
||||
|
||||
@mock_ecr
|
||||
def test_batch_get_image_with_multiple_tags():
|
||||
client = boto3.client("ecr", region_name="us-east-1")
|
||||
_ = client.create_repository(repositoryName="test_repository")
|
||||
|
||||
manifest = json.dumps(_create_image_manifest())
|
||||
_ = client.put_image(
|
||||
repositoryName="test_repository",
|
||||
imageManifest=manifest,
|
||||
imageTag="latest",
|
||||
)
|
||||
|
||||
_ = client.put_image(
|
||||
repositoryName="test_repository",
|
||||
imageManifest=manifest,
|
||||
imageTag="v1",
|
||||
)
|
||||
|
||||
latest_response = client.batch_get_image(
|
||||
repositoryName="test_repository", imageIds=[{"imageTag": "latest"}]
|
||||
)
|
||||
|
||||
v1_response = client.batch_get_image(
|
||||
repositoryName="test_repository", imageIds=[{"imageTag": "v1"}]
|
||||
)
|
||||
|
||||
latest_response["images"][0]["imageManifest"].should.equal(
|
||||
v1_response["images"][0]["imageManifest"]
|
||||
)
|
||||
|
||||
|
||||
@mock_ecr
|
||||
def test_batch_delete_image_by_tag():
|
||||
client = boto3.client("ecr", region_name="us-east-1")
|
||||
|
Loading…
Reference in New Issue
Block a user