summaryrefslogtreecommitdiff
path: root/spec/unit/plugins/linux
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/plugins/linux')
-rw-r--r--spec/unit/plugins/linux/block_device_spec.rb4
-rw-r--r--spec/unit/plugins/linux/cpu_spec.rb8
-rw-r--r--spec/unit/plugins/linux/filesystem2_spec.rb62
-rw-r--r--spec/unit/plugins/linux/filesystem_spec.rb82
-rw-r--r--spec/unit/plugins/linux/fips_spec.rb2
-rw-r--r--spec/unit/plugins/linux/hostname_spec.rb8
-rw-r--r--spec/unit/plugins/linux/hostnamectl_spec.rb6
-rw-r--r--spec/unit/plugins/linux/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/linux/lsb_spec.rb36
-rw-r--r--spec/unit/plugins/linux/machineid_spec.rb6
-rw-r--r--spec/unit/plugins/linux/mdadm_spec.rb12
-rw-r--r--spec/unit/plugins/linux/memory_spec.rb68
-rw-r--r--spec/unit/plugins/linux/network_spec.rb38
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb132
-rw-r--r--spec/unit/plugins/linux/sessions_spec.rb6
-rw-r--r--spec/unit/plugins/linux/uptime_spec.rb10
-rw-r--r--spec/unit/plugins/linux/virtualization_spec.rb12
17 files changed, 247 insertions, 247 deletions
diff --git a/spec/unit/plugins/linux/block_device_spec.rb b/spec/unit/plugins/linux/block_device_spec.rb
index edb4b243..2060793e 100644
--- a/spec/unit/plugins/linux/block_device_spec.rb
+++ b/spec/unit/plugins/linux/block_device_spec.rb
@@ -41,7 +41,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
tmp_double
end
- before(:each) do
+ before do
@plugin = get_plugin("linux/block_device")
allow(@plugin).to receive(:collect_os).and_return(:linux)
@@ -66,7 +66,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
end
end
- it "should collect all relevant data from disks" do
+ it "collects all relevant data from disks" do
@plugin.run
DISKS.each do |disk, checks|
expect(@plugin[:block_device][disk.to_sym]).to include(checks)
diff --git a/spec/unit/plugins/linux/cpu_spec.rb b/spec/unit/plugins/linux/cpu_spec.rb
index f6252453..e8f563a0 100644
--- a/spec/unit/plugins/linux/cpu_spec.rb
+++ b/spec/unit/plugins/linux/cpu_spec.rb
@@ -95,12 +95,12 @@ clflush size : 32
tempfile
end
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
allow(File).to receive(:open).with("/proc/cpuinfo").and_return(tempfile_handle)
end
- after(:each) do
+ after do
begin
tempfile.close
tempfile.unlink
@@ -113,7 +113,7 @@ clflush size : 32
it "gets total cores" do
plugin.run
- expect(plugin[:cpu][:cores]).to eql(0)
+ expect(plugin[:cpu][:cores]).to be(0)
end
it "doesn't have a cpu 1" do
@@ -314,7 +314,7 @@ end
describe Ohai::System, "S390 linux cpu plugin" do
let(:plugin) { get_plugin("linux/cpu") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
@double_file = double("/proc/cpuinfo")
diff --git a/spec/unit/plugins/linux/filesystem2_spec.rb b/spec/unit/plugins/linux/filesystem2_spec.rb
index e62e9d1a..7006b884 100644
--- a/spec/unit/plugins/linux/filesystem2_spec.rb
+++ b/spec/unit/plugins/linux/filesystem2_spec.rb
@@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux filesystem plugin" do
let (:plugin) { get_plugin("linux/filesystem2") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
@@ -53,7 +53,7 @@ describe Ohai::System, "Linux filesystem plugin" do
end
describe "when gathering filesystem usage data from df" do
- before(:each) do
+ before do
@stdout = <<-DF
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -80,55 +80,55 @@ DFi
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
end
- it "should run df -P and df -iP" do
+ it "runs df -P and df -iP" do
expect(plugin).to receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
expect(plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
plugin.run
end
- it "should set kb_size to value from df -P" do
+ it "sets kb_size to value from df -P" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_size]).to eq("97605057")
end
- it "should set kb_used to value from df -P" do
+ it "sets kb_used to value from df -P" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_used]).to eq("53563253")
end
- it "should set kb_available to value from df -P" do
+ it "sets kb_available to value from df -P" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_available]).to eq("44041805")
end
- it "should set percent_used to value from df -P" do
+ it "sets percent_used to value from df -P" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:percent_used]).to eq("56%")
end
- it "should set mount to value from df -P" do
+ it "sets mount to value from df -P" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
end
- it "should set total_inodes to value from df -iP" do
+ it "sets total_inodes to value from df -iP" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:total_inodes]).to eq("124865")
end
- it "should set inodes_used to value from df -iP" do
+ it "sets inodes_used to value from df -iP" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_used]).to eq("380")
end
- it "should set inodes_available to value from df -iP" do
+ it "sets inodes_available to value from df -iP" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_available]).to eq("124485")
end
end
describe "when gathering mounted filesystem data from mount" do
- before(:each) do
+ before do
@stdout = <<-MOUNT
/dev/mapper/sys.vg-root.lv on / type ext4 (rw,noatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
@@ -149,29 +149,29 @@ MOUNT
allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run mount" do
+ it "runs mount" do
expect(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set mount to value from mount" do
+ it "sets mount to value from mount" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
end
- it "should set fs_type to value from mount" do
+ it "sets fs_type to value from mount" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
end
- it "should set mount_options to an array of values from mount" do
+ it "sets mount_options to an array of values from mount" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime})
end
end
describe "when gathering filesystem type data from blkid" do
- before(:each) do
+ before do
# blkid and lsblk output are coorelated with df/mount output, so the
# most full test of them actually requires we have both
@dfstdout = <<-DF
@@ -216,11 +216,11 @@ BLKID_TYPE
allow(plugin).to receive(:shell_out).with("blkid").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run blkid" do
+ it "runs blkid" do
plugin.run
end
- it "should set kb_size to value from blkid" do
+ it "sets kb_size to value from blkid" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/md1,"][:fs_type]).to eq("LVM2_member")
expect(plugin[:filesystem2]["by_pair"]["/dev/sda2,"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
@@ -229,7 +229,7 @@ BLKID_TYPE
end
describe "when gathering filesystem type data from lsblk" do
- before(:each) do
+ before do
@dfstdout = <<-DF
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -276,18 +276,18 @@ BLKID_TYPE
and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
+ it "runs lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
plugin.run
end
- it "should set kb_size to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
+ it "sets kb_size to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/md1,"][:fs_type]).to eq("LVM2_member")
expect(plugin[:filesystem2]["by_pair"]["/dev/sda2,"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
expect(plugin[:filesystem2]["by_pair"]["/dev/md0,/boot"][:label]).to eq("/boot")
end
- it "should ignore extra info in name and set label to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
+ it "ignores extra info in name and set label to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/debian--7-root,"][:label]).to eq("root")
end
@@ -295,7 +295,7 @@ BLKID_TYPE
end
describe "when gathering data from /proc/mounts" do
- before(:each) do
+ before do
allow(File).to receive(:exist?).with("/proc/mounts").and_return(true)
@double_file = double("/proc/mounts")
@mounts = <<-MOUNTS
@@ -326,24 +326,24 @@ MOUNTS
allow(File).to receive(:open).with("/proc/mounts").and_return(@double_file)
end
- it "should set mount to value from /proc/mounts" do
+ it "sets mount to value from /proc/mounts" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
end
- it "should set fs_type to value from /proc/mounts" do
+ it "sets fs_type to value from /proc/mounts" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
end
- it "should set mount_options to an array of values from /proc/mounts" do
+ it "sets mount_options to an array of values from /proc/mounts" do
plugin.run
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime attr2 noquota})
end
end
describe "when gathering filesystem data with devices mounted more than once" do
- before(:each) do
+ before do
# there's a few different examples one can run into in this output:
# 1. A device physically mounted in more than one place: /home and /home2
# 2. A bind-mounted directory, which shows up as the same device in a
@@ -383,7 +383,7 @@ BLKID_TYPE
and_return(mock_shell_out(0, @stdout, ""))
end
- it "should provide a devices view with all mountpoints" do
+ it "provides a devices view with all mountpoints" do
plugin.run
expect(plugin[:filesystem2]["by_device"]["/dev/mapper/sys.vg-root.lv"][:mounts]).to eq(["/", "/var/chroot"])
expect(plugin[:filesystem2]["by_device"]["/dev/mapper/sys.vg-home.lv"][:mounts]).to eq(["/home", "/home2"])
@@ -392,7 +392,7 @@ BLKID_TYPE
end
describe "when gathering filesystem data with double-mounts" do
- before(:each) do
+ before do
@dfstdout = <<-DF
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -429,7 +429,7 @@ BLKID_TYPE
and_return(mock_shell_out(0, @stdout, ""))
end
- it "should provide a mounts view with all devices" do
+ it "provides a mounts view with all devices" do
plugin.run
expect(plugin[:filesystem2]["by_mountpoint"]["/mnt"][:devices]).to eq(["/dev/sdb1", "/dev/sdc1"])
end
diff --git a/spec/unit/plugins/linux/filesystem_spec.rb b/spec/unit/plugins/linux/filesystem_spec.rb
index 7375a8cf..01cd1ff4 100644
--- a/spec/unit/plugins/linux/filesystem_spec.rb
+++ b/spec/unit/plugins/linux/filesystem_spec.rb
@@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux filesystem plugin" do
let(:plugin) { get_plugin("linux/filesystem") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
@@ -58,7 +58,7 @@ describe Ohai::System, "Linux filesystem plugin" do
end
describe "when gathering filesystem usage data from df" do
- before(:each) do
+ before do
@stdout = <<-DF
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -85,55 +85,55 @@ DFi
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
end
- it "should run df -P and df -iP" do
+ it "runs df -P and df -iP" do
expect(plugin).to receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
expect(plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
plugin.run
end
- it "should set kb_size to value from df -P" do
+ it "sets kb_size to value from df -P" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_size]).to eq("97605057")
end
- it "should set kb_used to value from df -P" do
+ it "sets kb_used to value from df -P" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_used]).to eq("53563253")
end
- it "should set kb_available to value from df -P" do
+ it "sets kb_available to value from df -P" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_available]).to eq("44041805")
end
- it "should set percent_used to value from df -P" do
+ it "sets percent_used to value from df -P" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:percent_used]).to eq("56%")
end
- it "should set mount to value from df -P" do
+ it "sets mount to value from df -P" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
end
- it "should set total_inodes to value from df -iP" do
+ it "sets total_inodes to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:total_inodes]).to eq("124865")
end
- it "should set inodes_used to value from df -iP" do
+ it "sets inodes_used to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_used]).to eq("380")
end
- it "should set inodes_available to value from df -iP" do
+ it "sets inodes_available to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_available]).to eq("124485")
end
end
describe "when gathering mounted filesystem data from mount" do
- before(:each) do
+ before do
@stdout = <<-MOUNT
/dev/mapper/sys.vg-root.lv on / type ext4 (rw,noatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
@@ -154,29 +154,29 @@ MOUNT
allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run mount" do
+ it "runs mount" do
expect(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set mount to value from mount" do
+ it "sets mount to value from mount" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
end
- it "should set fs_type to value from mount" do
+ it "sets fs_type to value from mount" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type]).to eq("xfs")
end
- it "should set mount_options to an array of values from mount" do
+ it "sets mount_options to an array of values from mount" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options]).to eq(%w{ro noatime})
end
end
describe "when gathering filesystem type data from blkid" do
- before(:each) do
+ before do
@stdout = <<-BLKID_TYPE
/dev/sdb1: TYPE=\"linux_raid_member\"
/dev/sdb2: TYPE=\"linux_raid_member\"
@@ -195,19 +195,19 @@ BLKID_TYPE
allow(plugin).to receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run blkid -s TYPE" do
+ it "runs blkid -s TYPE" do
expect(plugin).to receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set fs_type to value from blkid -s TYPE" do
+ it "sets fs_type to value from blkid -s TYPE" do
plugin.run
expect(plugin[:filesystem]["/dev/md1"][:fs_type]).to eq("LVM2_member")
end
end
describe "when gathering filesystem type data from lsblk" do
- before(:each) do
+ before do
allow(File).to receive(:exist?).with("/bin/lsblk").and_return(true)
@stdout = <<-BLKID_TYPE
NAME="sdb1" FSTYPE="linux_raid_member"
@@ -228,25 +228,25 @@ BLKID_TYPE
and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run lsblk -P -n -o NAME,FSTYPE" do
+ it "runs lsblk -P -n -o NAME,FSTYPE" do
expect(plugin).to receive(:shell_out).with("lsblk -P -n -o NAME,FSTYPE").
and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set fs_type to value from lsblk -P -n -o NAME,FSTYPE" do
+ it "sets fs_type to value from lsblk -P -n -o NAME,FSTYPE" do
plugin.run
expect(plugin[:filesystem]["/dev/md1"][:fs_type]).to eq("LVM2_member")
end
- it "should ignore extra info in name and set fs_type to value from lsblk -P -n -o NAME,FSTYPE" do
+ it "ignores extra info in name and set fs_type to value from lsblk -P -n -o NAME,FSTYPE" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/debian--7-root"][:fs_type]).to eq("ext4")
end
end
describe "when gathering filesystem uuid data from blkid" do
- before(:each) do
+ before do
@stdout = <<-BLKID_UUID
/dev/sdb1: UUID=\"bd1197e0-6997-1f3a-e27e-7801388308b5\"
/dev/sdb2: UUID=\"e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa\"
@@ -265,19 +265,19 @@ BLKID_UUID
allow(plugin).to receive(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run blkid -s UUID" do
+ it "runs blkid -s UUID" do
expect(plugin).to receive(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set uuid to value from blkid -s UUID" do
+ it "sets uuid to value from blkid -s UUID" do
plugin.run
expect(plugin[:filesystem]["/dev/sda2"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
end
end
describe "when gathering filesystem uuid data from lsblk" do
- before(:each) do
+ before do
allow(File).to receive(:exist?).with("/bin/lsblk").and_return(true)
@stdout = <<-BLKID_UUID
NAME="sdb1" UUID="bd1197e0-6997-1f3a-e27e-7801388308b5"
@@ -298,20 +298,20 @@ BLKID_UUID
and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run lsblk -P -n -o NAME,UUID" do
+ it "runs lsblk -P -n -o NAME,UUID" do
expect(plugin).to receive(:shell_out).with("lsblk -P -n -o NAME,UUID").
and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set uuid to value from lsblk -P -n -o NAME,UUID" do
+ it "sets uuid to value from lsblk -P -n -o NAME,UUID" do
plugin.run
expect(plugin[:filesystem]["/dev/sda2"][:uuid]).to eq(
"e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa"
)
end
- it "should ignore extra info in name and set uuid to value from lsblk -P -n -o NAME,UUID" do
+ it "ignores extra info in name and set uuid to value from lsblk -P -n -o NAME,UUID" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/debian--7-root"][:uuid]).to eq(
"09187faa-3512-4505-81af-7e86d2ccb99a"
@@ -320,7 +320,7 @@ BLKID_UUID
end
describe "when gathering filesystem label data from blkid" do
- before(:each) do
+ before do
@stdout = <<-BLKID_LABEL
/dev/sda1: LABEL=\"fuego:0\"
/dev/sda2: LABEL=\"fuego:1\"
@@ -337,19 +337,19 @@ BLKID_LABEL
allow(plugin).to receive(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run blkid -s LABEL" do
+ it "runs blkid -s LABEL" do
expect(plugin).to receive(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set label to value from blkid -s LABEL" do
+ it "sets label to value from blkid -s LABEL" do
plugin.run
expect(plugin[:filesystem]["/dev/md0"][:label]).to eq("/boot")
end
end
describe "when gathering filesystem label data from lsblk" do
- before(:each) do
+ before do
allow(File).to receive(:exist?).with("/bin/lsblk").and_return(true)
@stdout = <<-BLKID_LABEL
NAME="sda1" LABEL="fuego:0"
@@ -368,25 +368,25 @@ BLKID_LABEL
and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run lsblk -P -n -o NAME,LABEL" do
+ it "runs lsblk -P -n -o NAME,LABEL" do
expect(plugin).to receive(:shell_out).with("lsblk -P -n -o NAME,LABEL").
and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set label to value from lsblk -P -n -o NAME,LABEL" do
+ it "sets label to value from lsblk -P -n -o NAME,LABEL" do
plugin.run
expect(plugin[:filesystem]["/dev/md0"][:label]).to eq("/boot")
end
- it "should ignore extra info in name and set label to value from lsblk -P -n -o NAME,LABEL" do
+ it "ignores extra info in name and set label to value from lsblk -P -n -o NAME,LABEL" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/debian--7-root"][:label]).to eq("root")
end
end
describe "when gathering data from /proc/mounts" do
- before(:each) do
+ before do
allow(File).to receive(:exist?).with("/proc/mounts").and_return(true)
@double_file = double("/proc/mounts")
@mounts = <<-MOUNTS
@@ -417,17 +417,17 @@ MOUNTS
allow(File).to receive(:open).with("/proc/mounts").and_return(@double_file)
end
- it "should set mount to value from /proc/mounts" do
+ it "sets mount to value from /proc/mounts" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
end
- it "should set fs_type to value from /proc/mounts" do
+ it "sets fs_type to value from /proc/mounts" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type]).to eq("xfs")
end
- it "should set mount_options to an array of values from /proc/mounts" do
+ it "sets mount_options to an array of values from /proc/mounts" do
plugin.run
expect(plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options]).to eq(%w{ro noatime attr2 noquota})
end
diff --git a/spec/unit/plugins/linux/fips_spec.rb b/spec/unit/plugins/linux/fips_spec.rb
index 30d70c17..a3a6f1b1 100644
--- a/spec/unit/plugins/linux/fips_spec.rb
+++ b/spec/unit/plugins/linux/fips_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin fips" do
let(:plugin) { get_plugin("linux/fips") }
let(:fips_path) { "/proc/sys/crypto/fips_enabled" }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
allow(::File).to receive(:read).with(fips_path).and_return(enabled)
end
diff --git a/spec/unit/plugins/linux/hostname_spec.rb b/spec/unit/plugins/linux/hostname_spec.rb
index a7dba293..076c2303 100644
--- a/spec/unit/plugins/linux/hostname_spec.rb
+++ b/spec/unit/plugins/linux/hostname_spec.rb
@@ -19,7 +19,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux hostname plugin" do
- before(:each) do
+ before do
@plugin = get_plugin("hostname")
allow(@plugin).to receive(:collect_os).and_return(:linux)
allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
@@ -34,15 +34,15 @@ describe Ohai::System, "Linux hostname plugin" do
it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
describe "when domain name is unset" do
- before(:each) do
+ before do
expect(@plugin).to receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
end
- it "should not raise an error" do
+ it "does not raise an error" do
expect { @plugin.run }.not_to raise_error
end
- it "should not set fqdn" do
+ it "does not set fqdn" do
@plugin.run
expect(@plugin.fqdn).to eq(nil)
end
diff --git a/spec/unit/plugins/linux/hostnamectl_spec.rb b/spec/unit/plugins/linux/hostnamectl_spec.rb
index bfa72790..1201b4f2 100644
--- a/spec/unit/plugins/linux/hostnamectl_spec.rb
+++ b/spec/unit/plugins/linux/hostnamectl_spec.rb
@@ -21,11 +21,11 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux hostnamectl plugin" do
let(:plugin) { get_plugin("linux/hostnamectl") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
end
- it "should populate hostnamectl if hostnamectl is available" do
+ it "populates hostnamectl if hostnamectl is available" do
hostnamectl_out = <<-HOSTNAMECTL_OUT
Static hostname: foo
Icon name: computer-laptop
@@ -52,7 +52,7 @@ HOSTNAMECTL_OUT
})
end
- it "should not populate hostnamectl if hostnamectl is not available" do
+ it "does not populate hostnamectl if hostnamectl is not available" do
allow(plugin).to receive(:which).with("hostnamectl").and_return(false)
expect(plugin[:hostnamectl]).to eq(nil)
end
diff --git a/spec/unit/plugins/linux/kernel_spec.rb b/spec/unit/plugins/linux/kernel_spec.rb
index 18646156..c7b86337 100644
--- a/spec/unit/plugins/linux/kernel_spec.rb
+++ b/spec/unit/plugins/linux/kernel_spec.rb
@@ -20,7 +20,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux kernel plugin" do
- before(:each) do
+ before do
@env_lsmod = <<-ENV_LSMOD
Module Size Used by
dm_crypt 22321 0
diff --git a/spec/unit/plugins/linux/lsb_spec.rb b/spec/unit/plugins/linux/lsb_spec.rb
index 309133d3..3006a8f5 100644
--- a/spec/unit/plugins/linux/lsb_spec.rb
+++ b/spec/unit/plugins/linux/lsb_spec.rb
@@ -21,13 +21,13 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
# We do not alter case for lsb attributes and consume them as provided
describe Ohai::System, "Linux lsb plugin" do
- before(:each) do
+ before do
@plugin = get_plugin("linux/lsb")
allow(@plugin).to receive(:collect_os).and_return(:linux)
end
describe "on systems with /etc/lsb-release" do
- before(:each) do
+ before do
@double_file = double("/etc/lsb-release")
allow(@double_file).to receive(:each).
and_yield("DISTRIB_ID=Ubuntu").
@@ -39,29 +39,29 @@ describe Ohai::System, "Linux lsb plugin" do
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(true)
end
- it "should set lsb[:id]" do
+ it "sets lsb[:id]" do
@plugin.run
expect(@plugin[:lsb][:id]).to eq("Ubuntu")
end
- it "should set lsb[:release]" do
+ it "sets lsb[:release]" do
@plugin.run
expect(@plugin[:lsb][:release]).to eq("8.04")
end
- it "should set lsb[:codename]" do
+ it "sets lsb[:codename]" do
@plugin.run
expect(@plugin[:lsb][:codename]).to eq("hardy")
end
- it "should set lsb[:description]" do
+ it "sets lsb[:description]" do
@plugin.run
expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
end
end
describe "on systems with /usr/bin/lsb_release" do
- before(:each) do
+ before do
allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(true)
@stdin = double("STDIN", { :close => true })
@@ -73,7 +73,7 @@ describe Ohai::System, "Linux lsb plugin" do
end
describe "on Centos 5.4 correctly" do
- before(:each) do
+ before do
@stdout = <<-LSB_RELEASE
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
@@ -84,29 +84,29 @@ LSB_RELEASE
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should set lsb[:id]" do
+ it "sets lsb[:id]" do
@plugin.run
expect(@plugin[:lsb][:id]).to eq("CentOS")
end
- it "should set lsb[:release]" do
+ it "sets lsb[:release]" do
@plugin.run
expect(@plugin[:lsb][:release]).to eq("5.4")
end
- it "should set lsb[:codename]" do
+ it "sets lsb[:codename]" do
@plugin.run
expect(@plugin[:lsb][:codename]).to eq("Final")
end
- it "should set lsb[:description]" do
+ it "sets lsb[:description]" do
@plugin.run
expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
end
end
describe "on Fedora 14 correctly" do
- before(:each) do
+ before do
@stdout = <<-LSB_RELEASE
LSB Version: :core-4.0-ia32:core-4.0-noarch
Distributor ID: Fedora
@@ -117,29 +117,29 @@ LSB_RELEASE
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should set lsb[:id]" do
+ it "sets lsb[:id]" do
@plugin.run
expect(@plugin[:lsb][:id]).to eq("Fedora")
end
- it "should set lsb[:release]" do
+ it "sets lsb[:release]" do
@plugin.run
expect(@plugin[:lsb][:release]).to eq("14")
end
- it "should set lsb[:codename]" do
+ it "sets lsb[:codename]" do
@plugin.run
expect(@plugin[:lsb][:codename]).to eq("Laughlin")
end
- it "should set lsb[:description]" do
+ it "sets lsb[:description]" do
@plugin.run
expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
end
end
end
- it "should not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
+ it "does not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist" do
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(false)
allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(false)
expect(@plugin.attribute?(:lsb)).to be(false)
diff --git a/spec/unit/plugins/linux/machineid_spec.rb b/spec/unit/plugins/linux/machineid_spec.rb
index 12267079..8b531acb 100644
--- a/spec/unit/plugins/linux/machineid_spec.rb
+++ b/spec/unit/plugins/linux/machineid_spec.rb
@@ -21,11 +21,11 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Machine id plugin" do
let(:plugin) { get_plugin("linux/machineid") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
end
- it "should read /etc/machine-id if available" do
+ it "reads /etc/machine-id if available" do
machine_id = "6f702523e2fc7499eb1dc68e5314dacf"
allow(File).to receive(:exists?).with("/etc/machine-id").and_return(true)
@@ -34,7 +34,7 @@ describe Ohai::System, "Machine id plugin" do
expect(plugin[:machine_id]).to eq(machine_id)
end
- it "should read /var/lib/dbus/machine-id if available" do
+ it "reads /var/lib/dbus/machine-id if available" do
machine_id = "6f702523e2fc7499eb1dc68e5314dacf"
allow(File).to receive(:exists?).with("/etc/machine-id").and_return(false)
diff --git a/spec/unit/plugins/linux/mdadm_spec.rb b/spec/unit/plugins/linux/mdadm_spec.rb
index 2e8b533d..0cba2048 100644
--- a/spec/unit/plugins/linux/mdadm_spec.rb
+++ b/spec/unit/plugins/linux/mdadm_spec.rb
@@ -19,7 +19,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux Mdadm Plugin" do
- before(:each) do
+ before do
@md0 = <<-MD
/dev/md0:
Version : 1.2
@@ -67,26 +67,26 @@ MD
describe "gathering Mdadm information via /proc/mdstat and mdadm" do
- it "should not raise an error" do
+ it "does not raise an error" do
expect { @plugin.run }.not_to raise_error
end
- it "should detect raid level" do
+ it "detects raid level" do
@plugin.run
expect(@plugin[:mdadm][:md0][:level]).to eq(10)
end
- it "should detect raid state" do
+ it "detects raid state" do
@plugin.run
expect(@plugin[:mdadm][:md0][:state]).to eq("clean")
end
- it "should detect raid size" do
+ it "detects raid size" do
@plugin.run
expect(@plugin[:mdadm][:md0][:size]).to eq(2794.16)
end
- it "should detect raid metadata level" do
+ it "detects raid metadata level" do
@plugin.run
expect(@plugin[:mdadm][:md0][:version]).to eq(1.2)
end
diff --git a/spec/unit/plugins/linux/memory_spec.rb b/spec/unit/plugins/linux/memory_spec.rb
index 3a30ead3..5085a1aa 100644
--- a/spec/unit/plugins/linux/memory_spec.rb
+++ b/spec/unit/plugins/linux/memory_spec.rb
@@ -17,7 +17,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux memory plugin" do
- before(:each) do
+ before do
@plugin = get_plugin("linux/memory")
allow(@plugin).to receive(:collect_os).and_return(:linux)
@double_file = double("/proc/meminfo")
@@ -58,167 +58,167 @@ describe Ohai::System, "Linux memory plugin" do
allow(File).to receive(:open).with("/proc/meminfo").and_return(@double_file)
end
- it "should get total memory" do
+ it "gets total memory" do
@plugin.run
expect(@plugin[:memory][:total]).to eql("131932120kB")
end
- it "should get free memory" do
+ it "gets free memory" do
@plugin.run
expect(@plugin[:memory][:free]).to eql("2269032kB")
end
- it "should get memory used for file buffers" do
+ it "gets memory used for file buffers" do
@plugin.run
expect(@plugin[:memory][:buffers]).to eql("646368kB")
end
- it "should get cache memory" do
+ it "gets cache memory" do
@plugin.run
expect(@plugin[:memory][:cached]).to eql("32346556kB")
end
- it "should get active memory" do
+ it "gets active memory" do
@plugin.run
expect(@plugin[:memory][:active]).to eql("98595796kB")
end
- it "should get inactive memory" do
+ it "gets inactive memory" do
@plugin.run
expect(@plugin[:memory][:inactive]).to eql("18477320kB")
end
- it "should get high_total memory" do
+ it "gets high_total memory" do
@plugin.run
expect(@plugin[:memory][:high_total]).to eql("0kB")
end
- it "should get high_free memory" do
+ it "gets high_free memory" do
@plugin.run
expect(@plugin[:memory][:high_free]).to eql("0kB")
end
- it "should get low_total memory" do
+ it "gets low_total memory" do
@plugin.run
expect(@plugin[:memory][:low_total]).to eql("131932120kB")
end
- it "should get low_free memory" do
+ it "gets low_free memory" do
@plugin.run
expect(@plugin[:memory][:low_free]).to eql("2269032kB")
end
- it "should get dirty memory" do
+ it "gets dirty memory" do
@plugin.run
expect(@plugin[:memory][:dirty]).to eql("3212kB")
end
- it "should get writeback memory" do
+ it "gets writeback memory" do
@plugin.run
expect(@plugin[:memory][:writeback]).to eql("0kB")
end
- it "should get anon_pages memory" do
+ it "gets anon_pages memory" do
@plugin.run
expect(@plugin[:memory][:anon_pages]).to eql("84082132kB")
end
- it "should get mapped memory" do
+ it "gets mapped memory" do
@plugin.run
expect(@plugin[:memory][:mapped]).to eql("3445224kB")
end
- it "should get slab memory" do
+ it "gets slab memory" do
@plugin.run
expect(@plugin[:memory][:slab]).to eql("9892096kB")
end
- it "should get slab_reclaimable memory" do
+ it "gets slab_reclaimable memory" do
@plugin.run
expect(@plugin[:memory][:slab_reclaimable]).to eql("362636kB")
end
- it "should get slab_reclaimable memory" do
+ it "gets slab_reclaimable memory" do
@plugin.run
expect(@plugin[:memory][:slab_unreclaim]).to eql("18860kB")
end
- it "should get page_tables memory" do
+ it "gets page_tables memory" do
@plugin.run
expect(@plugin[:memory][:page_tables]).to eql("1759332kB")
end
- it "should get nfs_unstable memory" do
+ it "gets nfs_unstable memory" do
@plugin.run
expect(@plugin[:memory][:nfs_unstable]).to eql("0kB")
end
- it "should get bounce memory" do
+ it "gets bounce memory" do
@plugin.run
expect(@plugin[:memory][:bounce]).to eql("0kB")
end
- it "should get commit_limit memory" do
+ it "gets commit_limit memory" do
@plugin.run
expect(@plugin[:memory][:commit_limit]).to eql("148709328kB")
end
- it "should get committed_as memory" do
+ it "gets committed_as memory" do
@plugin.run
expect(@plugin[:memory][:committed_as]).to eql("333717060kB")
end
- it "should get vmalloc_total memory" do
+ it "gets vmalloc_total memory" do
@plugin.run
expect(@plugin[:memory][:vmalloc_total]).to eql("34359738367kB")
end
- it "should get vmalloc_used memory" do
+ it "gets vmalloc_used memory" do
@plugin.run
expect(@plugin[:memory][:vmalloc_used]).to eql("276796kB")
end
- it "should get vmalloc_chunk memory" do
+ it "gets vmalloc_chunk memory" do
@plugin.run
expect(@plugin[:memory][:vmalloc_chunk]).to eql("34359461515kB")
end
- it "should get total swap" do
+ it "gets total swap" do
@plugin.run
expect(@plugin[:memory][:swap][:total]).to eql("16777208kB")
end
- it "should get cached swap" do
+ it "gets cached swap" do
@plugin.run
expect(@plugin[:memory][:swap][:cached]).to eql("312kB")
end
- it "should get free swap" do
+ it "gets free swap" do
@plugin.run
expect(@plugin[:memory][:swap][:free]).to eql("14127356kB")
end
- it "should get total hugepages" do
+ it "gets total hugepages" do
@plugin.run
expect(@plugin[:memory][:hugepages][:total]).to eql("11542")
end
- it "should get free hugepages" do
+ it "gets free hugepages" do
@plugin.run
expect(@plugin[:memory][:hugepages][:free]).to eql("11235")
end
- it "should get reserved hugepages" do
+ it "gets reserved hugepages" do
@plugin.run
expect(@plugin[:memory][:hugepages][:reserved]).to eql("11226")
end
- it "should get surplus hugepages" do
+ it "gets surplus hugepages" do
@plugin.run
expect(@plugin[:memory][:hugepages][:surplus]).to eql("0")
end
- it "should get hugepage size" do
+ it "gets hugepage size" do
@plugin.run
expect(@plugin[:memory][:hugepage_size]).to eql("2048kB")
end
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index 6e78997f..7053c8ab 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -366,7 +366,7 @@ TX: 8192
EOM
end
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
allow(plugin).to receive(:shell_out).with("ip addr").and_return(mock_shell_out(0, linux_ip_addr, ""))
@@ -560,7 +560,7 @@ EOM
%w{ifconfig iproute2}.each do |network_method|
describe "gathering IP layer address info via #{network_method}" do
- before(:each) do
+ before do
allow(plugin).to receive(:iproute2_binary_available?).and_return( network_method == "iproute2" )
allow(plugin).to receive(:find_ethtool_binary).and_return( "/sbin/ethtool" )
plugin.run
@@ -679,7 +679,7 @@ EOM
end
describe "gathering interface counters via #{network_method}" do
- before(:each) do
+ before do
allow(plugin).to receive(:iproute2_binary_available?).and_return( network_method == "iproute2" )
plugin.run
end
@@ -717,7 +717,7 @@ EOM
end
describe "setting the node's default IP address attribute with #{network_method}" do
- before(:each) do
+ before do
allow(plugin).to receive(:iproute2_binary_available?).and_return( network_method == "iproute2" )
plugin.run
end
@@ -749,7 +749,7 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -779,7 +779,7 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -795,7 +795,7 @@ EOM
end
describe "for newer network features using iproute2 only" do
- before(:each) do
+ before do
allow(File).to receive(:exist?).with("/sbin/ip").and_return(true) # iproute2 only
allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(true) # ipv6 is enabled
allow(File).to receive(:exist?).with("/sbin/ethtool").and_return(true) # ethtool is available
@@ -849,7 +849,7 @@ EOM
end
describe "when IPv6 is disabled" do
- before :each do
+ before do
allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(false)
plugin.run
end
@@ -880,7 +880,7 @@ fe80::/64 dev eth0.11 proto kernel metric 256
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -918,7 +918,7 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024 src 1111:2222:3333:
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -959,7 +959,7 @@ default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1002,7 +1002,7 @@ default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023 src 1111:2222:333
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1103,7 +1103,7 @@ default dev venet0 scope link
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1124,7 +1124,7 @@ default dev eth3 scope link
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1149,7 +1149,7 @@ default dev fwdintf scope link src 2.2.2.2
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1174,7 +1174,7 @@ fe80::/64 dev eth0 proto kernel metric 256
default via fe80::21c:eff:fe12:3456 dev eth0.153 src fe80::2e0:81ff:fe2b:48e7 metric 1024
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1208,7 +1208,7 @@ fe80::/64 dev eth0.11 proto kernel metric 256
EOM
end
- before(:each) do
+ before do
plugin.run
end
@@ -1247,7 +1247,7 @@ EOM
let(:linux_ip_route_inet6) { "" }
let(:linux_ip_inet6_neighbor_show) { "" }
- before(:each) do
+ before do
allow(plugin).to receive(:is_openvz?).and_return true
allow(plugin).to receive(:is_openvz_host?).and_return false
plugin.run
@@ -1292,7 +1292,7 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
EOM
end
- before(:each) do
+ before do
plugin.run
end
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index 5bff78e4..eecd4b17 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -38,7 +38,7 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_os_release) { false }
let(:have_cisco_release) { false }
- before(:each) do
+ before do
@plugin = get_plugin("linux/platform")
allow(@plugin).to receive(:collect_os).and_return(:linux)
@plugin[:lsb] = Mash.new
@@ -63,43 +63,43 @@ describe Ohai::System, "Linux plugin platform" do
end
describe "on lsb compliant distributions" do
- before(:each) do
+ before do
@plugin[:lsb][:id] = "Ubuntu"
@plugin[:lsb][:release] = "8.04"
end
- it "should set platform to lowercased lsb[:id]" do
+ it "sets platform to lowercased lsb[:id]" do
@plugin.run
expect(@plugin[:platform]).to eq("ubuntu")
end
- it "should set platform_version to lsb[:release]" do
+ it "sets platform_version to lsb[:release]" do
@plugin.run
expect(@plugin[:platform_version]).to eq("8.04")
end
- it "should set platform to ubuntu and platform_family to debian [:lsb][:id] contains Ubuntu" do
+ it "sets platform to ubuntu and platform_family to debian [:lsb][:id] contains Ubuntu" do
@plugin[:lsb][:id] = "Ubuntu"
@plugin.run
expect(@plugin[:platform]).to eq("ubuntu")
expect(@plugin[:platform_family]).to eq("debian")
end
- it "should set platform to linuxmint and platform_family to debian [:lsb][:id] contains LinuxMint" do
+ it "sets platform to linuxmint and platform_family to debian [:lsb][:id] contains LinuxMint" do
@plugin[:lsb][:id] = "LinuxMint"
@plugin.run
expect(@plugin[:platform]).to eq("linuxmint")
expect(@plugin[:platform_family]).to eq("debian")
end
- it "should set platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
+ it "sets platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
@plugin[:lsb][:id] = "Debian"
@plugin.run
expect(@plugin[:platform]).to eq("debian")
expect(@plugin[:platform_family]).to eq("debian")
end
- it "should set platform to redhat and platform_family to rhel when [:lsb][:id] contains Redhat" do
+ it "sets platform to redhat and platform_family to rhel when [:lsb][:id] contains Redhat" do
@plugin[:lsb][:id] = "RedHatEnterpriseServer"
@plugin[:lsb][:release] = "5.7"
@plugin.run
@@ -107,7 +107,7 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set platform to amazon and platform_family to rhel when [:lsb][:id] contains Amazon" do
+ it "sets platform to amazon and platform_family to rhel when [:lsb][:id] contains Amazon" do
@plugin[:lsb][:id] = "AmazonAMI"
@plugin[:lsb][:release] = "2011.09"
@plugin.run
@@ -115,14 +115,14 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set platform to scientific when [:lsb][:id] contains ScientificSL" do
+ it "sets platform to scientific when [:lsb][:id] contains ScientificSL" do
@plugin[:lsb][:id] = "ScientificSL"
@plugin[:lsb][:release] = "5.7"
@plugin.run
expect(@plugin[:platform]).to eq("scientific")
end
- it "should set platform to ibm_powerkvm and platform_family to rhel when [:lsb][:id] contains IBM_PowerKVM" do
+ it "sets platform to ibm_powerkvm and platform_family to rhel when [:lsb][:id] contains IBM_PowerKVM" do
@plugin[:lsb][:id] = "IBM_PowerKVM"
@plugin[:lsb][:release] = "2.1"
@plugin.run
@@ -135,24 +135,24 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_debian_version) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should read the version from /etc/debian_version" do
+ it "reads the version from /etc/debian_version" do
expect(File).to receive(:read).with("/etc/debian_version").and_return("5.0")
@plugin.run
expect(@plugin[:platform_version]).to eq("5.0")
end
- it "should correctly strip any newlines" do
+ it "correctlies strip any newlines" do
expect(File).to receive(:read).with("/etc/debian_version").and_return("5.0\n")
@plugin.run
expect(@plugin[:platform_version]).to eq("5.0")
end
# Ubuntu has /etc/debian_version as well
- it "should detect Ubuntu as itself rather than debian" do
+ it "detects Ubuntu as itself rather than debian" do
@plugin[:lsb][:id] = "Ubuntu"
@plugin[:lsb][:release] = "8.04"
@plugin.run
@@ -164,7 +164,7 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_raspi_config) { true }
# Raspbian is a debian clone
- it "should detect Raspbian as itself with debian as the family" do
+ it "detects Raspbian as itself with debian as the family" do
expect(File).to receive(:read).with("/etc/debian_version").and_return("wheezy/sid")
@plugin.run
expect(@plugin[:platform]).to eq("raspbian")
@@ -177,11 +177,11 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_slackware_version) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform and platform_family to slackware" do
+ it "sets platform and platform_family to slackware" do
expect(File).to receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
@plugin.run
expect(@plugin[:platform]).to eq("slackware")
@@ -193,17 +193,17 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_arch_release) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform to arch and platform_family to arch" do
+ it "sets platform to arch and platform_family to arch" do
@plugin.run
expect(@plugin[:platform]).to eq("arch")
expect(@plugin[:platform_family]).to eq("arch")
end
- it "should set platform_version to kernel release" do
+ it "sets platform_version to kernel release" do
expect(@plugin).to receive(:`).with("uname -r").and_return("3.18.2-2-ARCH")
@plugin.run
expect(@plugin[:platform_version]).to eq("3.18.2-2-ARCH")
@@ -214,17 +214,17 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_gentoo_release) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform and platform_family to gentoo" do
+ it "sets platform and platform_family to gentoo" do
@plugin.run
expect(@plugin[:platform]).to eq("gentoo")
expect(@plugin[:platform_family]).to eq("gentoo")
end
- it "should set platform_version to kernel release" do
+ it "sets platform_version to kernel release" do
expect(@plugin).to receive(:`).with("uname -r").and_return("3.18.7-gentoo")
@plugin.run
expect(@plugin[:platform_version]).to eq("3.18.7-gentoo")
@@ -235,11 +235,11 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_alpine_release) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform and platform_family to alpine" do
+ it "sets platform and platform_family to alpine" do
expect(File).to receive(:read).with("/etc/alpine-release").and_return("3.2.3")
@plugin.run
expect(@plugin[:platform]).to eq("alpine")
@@ -252,11 +252,11 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_eos_release) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform to arista_eos" do
+ it "sets platform to arista_eos" do
expect(File).to receive(:read).with("/etc/Eos-release").and_return("Arista Networks EOS 4.16.7M")
@plugin.run
expect(@plugin[:platform]).to eq("arista_eos")
@@ -269,17 +269,17 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_exherbo_release) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform and platform_family to exherbo" do
+ it "sets platform and platform_family to exherbo" do
@plugin.run
expect(@plugin[:platform]).to eq("exherbo")
expect(@plugin[:platform_family]).to eq("exherbo")
end
- it "should set platform_version to kernel release" do
+ it "sets platform_version to kernel release" do
expect(@plugin).to receive(:`).with("uname -r").and_return("3.18.2-2-ARCH")
@plugin.run
expect(@plugin[:platform_version]).to eq("3.18.2-2-ARCH")
@@ -289,7 +289,7 @@ describe Ohai::System, "Linux plugin platform" do
describe "on redhat breeds" do
describe "with lsb_release results" do
- it "should set the platform to redhat and platform_family to rhel even if the LSB name is something absurd but redhat like" do
+ it "sets the platform to redhat and platform_family to rhel even if the LSB name is something absurd but redhat like" do
@plugin[:lsb][:id] = "RedHatEnterpriseServer"
@plugin[:lsb][:release] = "6.1"
@plugin.run
@@ -298,7 +298,7 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set the platform to centos and platform_family to rhel" do
+ it "sets the platform to centos and platform_family to rhel" do
@plugin[:lsb][:id] = "CentOS"
@plugin[:lsb][:release] = "5.4"
@plugin.run
@@ -307,31 +307,31 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set the platform_family to rhel if the LSB name is oracle-ish" do
+ it "sets the platform_family to rhel if the LSB name is oracle-ish" do
@plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
@plugin.run
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set the platform_family to rhel if the LSB name is amazon-ish" do
+ it "sets the platform_family to rhel if the LSB name is amazon-ish" do
@plugin[:lsb][:id] = "Amazon"
@plugin.run
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set the platform_family to fedora if the LSB name is fedora-ish" do
+ it "sets the platform_family to fedora if the LSB name is fedora-ish" do
@plugin[:lsb][:id] = "Fedora"
@plugin.run
expect(@plugin[:platform_family]).to eq("fedora")
end
- it "should set the platform_family to redhat if the LSB name is scientific-ish" do
+ it "sets the platform_family to redhat if the LSB name is scientific-ish" do
@plugin[:lsb][:id] = "Scientific"
@plugin.run
expect(@plugin[:platform_family]).to eq("rhel")
end
- it "should set the platform_family to redhat if the LSB name is ibm-ish" do
+ it "sets the platform_family to redhat if the LSB name is ibm-ish" do
@plugin[:lsb][:id] = "IBM_PowerKVM"
@plugin.run
expect(@plugin[:platform_family]).to eq("rhel")
@@ -342,11 +342,11 @@ describe Ohai::System, "Linux plugin platform" do
let(:have_redhat_release) { true }
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should read the platform as centos and version as 5.3" do
+ it "reads the platform as centos and version as 5.3" do
expect(File).to receive(:read).with("/etc/redhat-release").and_return("CentOS release 5.3")
@plugin.run
expect(@plugin[:platform]).to eq("centos")
@@ -359,28 +359,28 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform_version]).to eq("5.3")
end
- it "should read the platform as redhat and version as 5.3" do
+ it "reads the platform as redhat and version as 5.3" do
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat release 5.3")
@plugin.run
expect(@plugin[:platform]).to eq("redhat")
expect(@plugin[:platform_version]).to eq("5.3")
end
- it "should read the platform as fedora and version as 13 (rawhide)" do
+ it "reads the platform as fedora and version as 13 (rawhide)" do
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
@plugin.run
expect(@plugin[:platform]).to eq("fedora")
expect(@plugin[:platform_version]).to eq("13 (rawhide)")
end
- it "should read the platform as fedora and version as 10" do
+ it "reads the platform as fedora and version as 10" do
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 10")
@plugin.run
expect(@plugin[:platform]).to eq("fedora")
expect(@plugin[:platform_version]).to eq("10")
end
- it "should read the platform as fedora and version as 13 using to_i" do
+ it "reads the platform as fedora and version as 13 using to_i" do
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
@plugin.run
expect(@plugin[:platform]).to eq("fedora")
@@ -469,7 +469,7 @@ CISCO_RELEASE
expect(File).to receive(:read).with("/etc/shared/os-release").and_return(cisco_release_content)
end
- it "should set platform to nexus_guestshell and platform_family to rhel" do
+ it "sets platform to nexus_guestshell and platform_family to rhel" do
@plugin.run
expect(@plugin[:platform]).to start_with("nexus")
expect(@plugin[:platform]).to eq("nexus_centos")
@@ -488,7 +488,7 @@ CISCO_RELEASE
describe "with lsb_result" do
- it "should read the platform as parallels and version as 6.0.5" do
+ it "reads the platform as parallels and version as 6.0.5" do
@plugin[:lsb][:id] = "CloudLinuxServer"
@plugin[:lsb][:release] = "6.5"
allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
@@ -502,11 +502,11 @@ CISCO_RELEASE
describe "without lsb_results" do
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should read the platform as parallels and version as 6.0.5" do
+ it "reads the platform as parallels and version as 6.0.5" do
allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
expect(File).to receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
@plugin.run
@@ -527,7 +527,7 @@ CISCO_RELEASE
let(:have_enterprise_release) { true }
- it "should read the platform as oracle and version as 5.7" do
+ it "reads the platform as oracle and version as 5.7" do
@plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
@plugin[:lsb][:release] = "5.7"
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
@@ -542,7 +542,7 @@ CISCO_RELEASE
let(:have_oracle_release) { true }
- it "should read the platform as oracle and version as 6.1" do
+ it "reads the platform as oracle and version as 6.1" do
@plugin[:lsb][:id] = "OracleServer"
@plugin[:lsb][:release] = "6.1"
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
@@ -556,7 +556,7 @@ CISCO_RELEASE
end
context "without lsb_results" do
- before(:each) do
+ before do
@plugin.lsb = nil
end
@@ -564,7 +564,7 @@ CISCO_RELEASE
let(:have_enterprise_release) { true }
- it "should read the platform as oracle and version as 5" do
+ it "reads the platform as oracle and version as 5" do
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
@plugin.run
@@ -572,7 +572,7 @@ CISCO_RELEASE
expect(@plugin[:platform_version]).to eq("5")
end
- it "should read the platform as oracle and version as 5.1" do
+ it "reads the platform as oracle and version as 5.1" do
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
@plugin.run
@@ -580,7 +580,7 @@ CISCO_RELEASE
expect(@plugin[:platform_version]).to eq("5.1")
end
- it "should read the platform as oracle and version as 5.7" do
+ it "reads the platform as oracle and version as 5.7" do
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
@plugin.run
@@ -594,7 +594,7 @@ CISCO_RELEASE
let(:have_oracle_release) { true }
- it "should read the platform as oracle and version as 6.0" do
+ it "reads the platform as oracle and version as 6.0" do
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.0")
@plugin.run
@@ -602,7 +602,7 @@ CISCO_RELEASE
expect(@plugin[:platform_version]).to eq("6.0")
end
- it "should read the platform as oracle and version as 6.1" do
+ it "reads the platform as oracle and version as 6.1" do
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
@plugin.run
@@ -618,11 +618,11 @@ CISCO_RELEASE
let(:have_suse_release) { true }
describe "with lsb_release results" do
- before(:each) do
+ before do
@plugin[:lsb][:id] = "SUSE LINUX"
end
- it "should read the platform as opensuse on openSUSE" do
+ it "reads the platform as opensuse on openSUSE" do
@plugin[:lsb][:release] = "12.1"
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
@plugin.run
@@ -632,18 +632,18 @@ CISCO_RELEASE
end
describe "without lsb_release results" do
- before(:each) do
+ before do
@plugin.lsb = nil
end
- it "should set platform and platform_family to suse and bogus verion to 10.0" do
+ it "sets platform and platform_family to suse and bogus verion to 10.0" do
expect(File).to receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
@plugin.run
expect(@plugin[:platform]).to eq("suse")
expect(@plugin[:platform_family]).to eq("suse")
end
- it "should read the version as 10.1 for bogus SLES 10" do
+ it "reads the version as 10.1 for bogus SLES 10" do
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
@plugin.run
expect(@plugin[:platform]).to eq("suse")
@@ -651,7 +651,7 @@ CISCO_RELEASE
expect(@plugin[:platform_family]).to eq("suse")
end
- it "should read the version as 11.2" do
+ it "reads the version as 11.2" do
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
@plugin.run
expect(@plugin[:platform]).to eq("suse")
@@ -683,14 +683,14 @@ CISCO_RELEASE
expect(@plugin[:platform_family]).to eq("suse")
end
- it "should read the platform as opensuse on openSUSE" do
+ it "reads the platform as opensuse on openSUSE" do
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
@plugin.run
expect(@plugin[:platform]).to eq("opensuse")
expect(@plugin[:platform_family]).to eq("suse")
end
- it "should read the platform as opensuseleap on openSUSE Leap" do
+ it "reads the platform as opensuseleap on openSUSE Leap" do
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 42.1 (x86_64)\nVERSION = 42.1\nCODENAME = Malachite\n")
@plugin.run
expect(@plugin[:platform]).to eq("opensuseleap")
@@ -774,7 +774,7 @@ CISCO_RELEASE
}
end
- it "should set platform to nexus and platform_family to wrlinux" do
+ it "sets platform to nexus and platform_family to wrlinux" do
allow(@plugin).to receive(:os_release_info).and_return(os_release_info)
@plugin.lsb = nil
@plugin.run
@@ -801,7 +801,7 @@ CISCO_RELEASE
}
end
- it "should set platform to ios_xr and platform_family to wrlinux" do
+ it "sets platform to ios_xr and platform_family to wrlinux" do
allow(@plugin).to receive(:os_release_info).and_return(os_release_info)
@plugin.lsb = nil
@plugin.run
diff --git a/spec/unit/plugins/linux/sessions_spec.rb b/spec/unit/plugins/linux/sessions_spec.rb
index 89130142..fbc921d1 100644
--- a/spec/unit/plugins/linux/sessions_spec.rb
+++ b/spec/unit/plugins/linux/sessions_spec.rb
@@ -21,11 +21,11 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux sessions plugin" do
let(:plugin) { get_plugin("linux/sessions") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
end
- it "should populate sessions if loginctl is found" do
+ it "populates sessions if loginctl is found" do
loginctl_out = <<-LOGINCTL_OUT
c1 118 Debian-gdm seat0
318 0 root
@@ -90,7 +90,7 @@ LOGINCTL_OUT
})
end
- it "should not populate sessions if loginctl is not found" do
+ it "does not populate sessions if loginctl is not found" do
allow(plugin).to receive(:which).with("loginctl").and_return(false)
plugin.run
expect(plugin[:sessions]).to be(nil)
diff --git a/spec/unit/plugins/linux/uptime_spec.rb b/spec/unit/plugins/linux/uptime_spec.rb
index 4bdc46de..c95e9a3d 100644
--- a/spec/unit/plugins/linux/uptime_spec.rb
+++ b/spec/unit/plugins/linux/uptime_spec.rb
@@ -19,29 +19,29 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux plugin uptime" do
- before(:each) do
+ before do
@plugin = get_plugin("uptime")
allow(@plugin).to receive(:collect_os).and_return(:linux)
@double_file = double("/proc/uptime", { :gets => "18423 989" })
allow(File).to receive(:open).with("/proc/uptime").and_return(@double_file)
end
- it "should set uptime_seconds to uptime" do
+ it "sets uptime_seconds to uptime" do
@plugin.run
expect(@plugin[:uptime_seconds]).to eq(18423)
end
- it "should set uptime to a human readable date" do
+ it "sets uptime to a human readable date" do
@plugin.run
expect(@plugin[:uptime]).to eq("5 hours 07 minutes 03 seconds")
end
- it "should set idletime_seconds to uptime" do
+ it "sets idletime_seconds to uptime" do
@plugin.run
expect(@plugin[:idletime_seconds]).to eq(989)
end
- it "should set idletime to a human readable date" do
+ it "sets idletime to a human readable date" do
@plugin.run
expect(@plugin[:idletime]).to eq("16 minutes 29 seconds")
end
diff --git a/spec/unit/plugins/linux/virtualization_spec.rb b/spec/unit/plugins/linux/virtualization_spec.rb
index 84870b95..3c7b56c0 100644
--- a/spec/unit/plugins/linux/virtualization_spec.rb
+++ b/spec/unit/plugins/linux/virtualization_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
describe Ohai::System, "Linux virtualization platform" do
let(:plugin) { get_plugin("linux/virtualization") }
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
# default to all requested Files not existing
@@ -174,7 +174,7 @@ describe Ohai::System, "Linux virtualization platform" do
end
describe "when we are parsing dmidecode" do
- before(:each) do
+ before do
expect(File).to receive(:exist?).with("/usr/sbin/dmidecode").and_return(true)
end
@@ -345,7 +345,7 @@ OUTPUT
expect(plugin[:virtualization][:systems][:bhyve]).to eq("guest")
end
- it "should run dmidecode and not set virtualization if nothing is detected" do
+ it "runs dmidecode and not set virtualization if nothing is detected" do
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, "", ""))
plugin.run
expect(plugin[:virtualization]).to eq({ "systems" => {} })
@@ -541,7 +541,7 @@ CGROUP
end
context "/proc/self/cgroup only has / mounts" do
- before(:each) do
+ before do
self_cgroup = <<-CGROUP
8:blkio:/
7:net_cls:/
@@ -632,7 +632,7 @@ CGROUP
# Relevant at least starting docker 1.6.2, kernel 4.0.5 & systemd 224-1.
# Doi not exactly know which software/version really matters here.
- it "should set docker guest if /proc/self/cgroup exists and there are /system.slice/docker-<hexadecimal> mounts (systemd managed cgroup)" do
+ it "sets docker guest if /proc/self/cgroup exists and there are /system.slice/docker-<hexadecimal> mounts (systemd managed cgroup)" do
self_cgroup = <<-CGROUP
8:devices:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
7:cpuset:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
@@ -669,7 +669,7 @@ CGROUP
end
context "/proc/self/cgroup only has / mounts" do
- before(:each) do
+ before do
self_cgroup = <<-CGROUP
8:blkio:/
7:net_cls:/