moto/tests/test_ssm/test_ssm_default_amis.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1.0 KiB
Python
Raw Normal View History

import boto3
2024-01-07 12:03:33 +00:00
from moto import mock_aws
test_ami = "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64"
2024-01-07 12:03:33 +00:00
@mock_aws
def test_ssm_get_latest_ami_by_path():
client = boto3.client("ssm", region_name="us-west-1")
path = "/aws/service/ami-amazon-linux-latest"
params = client.get_parameters_by_path(Path=path)["Parameters"]
assert len(params) == 10
assert all(
{p["Name"].startswith("/aws/service/ami-amazon-linux-latest") for p in params}
)
assert all({p["Type"] == "String" for p in params})
assert all({p["DataType"] == "text" for p in params})
assert all({p["ARN"].startswith("arn:aws:ssm:us-west-1") for p in params})
2024-01-07 12:03:33 +00:00
@mock_aws
def test_ssm_latest_amis_are_different_in_regions():
client = boto3.client("ssm", region_name="us-west-1")
ami_uswest = client.get_parameter(Name=test_ami)["Parameter"]["Value"]
client = boto3.client("ssm", region_name="eu-north-1")
ami_eunorth = client.get_parameter(Name=test_ami)["Parameter"]["Value"]
assert ami_uswest != ami_eunorth