diff options
author | antima-gupta <agupta@msystechnologies.com> | 2020-11-23 22:06:13 -0800 |
---|---|---|
committer | antima-gupta <agupta@msystechnologies.com> | 2020-11-23 22:06:13 -0800 |
commit | c821da083ee80e4b61de90611ccda033ef56b1ba (patch) | |
tree | ec962219b8bf8af180583f6927ea3dc1848d5727 | |
parent | 3960cf57472635dd730ac22fde76d9aff376b1f7 (diff) | |
download | chef-c821da083ee80e4b61de90611ccda033ef56b1ba.tar.gz |
Fixed aix spec failure when the target state is to disable the mount.
Signed-off-by: antima-gupta <agupta@msystechnologies.com>
-rw-r--r-- | lib/chef/provider/mount.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/mount_spec.rb | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index f8c71c6706..44fb94ca01 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -176,7 +176,7 @@ class Chef # Returns the new_resource device as per device_type def device_fstab # Removed "/" from the end of str, because it was causing idempotency issue. - device = @new_resource.device.chomp("/") + device = @new_resource.device == "/" ? @new_resource.device : @new_resource.device.chomp("/") case @new_resource.device_type when :device device diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb index 55738a4326..cecacbd6a3 100644 --- a/spec/functional/resource/mount_spec.rb +++ b/spec/functional/resource/mount_spec.rb @@ -129,8 +129,9 @@ describe Chef::Resource::Mount, :requires_root, external: include_flag do end # Actual tests begin here. - before(:all) do + before(:all) do |test| @device, @fstype = setup_device_for_mount + @device = "/" if test.metadata[:skip_before] @mount_point = Dir.mktmpdir("testmount") @@ -145,13 +146,20 @@ describe Chef::Resource::Mount, :requires_root, external: include_flag do end after(:all) do - Dir.rmdir(@mount_point) + Dir.rmdir(@mount_point) if @mount_point end after(:each) do cleanup_mount(new_resource.mount_point) end + describe "when device is '/'" do + it "should mount the filesystem if device is '/'", :skip_before do + new_resource.run_action(:mount) + mount_should_exist(new_resource.mount_point, new_resource.device) + end + end + describe "when the target state is a mounted filesystem" do it "should mount the filesystem if it isn't mounted" do expect(current_resource.enabled).to be_falsey |