spec/unit/plugins/linux/filesystem_spec.rb in ohai-13.2.0 vs spec/unit/plugins/linux/filesystem_spec.rb in ohai-13.3.0
- old
+ new
@@ -26,14 +26,14 @@
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, "", ""))
allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
allow(plugin).to receive(:which).with("lsblk").and_return(nil)
allow(plugin).to receive(:which).with("blkid").and_return("/sbin/blkid")
- allow(plugin).to receive(:shell_out).with("/sbin/blkid").and_return(mock_shell_out(0, "", ""))
+ allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, "", ""))
allow(plugin).to receive(:shell_out).
- with("lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
+ with("lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
and_return(mock_shell_out(0, "", ""))
allow(File).to receive(:exist?).with("/proc/mounts").and_return(false)
%w{sdb1 sdb2 sda1 sda2 md0 md1 md2}.each do |name|
@@ -217,11 +217,11 @@
/dev/mapper/sys.vg-tmp.lv: LABEL=\"/tmp\" UUID=\"74cf7eb9-428f-479e-9a4a-9943401e81e5\" TYPE=\"ext4\"
/dev/mapper/sys.vg-usr.lv: LABEL=\"/usr\" UUID=\"26ec33c5-d00b-4f88-a550-492def013bbc\" TYPE=\"ext4\"
/dev/mapper/sys.vg-var.lv: LABEL=\"/var\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" TYPE=\"ext4\"
/dev/mapper/sys.vg-home.lv: LABEL=\"/home\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" TYPE=\"xfs\"
BLKID_TYPE
- allow(plugin).to receive(:shell_out).with("/sbin/blkid").and_return(mock_shell_out(0, @stdout, ""))
+ allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
end
it "should run blkid" do
plugin.run
end
@@ -277,11 +277,11 @@
NAME=\"sys.vg-var.lv\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" LABEL=\"/var\" FSTYPE=\"ext4\"
NAME=\"sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
NAME=\"debian--7-root (dm-0)\" UUID=\"09187faa-3512-4505-81af-7e86d2ccb99a\" LABEL=\"root\" FSTYPE=\"ext4\"
BLKID_TYPE
allow(plugin).to receive(:shell_out).
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
and_return(mock_shell_out(0, @stdout, ""))
end
it "should run lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
plugin.run
@@ -344,11 +344,11 @@
NAME=\"sys.vg-var.lv\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" LABEL=\"/var\" FSTYPE=\"ext4\"
NAME=\"sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/BADhome\" FSTYPE=\"xfs\"
NAME=\"debian--7-root (dm-0)\" UUID=\"09187faa-3512-4505-81af-7e86d2ccb99a\" LABEL=\"root\" FSTYPE=\"ext4\"
BLKID_TYPE
allow(plugin).to receive(:shell_out).
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
and_return(mock_shell_out(0, @stdout, ""))
@stdout = <<-BLKID_TYPE
/dev/sdb1: LABEL=\"fuego:0\" TYPE=\"linux_raid_member\"
/dev/sdb2: LABEL=\"fuego:1\" TYPE=\"linux_raid_member\"
/dev/sda1: LABEL=\"fuego:0\" UUID=\"bd1197e0-6997-1f3a-e27e-7801388308b5\" TYPE=\"linux_raid_member\"
@@ -360,11 +360,11 @@
/dev/mapper/sys.vg-tmp.lv: LABEL=\"/tmp\" UUID=\"74cf7eb9-428f-479e-9a4a-9943401e81e5\" TYPE=\"ext4\"
/dev/mapper/sys.vg-usr.lv: LABEL=\"/usr\" UUID=\"26ec33c5-d00b-4f88-a550-492def013bbc\" TYPE=\"ext4\"
/dev/mapper/sys.vg-var.lv: LABEL=\"/var\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" TYPE=\"ext4\"
/dev/mapper/sys.vg-home.lv: LABEL=\"/home\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" TYPE=\"xfs\"
BLKID_TYPE
- allow(plugin).to receive(:shell_out).with("/sbin/blkid").and_return(mock_shell_out(0, @stdout, ""))
+ allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
end
it "should fill in missing FS data from lsblk using blkid" do
plugin.run
pairs = plugin[:filesystem]["by_pair"]
@@ -471,11 +471,11 @@
@stdout = <<-BLKID_TYPE
NAME=\"/dev/mapper/sys.vg-root.lv\" UUID=\"7742d14b-80a3-4e97-9a32-478be9ea9aea\" LABEL=\"/\" FSTYPE=\"ext4\"
NAME=\"/dev/mapper/sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
BLKID_TYPE
allow(plugin).to receive(:shell_out).
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
and_return(mock_shell_out(0, @stdout, ""))
end
it "should provide a devices view with all mountpoints" do
plugin.run
@@ -518,10 +518,10 @@
NAME=\"/dev/sdb1\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" LABEL=\"/mnt\" FSTYPE=\"ext4\"
NAME=\"/dev/sdc1\" UUID=\"7f1e51bf-3608-4351-b7cd-379e39cff36a\" LABEL=\"/mnt\" FSTYPE=\"ext4\"
NAME=\"/dev/mapper/sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
BLKID_TYPE
allow(plugin).to receive(:shell_out).
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
and_return(mock_shell_out(0, @stdout, ""))
end
it "should provide a mounts view with all devices" do
plugin.run