Skip to content

Commit 88bd53c

Browse files
[integ-tests] Only use t3a when it is available in the region
Signed-off-by: Hanwen <hanwenli@amazon.com>
1 parent 5cde7b1 commit 88bd53c

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

tests/integration-tests/tests/update/test_update.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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

tests/integration-tests/tests/update/test_update/test_update_slurm/pcluster.config.update.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ Scheduling:
5858
# Removed MinCount
5959
- Name: queue1-i3 # New compute resource
6060
Instances:
61-
- InstanceType: t3.small
62-
- InstanceType: t3a.small
63-
- InstanceType: t3.medium
64-
- InstanceType: t3a.medium
61+
{% for instance_type in spot_instance_types %}
62+
- InstanceType: {{ instance_type }}
63+
{% endfor %}
6564
# Removed MinCount
6665
Networking:
6766
SubnetIds:

tests/integration-tests/tests/update/test_update/test_update_slurm/pcluster.config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ Scheduling:
5050
MaxCount: 2
5151
- Name: queue1-i2
5252
Instances:
53-
- InstanceType: t3.small
54-
- InstanceType: t3a.small
55-
- InstanceType: t3.medium
56-
- InstanceType: t3a.medium
53+
{% for instance_type in spot_instance_types %}
54+
- InstanceType: {{ instance_type }}
55+
{% endfor %}
5756
MinCount: 1
5857
Networking:
5958
SubnetIds:

0 commit comments

Comments
 (0)