| 
18 | 18 | from remote_command_executor import RemoteCommandExecutor  | 
19 | 19 | from troposphere import Ref, Template, ec2  | 
20 | 20 | from troposphere.efs import MountTarget  | 
21 |  | -from utils import generate_stack_name, get_vpc_snakecase_value  | 
 | 21 | +from utils import generate_stack_name, get_vpc_snakecase_value, get_compute_nodes_instance_ips  | 
22 | 22 | 
 
  | 
23 | 23 | from tests.storage.storage_common import (  | 
24 | 24 |     test_efs_correctly_mounted,  | 
25 | 25 |     verify_directory_correctly_shared,  | 
26 |  | -    write_file_into_efs,  | 
 | 26 | +    write_file_into_efs, get_efs_ids,  | 
27 | 27 | )  | 
28 | 28 | 
 
  | 
29 | 29 | 
 
  | 
@@ -130,6 +130,8 @@ def test_multiple_efs(  | 
130 | 130 | 
 
  | 
131 | 131 |     run_benchmarks(remote_command_executor, scheduler_commands)  | 
132 | 132 | 
 
  | 
 | 133 | +    _test_efs_utils(remote_command_executor, scheduler_commands, cluster, region, all_mount_dirs, get_efs_ids(cluster, region))  | 
 | 134 | + | 
133 | 135 | 
 
  | 
134 | 136 | def _add_mount_targets(subnet_ids, efs_ids, security_group, template):  | 
135 | 137 |     subnet_response = boto3.client("ec2").describe_subnets(SubnetIds=subnet_ids)["Subnets"]  | 
@@ -230,3 +232,21 @@ def _assert_subnet_az_relations(region, vpc_stack, expected_in_same_az):  | 
230 | 232 |         assert_that(head_node_subnet_az).is_equal_to(compute_subnet_az)  | 
231 | 233 |     else:  | 
232 | 234 |         assert_that(head_node_subnet_az).is_not_equal_to(compute_subnet_az)  | 
 | 235 | + | 
 | 236 | + | 
 | 237 | +def _test_efs_utils(remote_command_executor, scheduler_commands, cluster, region, mount_dirs, efs_ids):  | 
 | 238 | +    compute_node_remote_command_executors = []  | 
 | 239 | +    for compute_node_ip in get_compute_nodes_instance_ips(cluster.name, region):  | 
 | 240 | +        compute_node_remote_command_executors(RemoteCommandExecutor(cluster, compute_node_ip=compute_node_ip))  | 
 | 241 | +    for mount_dir in mount_dirs:  | 
 | 242 | +        remote_command_executor.run_remote_command(f"sudo umount {mount_dir}")  | 
 | 243 | +        for compute_node_remote_command_executor in compute_node_remote_command_executors:  | 
 | 244 | +            compute_node_remote_command_executor.run_remote_command(f"sudo umount {mount_dir}")  | 
 | 245 | +    assert_that(mount_dirs).is_length(len(efs_ids))  | 
 | 246 | +    for mount_dir, efs_id in zip(mount_dirs, efs_ids):  | 
 | 247 | +        remote_command_executor.run_remote_command(f"sudo mount -t efs -o tls {efs_id}:/ {mount_dir}")  | 
 | 248 | +        for compute_node_remote_command_executor in compute_node_remote_command_executors:  | 
 | 249 | +            compute_node_remote_command_executor.run_remote_command(f"sudo mount -t efs -o tls {efs_id}:/ {mount_dir}")  | 
 | 250 | +        _test_efs_correctly_shared(remote_command_executor, mount_dir, scheduler_commands)  | 
 | 251 | +    for mount_dir in mount_dirs:  | 
 | 252 | +        test_efs_correctly_mounted(remote_command_executor, mount_dir)  | 
0 commit comments