Skip to content

Commit

Permalink
fix(integ): Fix Invalid image tag errors (aws#3163)
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob Fuss <[email protected]>
  • Loading branch information
jfuss and jfuss authored Aug 11, 2021
1 parent a77d9e0 commit 16b8b4f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions tests/integration/deploy/test_deploy_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def setUpClass(cls):
# setup some images locally by pulling them.
for repo, tag in cls.local_images:
cls.docker_client.api.pull(repository=repo, tag=tag)
cls.docker_client.api.tag(f"{repo}:{tag}", "emulation-python3.8", tag="latest")

# setup signing profile arn & name
cls.signing_profile_name = os.environ.get("AWS_SIGNING_PROFILE_NAME")
cls.signing_profile_version_arn = os.environ.get("AWS_SIGNING_PROFILE_VERSION_ARN")
Expand Down
11 changes: 5 additions & 6 deletions tests/integration/package/test_package_command_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def setUpClass(cls):
# setup some images locally by pulling them.
for repo, tag in cls.local_images:
cls.docker_client.api.pull(repository=repo, tag=tag)
cls.docker_client.api.tag(f"{repo}:{tag}", "emulation-python3.8", tag="latest")
cls.docker_client.api.tag(f"{repo}:{tag}", "emulation-python3.8-2", tag="latest")

super(TestPackageImage, cls).setUpClass()

def setUp(self):
Expand Down Expand Up @@ -200,14 +203,10 @@ def test_package_with_deep_nested_template_image(self):
raise
process_stderr = stderr.strip().decode("utf-8")

# there are in total 3 function images and 2 child template file to upload
# verify both child templates are uploaded
uploads = re.findall(r"\.template", process_stderr)
self.assertEqual(len(uploads), 2)

# verify all function images are pushed
images = [
("public.ecr.aws/sam/emulation-python3.8", "latest"),
("emulation-python3.8", "latest"),
("emulation-python3.8-2", "latest"),
]
for image, tag in images:
# check string like this:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resources:
Type: AWS::Lambda::Function
Properties:
PackageType: Image
Code: public.ecr.aws/sam/emulation-python3.8:latest
Code: "emulation-python3.8:latest"
Role:
Fn::GetAtt:
- "LambdaExecutionRole"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resources:
Type: AWS::Lambda::Function
Properties:
PackageType: Image
Code: public.ecr.aws/sam/emulation-python3.8:latest
Code: emulation-python3.8:latest
Role:
Fn::GetAtt:
- "LambdaExecutionRole"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageUri: public.ecr.aws/sam/emulation-python3.8:latest
ImageUri: emulation-python3.8:latest
Events:
HelloWorld:
Type: Api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Resources:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageUri: public.ecr.aws/sam/emulation-python3.8:latest
ImageUri: emulation-python3.8:latest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageUri: public.ecr.aws/sam/emulation-python3.8:latest
ImageUri: emulation-python3.8-2:latest

ChildStackY:
Type: AWS::Serverless::Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageUri: public.ecr.aws/sam/emulation-python3.8:latest
ImageUri: emulation-python3.8:latest

ChildStackX:
Type: AWS::Serverless::Application
Expand Down

0 comments on commit 16b8b4f

Please sign in to comment.