Skip to content

Commit acd00a1

Browse files
committed
[Isolated] Fix unit tests
1 parent ab36358 commit acd00a1

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

cookbooks/aws-parallelcluster-computefleet/recipes/install/custom_parallelcluster_node.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
# TODO: once the pyenv Chef resource supports installing packages from a path (e.g. `pip install .`), convert the
2121
# bash block to a recipe that uses the pyenv resource.
22-
if aws_region.start_with?("us-iso")
23-
command = "pip install . --no-build-isolation"
24-
else
25-
command = "pip install ."
26-
end
22+
command = if aws_region.start_with?("us-iso")
23+
"pip install . --no-build-isolation"
24+
else
25+
"pip install ."
26+
end
2727

2828
if aws_region.start_with?("us-iso")
2929
dependency_package_name = "pypi-node-dependencies-#{node['cluster']['python-major-minor-version']}-#{node['kernel']['machine']}"

cookbooks/aws-parallelcluster-environment/recipes/install/cfn_bootstrap.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
retry_delay 5
8080
end
8181

82-
if aws_region.start_with?("us-iso")
83-
command = "#{virtualenv_path}/bin/pip install #{cfnbootstrap_package} --no-build-isolation"
84-
else
85-
command = "#{virtualenv_path}/bin/pip install #{cfnbootstrap_package}"
86-
end
82+
command = if aws_region.start_with?("us-iso")
83+
"#{virtualenv_path}/bin/pip install #{cfnbootstrap_package} --no-build-isolation"
84+
else
85+
"#{virtualenv_path}/bin/pip install #{cfnbootstrap_package}"
86+
end
8787
bash "Install CloudFormation helpers from #{cfnbootstrap_package}" do
8888
user 'root'
8989
group 'root'

cookbooks/aws-parallelcluster-environment/resources/efs/efs_redhat8.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def prerequisites
4141
end
4242

4343
action :install_efs_utils do
44-
4544
package_name = "amazon-efs-utils"
4645
package_version = new_resource.efs_utils_version
4746
efs_utils_tarball = "#{node['cluster']['sources_dir']}/efs-utils-#{package_version}.tar.gz"

cookbooks/aws-parallelcluster-environment/resources/efs/partial/_install_from_tar.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@
6868
cwd node['cluster']['sources_dir']
6969
code install_script_code(efs_utils_tarball, package_name, package_version)
7070
end
71-
end
71+
end

cookbooks/aws-parallelcluster-platform/spec/unit/recipes/cookbook_virtualenv_spec.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@
3333
is_expected.to write_node_attributes('dump node attributes')
3434
end
3535

36-
it 'installs python packages' do
37-
is_expected.to run_bash("pip install").with(
38-
user: 'root',
39-
group: 'root',
40-
cwd: "#{node['cluster']['base_dir']}"
41-
).with_code(/tar xzf cookbook-dependencies.tgz/)
36+
context "when region starts with us-iso" do
37+
before do
38+
allow(node).to receive(:[]).with('cluster').and_return({'region' => 'us-iso-east-1'})
39+
end
40+
41+
it 'installs python packages' do
42+
is_expected.to run_bash("pip install").with(
43+
user: '****',
44+
group: 'root',
45+
cwd: "#{node['cluster']['base_dir']}"
46+
).with_code(/tar xzf cookbook-dependencies.tgz/)
47+
end
4248
end
4349
end
4450
end

0 commit comments

Comments
 (0)