@@ -83,8 +83,15 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
8383 ]:
8484 bucket .upload_file (str (test_datadir / script ), f"scripts/{ script } " )
8585
86+ spot_instance_types = ["t3.small" , "t3.medium" ]
87+ try :
88+ boto3 .client ("ec2" ).describe_instance_types (InstanceTypes = ["t3a.small" ])
89+ spot_instance_types .extend (["t3a.small" , "t3a.medium" ])
90+ except Exception :
91+ pass
92+
8693 # Create cluster with initial configuration
87- init_config_file = pcluster_config_reader (resource_bucket = bucket_name )
94+ init_config_file = pcluster_config_reader (resource_bucket = bucket_name , spot_instance_types = spot_instance_types )
8895 cluster = clusters_factory (init_config_file )
8996
9097 # Verify that compute nodes stored the deployed config version on DDB
@@ -132,17 +139,9 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
132139 "queue1-i2" : {
133140 "instances" : [
134141 {
135- "instance_type" : "t3.small" ,
136- },
137- {
138- "instance_type" : "t3a.small" ,
139- },
140- {
141- "instance_type" : "t3.medium" ,
142- },
143- {
144- "instance_type" : "t3a.medium" ,
145- },
142+ "instance_type" : instance_type ,
143+ }
144+ for instance_type in spot_instance_types
146145 ],
147146 "expected_running_instances" : 1 ,
148147 "expected_power_saved_instances" : 9 ,
@@ -190,6 +189,7 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
190189 resource_bucket = bucket_name ,
191190 additional_policy_arn = additional_policy_arn ,
192191 postupdate_script = "updated_postupdate.sh" ,
192+ spot_instance_types = spot_instance_types ,
193193 )
194194 cluster .update (str (updated_config_file ), force_update = "true" )
195195
@@ -248,17 +248,9 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
248248 "queue1-i3" : {
249249 "instances" : [
250250 {
251- "instance_type" : "t3.small" ,
252- },
253- {
254- "instance_type" : "t3a.small" ,
255- },
256- {
257- "instance_type" : "t3.medium" ,
258- },
259- {
260- "instance_type" : "t3a.medium" ,
261- },
251+ "instance_type" : instance_type ,
252+ }
253+ for instance_type in spot_instance_types
262254 ],
263255 "expected_running_instances" : 0 ,
264256 "expected_power_saved_instances" : 10 ,
@@ -354,6 +346,7 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
354346 resource_bucket = bucket_name ,
355347 additional_policy_arn = additional_policy_arn ,
356348 postupdate_script = "failed_postupdate.sh" ,
349+ spot_instance_types = spot_instance_types ,
357350 )
358351 cluster .update (str (failed_update_config_file ), raise_on_error = False , log_error = False )
359352
0 commit comments