summaryrefslogtreecommitdiff
path: root/spec/unit/provider/mount/mount_spec.rb
diff options
context:
space:
mode:
authorkaustubh-d <kaustubh@clogeny.com>2014-11-18 14:56:22 +0530
committerBryan McLellan <btm@opscode.com>2015-02-17 09:16:38 -0500
commit6909f4074dbd9cee5906333f693bd282476a6ac5 (patch)
tree7deb7fcea3b0409b23986f317649f8ec18fa241e /spec/unit/provider/mount/mount_spec.rb
parentaa9b233614da81c506929cc1c36eb509a4e2c97e (diff)
downloadchef-6909f4074dbd9cee5906333f693bd282476a6ac5.tar.gz
fix aix related providers to replace popen4 with mixlib shell_out
Diffstat (limited to 'spec/unit/provider/mount/mount_spec.rb')
-rw-r--r--spec/unit/provider/mount/mount_spec.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 7e9531a8ac..7a37ffe74e 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -54,10 +54,11 @@ describe Chef::Provider::Mount::Mount do
end
it "should accecpt device_type :uuid", :not_supported_on_solaris do
+ @status = double(:stdout => "/dev/sdz1\n", :exitstatus => 1)
@new_resource.device_type :uuid
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
@stdout_findfs = double("STDOUT", :first => "/dev/sdz1")
- expect(@provider).to receive(:popen4).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_yield(@pid,@stdin,@stdout_findfs,@stderr).and_return(@status)
+ expect(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(@status)
@provider.load_current_resource()
@provider.mountable?
end
@@ -93,11 +94,10 @@ describe Chef::Provider::Mount::Mount do
end
it "should raise an error if the mount device (uuid) does not exist", :not_supported_on_solaris do
+ status = double(:stdout => "", :exitstatus => 1)
@new_resource.device_type :uuid
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
- status_findfs = double("Status", :exitstatus => 1)
- stdout_findfs = double("STDOUT", :first => nil)
- expect(@provider).to receive(:popen4).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_yield(@pid,@stdin,stdout_findfs,@stderr).and_return(status_findfs)
+ expect(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
expect(::File).to receive(:exists?).with("").and_return(false)
expect { @provider.load_current_resource();@provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
end
@@ -307,10 +307,10 @@ describe Chef::Provider::Mount::Mount do
end
it "should mount the filesystem specified by uuid", :not_supported_on_solaris do
+ status = double(:stdout => "/dev/sdz1\n", :exitstatus => 1)
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
@new_resource.device_type :uuid
- @stdout_findfs = double("STDOUT", :first => "/dev/sdz1")
- allow(@provider).to receive(:popen4).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_yield(@pid,@stdin,@stdout_findfs,@stderr).and_return(@status)
+ allow(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
@stdout_mock = double('stdout mock')
allow(@stdout_mock).to receive(:each).and_yield("#{@new_resource.device} on #{@new_resource.mount_point}")
expect(@provider).to receive(:shell_out!).with("mount -t #{@new_resource.fstype} -o defaults -U #{@new_resource.device} #{@new_resource.mount_point}").and_return(@stdout_mock)