@@ -116,7 +116,11 @@ def test_returns_the_latest_available(self, ec2_client_mock: Mock):
116116 },
117117 ]
118118 }
119- image_id , username = get_image_id_and_username (ec2_client_mock , cuda = False )
119+ image_id , username = get_image_id_and_username (
120+ ec2_client_mock ,
121+ cuda = False ,
122+ instance_type = "some" ,
123+ )
120124 assert image_id == "ami-00000000000000003"
121125 assert username == "ubuntu"
122126
@@ -138,7 +142,11 @@ def test_raises_resource_not_found_if_none_available(
138142 ]
139143 }
140144 with pytest .raises (ComputeResourceNotFoundError ):
141- get_image_id_and_username (ec2_client_mock , cuda = False )
145+ get_image_id_and_username (
146+ ec2_client_mock ,
147+ cuda = False ,
148+ instance_type = "some" ,
149+ )
142150 assert "image 'dstack-0.0' not found" in caplog .text
143151
144152 @pytest .mark .parametrize (
@@ -152,7 +160,11 @@ def test_uses_dstack_image_name_and_account_id_if_image_config_not_provided(
152160 self , monkeypatch : pytest .MonkeyPatch , ec2_client_mock : Mock , cuda : bool , expected : str
153161 ):
154162 monkeypatch .setattr ("dstack.version.base_image" , "0.0" )
155- _ , username = get_image_id_and_username (ec2_client_mock , cuda )
163+ _ , username = get_image_id_and_username (
164+ ec2_client_mock ,
165+ cuda = cuda ,
166+ instance_type = "some" ,
167+ )
156168 assert username == "ubuntu"
157169 ec2_client_mock .describe_images .assert_called_once_with (
158170 Filters = [{"Name" : "name" , "Values" : [expected ]}], Owners = ["142421590066" ]
@@ -184,7 +196,12 @@ def test_uses_image_config_if_provided(
184196 user = "dstack" ,
185197 ),
186198 )
187- _ , username = get_image_id_and_username (ec2_client_mock , cuda , image_config )
199+ _ , username = get_image_id_and_username (
200+ ec2_client_mock ,
201+ cuda = cuda ,
202+ instance_type = "some" ,
203+ image_config = image_config ,
204+ )
188205 assert username == expected_username
189206 ec2_client_mock .describe_images .assert_called_once_with (
190207 Filters = [{"Name" : "name" , "Values" : [expected_name ]}],
@@ -202,5 +219,10 @@ def test_raises_resource_not_found_if_image_config_property_not_set(
202219 ),
203220 )
204221 with pytest .raises (ComputeResourceNotFoundError ):
205- get_image_id_and_username (ec2_client_mock , cuda = False , image_config = image_config )
222+ get_image_id_and_username (
223+ ec2_client_mock ,
224+ cuda = False ,
225+ instance_type = "some" ,
226+ image_config = image_config ,
227+ )
206228 assert "cpu image not configured" in caplog .text
0 commit comments