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:
parent
b9b793f421
commit
9e1fcac9d4
6 changed files with 162 additions and 47 deletions
|
|
@ -5,6 +5,7 @@ import sure # noqa
|
|||
from moto import mock_autoscaling, mock_ec2, mock_elbv2
|
||||
|
||||
from .utils import setup_networking
|
||||
from tests import EXAMPLE_AMI_ID
|
||||
|
||||
|
||||
@mock_elbv2
|
||||
|
|
@ -32,7 +33,9 @@ def test_attach_detach_target_groups():
|
|||
target_group_arn = response["TargetGroups"][0]["TargetGroupArn"]
|
||||
|
||||
client.create_launch_configuration(
|
||||
LaunchConfigurationName="test_launch_configuration"
|
||||
LaunchConfigurationName="test_launch_configuration",
|
||||
ImageId=EXAMPLE_AMI_ID,
|
||||
InstanceType="t2.medium",
|
||||
)
|
||||
|
||||
# create asg, attach to target group on create
|
||||
|
|
@ -102,7 +105,9 @@ def test_detach_all_target_groups():
|
|||
target_group_arn = response["TargetGroups"][0]["TargetGroupArn"]
|
||||
|
||||
client.create_launch_configuration(
|
||||
LaunchConfigurationName="test_launch_configuration"
|
||||
LaunchConfigurationName="test_launch_configuration",
|
||||
ImageId=EXAMPLE_AMI_ID,
|
||||
InstanceType="t2.medium",
|
||||
)
|
||||
|
||||
client.create_auto_scaling_group(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue