summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorsmriti <sgarg@msystechnologies.com>2021-04-15 12:38:23 +0530
committersmriti <sgarg@msystechnologies.com>2021-04-22 10:22:55 +0530
commit1d0ad75f33e74f1b9248f19c6f940deeaa3f5af7 (patch)
tree2362e417a0490c475307c31e12a828f97a578a3d /spec
parent672fd930d5eafb1c38b02eabf396655b05fb0135 (diff)
downloadchef-1d0ad75f33e74f1b9248f19c6f940deeaa3f5af7.tar.gz
Kept a check in pattern matching for a mount of type loop
Signed-off-by: smriti <sgarg@msystechnologies.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/mount/linux_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/unit/provider/mount/linux_spec.rb b/spec/unit/provider/mount/linux_spec.rb
index 3e41f895d1..3e1ce1ace1 100644
--- a/spec/unit/provider/mount/linux_spec.rb
+++ b/spec/unit/provider/mount/linux_spec.rb
@@ -12,7 +12,7 @@ describe Chef::Provider::Mount::Linux do
new_resource = Chef::Resource::Mount.new("/tmp/foo")
new_resource.device "/dev/sdz1"
new_resource.device_type :device
- new_resource.fstype "ext3"
+ new_resource.fstype "ext3"
new_resource.supports remount: false
new_resource
end
@@ -104,4 +104,16 @@ describe Chef::Provider::Mount::Linux do
end
end
+ context "to check if loop resource is mounted" do
+ it "should set mounted true in case of loop resource" do
+ new_resource.options "loop"
+ mount = "/tmp/foo /dev/loop16 iso660 cifs ro\n"
+ losetup = "/dev/loop16 0 0 1 1 /dev/sdz1 \n"
+ allow(provider).to receive(:shell_out!).with("findmnt -rn").and_return(double(stdout: mount))
+ allow(provider).to receive(:shell_out!).with("losetup --list").and_return(double(stdout: losetup))
+ provider.load_current_resource
+ expect(provider.current_resource.mounted).to be_truthy
+ end
+ end
+
end