Use known AMI in internal tests (#3620)

Moto's implementation of autoscaling:CreateLaunchConfiguration is a little too loose,
allowing the ImageId parameter to be omitted and defaulting it to None, which results
in dozens of deprecation warnings:

`PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.`

This commit refactors calls to CreateLaunchConfiguration to explicitly pass in a known
AMI ImageId in order to avoid these warnings.

The integrity of the tests is unaffected by this change.
This commit is contained in:
Brian Pandola 2021-01-27 11:49:33 -08:00 committed by GitHub
commit 9e1fcac9d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 162 additions and 47 deletions

View file

@ -81,7 +81,9 @@ def test_autoscaling_group_from_launch_config():
client = boto3.client("autoscaling", region_name="us-east-1")
client.create_launch_configuration(
LaunchConfigurationName="test_launch_configuration", InstanceType="t2.micro",
LaunchConfigurationName="test_launch_configuration",
InstanceType="t2.micro",
ImageId=EXAMPLE_AMI_ID,
)
stack_name = "test-auto-scaling-group"
@ -123,6 +125,7 @@ Outputs:
client.create_launch_configuration(
LaunchConfigurationName="test_launch_configuration_new",
InstanceType="t2.micro",
ImageId=EXAMPLE_AMI_ID,
)
cf_template = """