@@ -83,8 +83,15 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
83
83
]:
84
84
bucket .upload_file (str (test_datadir / script ), f"scripts/{ script } " )
85
85
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
+
86
93
# 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 )
88
95
cluster = clusters_factory (init_config_file )
89
96
90
97
# 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
132
139
"queue1-i2" : {
133
140
"instances" : [
134
141
{
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
146
145
],
147
146
"expected_running_instances" : 1 ,
148
147
"expected_power_saved_instances" : 9 ,
@@ -190,6 +189,7 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
190
189
resource_bucket = bucket_name ,
191
190
additional_policy_arn = additional_policy_arn ,
192
191
postupdate_script = "updated_postupdate.sh" ,
192
+ spot_instance_types = spot_instance_types ,
193
193
)
194
194
cluster .update (str (updated_config_file ), force_update = "true" )
195
195
@@ -248,17 +248,9 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
248
248
"queue1-i3" : {
249
249
"instances" : [
250
250
{
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
262
254
],
263
255
"expected_running_instances" : 0 ,
264
256
"expected_power_saved_instances" : 10 ,
@@ -354,6 +346,7 @@ def test_update_slurm(region, pcluster_config_reader, s3_bucket_factory, cluster
354
346
resource_bucket = bucket_name ,
355
347
additional_policy_arn = additional_policy_arn ,
356
348
postupdate_script = "failed_postupdate.sh" ,
349
+ spot_instance_types = spot_instance_types ,
357
350
)
358
351
cluster .update (str (failed_update_config_file ), raise_on_error = False , log_error = False )
359
352
0 commit comments