Skip to content

Commit

Permalink
Make sure the efs access point id array is set properly and the unit …
Browse files Browse the repository at this point in the history
…tests cover the dna.json values (#2792)
  • Loading branch information
dreambeyondorange authored Aug 20, 2024
1 parent b39929f commit d39131d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
efs_encryption_in_transit_array [node['cluster']['efs_encryption_in_transits'].split(',')[index]]
efs_iam_authorization_array [node['cluster']['efs_iam_authorizations'].split(',')[index]]
efs_mount_point_array ['/home']
efs_access_point_id [node['cluster']['efs_access_point_ids'].split(',')[index]]
efs_access_point_id_array [node['cluster']['efs_access_point_ids'].split(',')[index]]
action :mount
end
break
Expand All @@ -74,7 +74,7 @@
efs_fs_id_array [node['cluster']['efs_fs_ids'].split(',')[index]]
efs_encryption_in_transit_array [node['cluster']['efs_encryption_in_transits'].split(',')[index]]
efs_iam_authorization_array [node['cluster']['efs_iam_authorizations'].split(',')[index]]
efs_access_point_id [node['cluster']['efs_access_point_ids'].split(',')[index]]
efs_access_point_id_array [node['cluster']['efs_access_point_ids'].split(',')[index]]
action :mount
end
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
mount_options += ",iam"
end
# accesspoint requires tls
if efs_access_point_id && efs_access_point_id != ''
if efs_access_point_id != 'none'
mount_options += ",accesspoint=#{efs_access_point_id}"
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,11 @@ def mock_already_installed(package, expected_version, installed)
end
runner.converge_dsl do
efs 'mount' do
efs_fs_id_array %w(id_1 id_2 id_3)
shared_dir_array %w(shared_dir_1 /shared_dir_2 /shared_dir_3)
efs_encryption_in_transit_array %w(true true not_true)
efs_iam_authorization_array %w(not_true true true)
efs_fs_id_array %w(id_1 id_2 id_3 id_4)
shared_dir_array %w(shared_dir_1 /shared_dir_2 /shared_dir_3 /shared_dir_4)
efs_encryption_in_transit_array %w(true true not_true true)
efs_iam_authorization_array %w(not_true true true true)
efs_access_point_id_array %w(none none none ap)
action :mount
end
end
Expand All @@ -270,14 +271,15 @@ def mock_already_installed(package, expected_version, installed)
stub_command("mount | grep ' /shared_dir_1 '").and_return(false)
stub_command("mount | grep ' /shared_dir_2 '").and_return(true)
stub_command("mount | grep ' /shared_dir_3 '").and_return(true)
stub_command("mount | grep ' /shared_dir_4 '").and_return(false)
end

it 'mounts efs' do
is_expected.to mount_efs('mount')
end

it 'creates shared directory' do
%w(/shared_dir_1 /shared_dir_2 /shared_dir_3).each do |shared_dir|
%w(/shared_dir_1 /shared_dir_2 /shared_dir_3 /shared_dir_4).each do |shared_dir|
is_expected.to create_directory(shared_dir)
.with(owner: 'root')
.with(group: 'root')
Expand All @@ -295,6 +297,15 @@ def mock_already_installed(package, expected_version, installed)
.with(options: %w(_netdev noresvport tls))
.with(retries: 10)
.with(retry_delay: 60)

is_expected.to mount_mount('/shared_dir_4')
.with(device: 'id_4:/')
.with(fstype: 'efs')
.with(dump: 0)
.with(pass: 0)
.with(options: %w(_netdev noresvport tls iam accesspoint=ap))
.with(retries: 10)
.with(retry_delay: 60)
end

it 'enables shared dir mount if already mounted' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def default_packages
blas-devel libffi-devel dkms libedit-devel jq
libical-devel sendmail libxml2-devel libglvnd-devel
libgcrypt-devel libevent-devel glibc-static bind-utils
iproute python3 python3-pip libcurl-devel
iproute python3 python3-pip libcurl-devel git
coreutils environment-modules gcc gcc-c++ bzip2 iptables vim yum-plugin-versionlock)
end

Expand Down

0 comments on commit d39131d

Please sign in to comment.