diff --git a/cli/tests/pcluster/templates/test_cluster_stack.py b/cli/tests/pcluster/templates/test_cluster_stack.py index a8a0c12be8..99f91c04cc 100644 --- a/cli/tests/pcluster/templates/test_cluster_stack.py +++ b/cli/tests/pcluster/templates/test_cluster_stack.py @@ -130,11 +130,14 @@ def test_cluster_config_limits(mocker, capsys, tmpdir, pcluster_config_reader, t mock_bucket(mocker) mock_bucket_object_utils(mocker) + #TODO We must restore the actual maximum defined in constants.MAX_NUMBER_OF_QUEUES, which is 50. + max_number_of_queues = 46 + # The max number of queues cannot be used with the max number of compute resources # (it will exceed the max number of compute resources per cluster) # This workaround calculates the number of compute resources to use # as the quotient of dividing the max number of compute resources per cluster by the MAX_NUMBER_OF_QUEUES. - max_number_of_crs = MAX_NUMBER_OF_COMPUTE_RESOURCES_PER_CLUSTER // MAX_NUMBER_OF_QUEUES + max_number_of_crs = MAX_NUMBER_OF_COMPUTE_RESOURCES_PER_CLUSTER // max_number_of_queues # Try to search for jinja templates in the test_datadir, this is mainly to verify pcluster limits rendered_config_file = pcluster_config_reader( @@ -143,7 +146,7 @@ def test_cluster_config_limits(mocker, capsys, tmpdir, pcluster_config_reader, t max_new_storage_count=MAX_NEW_STORAGE_COUNT, max_existing_storage_count=MAX_EXISTING_STORAGE_COUNT, # number of queues, compute resources and security groups highly impacts the size of AWS resources - max_number_of_queues=MAX_NUMBER_OF_QUEUES, + max_number_of_queues=max_number_of_queues, max_number_of_ondemand_crs=max_number_of_crs, max_number_of_spot_crs=max_number_of_crs, number_of_sg_per_queue=1, @@ -403,6 +406,16 @@ def test_compute_launch_template_properties( for lt_assertion in lt_assertions: lt_assertion.assert_lt_properties(asset_content, launch_template_logical_id) + # Checking user data variables + user_data_variables = asset_content["Resources"][launch_template_logical_id]["Properties"][ + "LaunchTemplateData"]["UserData"]["Fn::Base64"]["Fn::Sub"][1] + expected_user_data_variables = { + "CloudFormationUrl": "https://cloudformation.us-east-1.amazonaws.com", + "LaunchTemplateResourceId": launch_template_logical_id, + } + for k, v in expected_user_data_variables.items(): + assert_that(user_data_variables[k]).is_equal_to(v) + class LoginNodeLTAssertion: def __init__( diff --git a/cli/tests/pcluster/templates/test_cluster_stack/test_cluster_config_limits/slurm.full_config.snapshot.yaml b/cli/tests/pcluster/templates/test_cluster_stack/test_cluster_config_limits/slurm.full_config.snapshot.yaml index 72cd176f8b..7f9f376fef 100644 --- a/cli/tests/pcluster/templates/test_cluster_stack/test_cluster_config_limits/slurm.full_config.snapshot.yaml +++ b/cli/tests/pcluster/templates/test_cluster_stack/test_cluster_config_limits/slurm.full_config.snapshot.yaml @@ -1932,162 +1932,6 @@ Scheduling: Tags: - Key: String0 Value: String0 - - CapacityReservationTarget: null - CapacityType: ONDEMAND - ComputeResources: - - CapacityReservationTarget: null - CustomSlurmSettings: {} - DisableSimultaneousMultithreading: false - DynamicNodePriority: 1000 - Efa: - Enabled: false - GdrSupport: false - HealthChecks: - Gpu: - Enabled: null - InstanceType: c5.xlarge - MaxCount: 10 - MinCount: 0 - Name: compute-resource-ondemand-230 - Networking: - PlacementGroup: - Enabled: null - Id: null - Name: null - SchedulableMemory: null - SpotPrice: null - StaticNodePriority: 1 - Tags: - - Key: computetag0 - Value: computetag0 - ComputeSettings: - LocalStorage: - EphemeralVolume: null - RootVolume: - Encrypted: true - Iops: 3000 - Size: null - Throughput: 125 - VolumeType: gp3 - CustomActions: - OnNodeConfigured: - Args: - - arg0 - Script: https://test.tgz - OnNodeStart: - Args: - - arg0 - Script: https://test.tgz - CustomSlurmSettings: {} - HealthChecks: - Gpu: - Enabled: null - Iam: - AdditionalIamPolicies: - - Policy: arn:aws:iam::aws:policy/AdministratorAccess - InstanceProfile: null - InstanceRole: null - S3Access: - - BucketName: string1 - EnableWriteAccess: false - KeyName: null - Image: - CustomAmi: ami-12345678 - JobExclusiveAllocation: false - Name: queue-ondemand-23 - Networking: - AdditionalSecurityGroups: null - AssignPublicIp: null - PlacementGroup: - Enabled: null - Id: null - Name: null - Proxy: null - SecurityGroups: - - sg-34567890 - SubnetIds: - - subnet-12345678 - Tags: - - Key: String0 - Value: String0 - - CapacityReservationTarget: null - CapacityType: ONDEMAND - ComputeResources: - - CapacityReservationTarget: null - CustomSlurmSettings: {} - DisableSimultaneousMultithreading: false - DynamicNodePriority: 1000 - Efa: - Enabled: false - GdrSupport: false - HealthChecks: - Gpu: - Enabled: null - InstanceType: c5.xlarge - MaxCount: 10 - MinCount: 0 - Name: compute-resource-ondemand-240 - Networking: - PlacementGroup: - Enabled: null - Id: null - Name: null - SchedulableMemory: null - SpotPrice: null - StaticNodePriority: 1 - Tags: - - Key: computetag0 - Value: computetag0 - ComputeSettings: - LocalStorage: - EphemeralVolume: null - RootVolume: - Encrypted: true - Iops: 3000 - Size: null - Throughput: 125 - VolumeType: gp3 - CustomActions: - OnNodeConfigured: - Args: - - arg0 - Script: https://test.tgz - OnNodeStart: - Args: - - arg0 - Script: https://test.tgz - CustomSlurmSettings: {} - HealthChecks: - Gpu: - Enabled: null - Iam: - AdditionalIamPolicies: - - Policy: arn:aws:iam::aws:policy/AdministratorAccess - InstanceProfile: null - InstanceRole: null - S3Access: - - BucketName: string1 - EnableWriteAccess: false - KeyName: null - Image: - CustomAmi: ami-12345678 - JobExclusiveAllocation: false - Name: queue-ondemand-24 - Networking: - AdditionalSecurityGroups: null - AssignPublicIp: null - PlacementGroup: - Enabled: null - Id: null - Name: null - Proxy: null - SecurityGroups: - - sg-34567890 - SubnetIds: - - subnet-12345678 - Tags: - - Key: String0 - Value: String0 - CapacityReservationTarget: null CapacityType: ONDEMAND ComputeResources: @@ -3652,142 +3496,6 @@ Scheduling: Tags: - Key: String0 Value: String0 - - CapacityReservationTarget: null - CapacityType: ONDEMAND - ComputeResources: - - CapacityReservationTarget: null - CustomSlurmSettings: {} - DisableSimultaneousMultithreading: true - DynamicNodePriority: 1000 - Efa: - Enabled: true - GdrSupport: false - HealthChecks: - Gpu: - Enabled: null - InstanceType: c5.2xlarge - MaxCount: 15 - MinCount: 1 - Name: compute-resource-spot-230 - Networking: - PlacementGroup: - Enabled: true - Id: String - Name: null - SchedulableMemory: null - SpotPrice: 1.1 - StaticNodePriority: 1 - Tags: - - Key: computetag0 - Value: computetag0 - ComputeSettings: - LocalStorage: - EphemeralVolume: - MountDir: /scratch - RootVolume: - Encrypted: true - Iops: 100 - Size: 35 - Throughput: null - VolumeType: gp2 - CustomActions: null - CustomSlurmSettings: {} - HealthChecks: - Gpu: - Enabled: null - Iam: - AdditionalIamPolicies: [] - InstanceProfile: arn:aws:iam::aws:instance-profile/CustomNodeInstanceProfile - InstanceRole: null - S3Access: null - Image: - CustomAmi: ami-23456789 - JobExclusiveAllocation: false - Name: queue-spot-23 - Networking: - AdditionalSecurityGroups: null - AssignPublicIp: true - PlacementGroup: - Enabled: true - Id: String - Name: null - Proxy: - HttpProxyAddress: https://proxy-address:port - SecurityGroups: - - sg-34567890 - SubnetIds: - - subnet-12345678 - Tags: - - Key: String0 - Value: String0 - - CapacityReservationTarget: null - CapacityType: ONDEMAND - ComputeResources: - - CapacityReservationTarget: null - CustomSlurmSettings: {} - DisableSimultaneousMultithreading: true - DynamicNodePriority: 1000 - Efa: - Enabled: true - GdrSupport: false - HealthChecks: - Gpu: - Enabled: null - InstanceType: c5.2xlarge - MaxCount: 15 - MinCount: 1 - Name: compute-resource-spot-240 - Networking: - PlacementGroup: - Enabled: true - Id: String - Name: null - SchedulableMemory: null - SpotPrice: 1.1 - StaticNodePriority: 1 - Tags: - - Key: computetag0 - Value: computetag0 - ComputeSettings: - LocalStorage: - EphemeralVolume: - MountDir: /scratch - RootVolume: - Encrypted: true - Iops: 100 - Size: 35 - Throughput: null - VolumeType: gp2 - CustomActions: null - CustomSlurmSettings: {} - HealthChecks: - Gpu: - Enabled: null - Iam: - AdditionalIamPolicies: [] - InstanceProfile: arn:aws:iam::aws:instance-profile/CustomNodeInstanceProfile - InstanceRole: null - S3Access: null - Image: - CustomAmi: ami-23456789 - JobExclusiveAllocation: false - Name: queue-spot-24 - Networking: - AdditionalSecurityGroups: null - AssignPublicIp: true - PlacementGroup: - Enabled: true - Id: String - Name: null - Proxy: - HttpProxyAddress: https://proxy-address:port - SecurityGroups: - - sg-34567890 - SubnetIds: - - subnet-12345678 - Tags: - - Key: String0 - Value: String0 SlurmSettings: CustomSlurmSettings: null CustomSlurmSettingsIncludeFile: null