File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,10 @@ async def get_ec2_instance_capabilities(
6868 self ,
6969 instance_type_names : set [InstanceTypeType ],
7070 ) -> list [EC2InstanceType ]:
71- """returns the ec2 instance types from a list of instance type names
72- NOTE: the order might differ!
71+ """Returns the ec2 instance types from a list of instance type names (sorted by name)
72+
7373 Arguments:
74- instance_type_names -- the types to filter with
74+ instance_type_names -- the types to filter with. If an empty set, it returns all.
7575
7676 Raises:
7777 Ec2InstanceTypeInvalidError: some invalid types were used as filter
@@ -95,7 +95,7 @@ async def get_ec2_instance_capabilities(
9595 ),
9696 )
9797 )
98- return list_instances
98+ return sorted ( list_instances , key = lambda i : i . name )
9999
100100 @ec2_exception_handler (_logger )
101101 async def launch_instances (
Original file line number Diff line number Diff line change @@ -116,12 +116,7 @@ async def test_get_ec2_instance_capabilities(
116116 )
117117 )
118118 assert instance_types
119- assert len (instance_types ) == len (ec2_allowed_instances )
120-
121- # all the instance names are found and valid
122- assert all (i .name in ec2_allowed_instances for i in instance_types )
123- for instance_type_name in ec2_allowed_instances :
124- assert any (i .name == instance_type_name for i in instance_types )
119+ assert [_ .name for _ in instance_types ] == sorted (ec2_allowed_instances )
125120
126121
127122async def test_get_ec2_instance_capabilities_empty_list_returns_all_options (
You can’t perform that action at this time.
0 commit comments