ohai 7.6.0.rc.1 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ohai/version.rb +1 -1
  3. data/spec/functional/plugins/powershell_spec.rb +4 -4
  4. data/spec/functional/plugins/root_group_spec.rb +1 -1
  5. data/spec/ohai_spec.rb +1 -1
  6. data/spec/spec_helper.rb +12 -12
  7. data/spec/unit/dsl/plugin_spec.rb +40 -40
  8. data/spec/unit/hints_spec.rb +3 -3
  9. data/spec/unit/loader_spec.rb +16 -16
  10. data/spec/unit/mixin/cloudstack_metadata_spec.rb +1 -1
  11. data/spec/unit/mixin/command_spec.rb +6 -6
  12. data/spec/unit/mixin/ec2_metadata_spec.rb +8 -8
  13. data/spec/unit/plugins/aix/cpu_spec.rb +15 -15
  14. data/spec/unit/plugins/aix/filesystem_spec.rb +15 -15
  15. data/spec/unit/plugins/aix/hostname_spec.rb +3 -3
  16. data/spec/unit/plugins/aix/kernel_spec.rb +14 -14
  17. data/spec/unit/plugins/aix/network_spec.rb +43 -43
  18. data/spec/unit/plugins/aix/platform_spec.rb +5 -5
  19. data/spec/unit/plugins/aix/uptime_spec.rb +7 -7
  20. data/spec/unit/plugins/aix/virtualization_spec.rb +3 -3
  21. data/spec/unit/plugins/azure_spec.rb +18 -18
  22. data/spec/unit/plugins/c_spec.rb +52 -52
  23. data/spec/unit/plugins/chef_spec.rb +1 -1
  24. data/spec/unit/plugins/cloud_spec.rb +31 -31
  25. data/spec/unit/plugins/cloud_v2_spec.rb +33 -33
  26. data/spec/unit/plugins/cloudstack_spec.rb +6 -6
  27. data/spec/unit/plugins/darwin/cpu_spec.rb +19 -19
  28. data/spec/unit/plugins/darwin/hostname_spec.rb +6 -6
  29. data/spec/unit/plugins/darwin/kernel_spec.rb +14 -14
  30. data/spec/unit/plugins/darwin/memory_spec.rb +7 -7
  31. data/spec/unit/plugins/darwin/network_spec.rb +358 -358
  32. data/spec/unit/plugins/darwin/platform_spec.rb +10 -10
  33. data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
  34. data/spec/unit/plugins/dmi_spec.rb +3 -3
  35. data/spec/unit/plugins/ec2_spec.rb +80 -80
  36. data/spec/unit/plugins/erlang_spec.rb +7 -7
  37. data/spec/unit/plugins/eucalyptus_spec.rb +28 -28
  38. data/spec/unit/plugins/fail_spec.rb +8 -8
  39. data/spec/unit/plugins/freebsd/cpu_spec.rb +10 -10
  40. data/spec/unit/plugins/freebsd/hostname_spec.rb +4 -4
  41. data/spec/unit/plugins/freebsd/kernel_spec.rb +6 -6
  42. data/spec/unit/plugins/freebsd/os_spec.rb +3 -3
  43. data/spec/unit/plugins/freebsd/platform_spec.rb +5 -5
  44. data/spec/unit/plugins/freebsd/virtualization_spec.rb +20 -20
  45. data/spec/unit/plugins/gce_spec.rb +18 -18
  46. data/spec/unit/plugins/go_spec.rb +5 -5
  47. data/spec/unit/plugins/groovy_spec.rb +5 -5
  48. data/spec/unit/plugins/hostname_spec.rb +24 -24
  49. data/spec/unit/plugins/init_package_spec.rb +5 -5
  50. data/spec/unit/plugins/ip_scopes_spec.rb +1 -1
  51. data/spec/unit/plugins/java_spec.rb +23 -23
  52. data/spec/unit/plugins/joyent_spec.rb +13 -13
  53. data/spec/unit/plugins/kernel_spec.rb +20 -20
  54. data/spec/unit/plugins/linode_spec.rb +18 -18
  55. data/spec/unit/plugins/linux/cpu_spec.rb +25 -25
  56. data/spec/unit/plugins/linux/filesystem_spec.rb +61 -60
  57. data/spec/unit/plugins/linux/hostname_spec.rb +7 -7
  58. data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
  59. data/spec/unit/plugins/linux/lsb_spec.rb +23 -23
  60. data/spec/unit/plugins/linux/mdadm_spec.rb +11 -11
  61. data/spec/unit/plugins/linux/platform_spec.rb +167 -167
  62. data/spec/unit/plugins/linux/uptime_spec.rb +6 -6
  63. data/spec/unit/plugins/linux/virtualization_spec.rb +156 -156
  64. data/spec/unit/plugins/lua_spec.rb +5 -5
  65. data/spec/unit/plugins/mono_spec.rb +5 -5
  66. data/spec/unit/plugins/netbsd/hostname_spec.rb +6 -6
  67. data/spec/unit/plugins/netbsd/kernel_spec.rb +6 -6
  68. data/spec/unit/plugins/netbsd/platform_spec.rb +5 -5
  69. data/spec/unit/plugins/network_spec.rb +116 -116
  70. data/spec/unit/plugins/nodejs_spec.rb +5 -5
  71. data/spec/unit/plugins/ohai_spec.rb +1 -1
  72. data/spec/unit/plugins/ohai_time_spec.rb +5 -5
  73. data/spec/unit/plugins/openbsd/hostname_spec.rb +6 -6
  74. data/spec/unit/plugins/openbsd/kernel_spec.rb +6 -6
  75. data/spec/unit/plugins/openbsd/platform_spec.rb +4 -4
  76. data/spec/unit/plugins/openstack_spec.rb +8 -8
  77. data/spec/unit/plugins/os_spec.rb +5 -5
  78. data/spec/unit/plugins/passwd_spec.rb +13 -13
  79. data/spec/unit/plugins/perl_spec.rb +8 -8
  80. data/spec/unit/plugins/php_spec.rb +7 -7
  81. data/spec/unit/plugins/platform_spec.rb +9 -9
  82. data/spec/unit/plugins/powershell_spec.rb +10 -10
  83. data/spec/unit/plugins/rackspace_spec.rb +72 -70
  84. data/spec/unit/plugins/root_group_spec.rb +14 -14
  85. data/spec/unit/plugins/ruby_spec.rb +1 -1
  86. data/spec/unit/plugins/sigar/network_route_spec.rb +17 -17
  87. data/spec/unit/plugins/solaris2/cpu_spec.rb +18 -18
  88. data/spec/unit/plugins/solaris2/hostname_spec.rb +4 -4
  89. data/spec/unit/plugins/solaris2/kernel_spec.rb +8 -8
  90. data/spec/unit/plugins/solaris2/memory_spec.rb +3 -3
  91. data/spec/unit/plugins/solaris2/network_spec.rb +13 -13
  92. data/spec/unit/plugins/solaris2/platform_spec.rb +14 -14
  93. data/spec/unit/plugins/solaris2/virtualization_spec.rb +24 -24
  94. data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
  95. data/spec/unit/plugins/ssh_host_keys_spec.rb +18 -18
  96. data/spec/unit/runner_spec.rb +26 -26
  97. data/spec/unit/system_spec.rb +54 -54
  98. data/spec/unit/util/file_helper_spec.rb +2 -2
  99. metadata +50 -95
@@ -49,24 +49,24 @@ describe Ohai::System, "plugin linode" do
49
49
  shared_examples_for "!linode" do
50
50
  it "does not create the linode mash" do
51
51
  @plugin.run
52
- @plugin[:linode].should be_nil
52
+ expect(@plugin[:linode]).to be_nil
53
53
  end
54
54
  end
55
55
 
56
56
  shared_examples_for "linode" do
57
57
  it "creates a linode mash" do
58
58
  @plugin.run
59
- @plugin[:linode].should_not be_nil
59
+ expect(@plugin[:linode]).not_to be_nil
60
60
  end
61
61
 
62
62
  it "has all required attributes" do
63
63
  @plugin.run
64
- @plugin[:linode][:public_ip].should_not be_nil
64
+ expect(@plugin[:linode][:public_ip]).not_to be_nil
65
65
  end
66
66
 
67
67
  it "has correct values for all attributes" do
68
68
  @plugin.run
69
- @plugin[:linode][:public_ip].should == "1.2.3.4"
69
+ expect(@plugin[:linode][:public_ip]).to eq("1.2.3.4")
70
70
  end
71
71
 
72
72
  end
@@ -111,8 +111,8 @@ describe Ohai::System, "plugin linode" do
111
111
 
112
112
  it "detects and sets the private ip" do
113
113
  @plugin.run
114
- @plugin[:linode][:private_ip].should_not be_nil
115
- @plugin[:linode][:private_ip].should == "5.6.7.8"
114
+ expect(@plugin[:linode][:private_ip]).not_to be_nil
115
+ expect(@plugin[:linode][:private_ip]).to eq("5.6.7.8")
116
116
  end
117
117
  end
118
118
 
@@ -120,10 +120,10 @@ describe Ohai::System, "plugin linode" do
120
120
 
121
121
  describe "with linode cloud file" do
122
122
  before do
123
- File.stub(:exist?).with(hint_path_nix).and_return(true)
124
- File.stub(:read).with(hint_path_nix).and_return('')
125
- File.stub(:exist?).with(hint_path_win).and_return(true)
126
- File.stub(:read).with(hint_path_win).and_return('')
123
+ allow(File).to receive(:exist?).with(hint_path_nix).and_return(true)
124
+ allow(File).to receive(:read).with(hint_path_nix).and_return('')
125
+ allow(File).to receive(:exist?).with(hint_path_win).and_return(true)
126
+ allow(File).to receive(:read).with(hint_path_win).and_return('')
127
127
  end
128
128
 
129
129
  it_should_behave_like "linode"
@@ -131,8 +131,8 @@ describe Ohai::System, "plugin linode" do
131
131
 
132
132
  describe "without cloud file" do
133
133
  before do
134
- File.stub(:exist?).with(hint_path_nix).and_return(false)
135
- File.stub(:exist?).with(hint_path_win).and_return(false)
134
+ allow(File).to receive(:exist?).with(hint_path_nix).and_return(false)
135
+ allow(File).to receive(:exist?).with(hint_path_win).and_return(false)
136
136
  end
137
137
 
138
138
  it_should_behave_like "!linode"
@@ -143,13 +143,13 @@ describe Ohai::System, "plugin linode" do
143
143
  let(:ec2_hint_path_win) { 'C:\chef\ohai\hints/ec2.json' }
144
144
 
145
145
  before do
146
- File.stub(:exist?).with(hint_path_nix).and_return(false)
147
- File.stub(:exist?).with(hint_path_win).and_return(false)
146
+ allow(File).to receive(:exist?).with(hint_path_nix).and_return(false)
147
+ allow(File).to receive(:exist?).with(hint_path_win).and_return(false)
148
148
 
149
- File.stub(:exist?).with(ec2_hint_path_nix).and_return(true)
150
- File.stub(:read).with(ec2_hint_path_nix).and_return('')
151
- File.stub(:exist?).with(ec2_hint_path_win).and_return(true)
152
- File.stub(:read).with(ec2_hint_path_win).and_return('')
149
+ allow(File).to receive(:exist?).with(ec2_hint_path_nix).and_return(true)
150
+ allow(File).to receive(:read).with(ec2_hint_path_nix).and_return('')
151
+ allow(File).to receive(:exist?).with(ec2_hint_path_win).and_return(true)
152
+ allow(File).to receive(:read).with(ec2_hint_path_win).and_return('')
153
153
  end
154
154
 
155
155
  it_should_behave_like "!linode"
@@ -22,9 +22,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "Linux cpu plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("linux/cpu")
25
- @plugin.stub(:collect_os).and_return(:linux)
25
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
26
26
  @double_file = double("/proc/cpuinfo")
27
- @double_file.stub(:each).
27
+ allow(@double_file).to receive(:each).
28
28
  and_yield("processor : 0").
29
29
  and_yield("vendor_id : GenuineIntel").
30
30
  and_yield("cpu family : 6").
@@ -44,84 +44,84 @@ describe Ohai::System, "Linux cpu plugin" do
44
44
  and_yield("flags : fpu pse tsc msr mce cx8 sep mtrr pge cmov").
45
45
  and_yield("bogomips : 2575.86").
46
46
  and_yield("clflush size : 32")
47
- File.stub(:open).with("/proc/cpuinfo").and_return(@double_file)
47
+ allow(File).to receive(:open).with("/proc/cpuinfo").and_return(@double_file)
48
48
  end
49
49
 
50
50
  it "should set cpu[:total] to 1" do
51
51
  @plugin.run
52
- @plugin[:cpu][:total].should == 1
52
+ expect(@plugin[:cpu][:total]).to eq(1)
53
53
  end
54
54
 
55
55
  it "should set cpu[:real] to 0" do
56
56
  @plugin.run
57
- @plugin[:cpu][:real].should == 0
57
+ expect(@plugin[:cpu][:real]).to eq(0)
58
58
  end
59
59
 
60
60
  it "should have a cpu 0" do
61
61
  @plugin.run
62
- @plugin[:cpu].should have_key("0")
62
+ expect(@plugin[:cpu]).to have_key("0")
63
63
  end
64
64
 
65
65
  it "should have a vendor_id for cpu 0" do
66
66
  @plugin.run
67
- @plugin[:cpu]["0"].should have_key("vendor_id")
68
- @plugin[:cpu]["0"]["vendor_id"].should eql("GenuineIntel")
67
+ expect(@plugin[:cpu]["0"]).to have_key("vendor_id")
68
+ expect(@plugin[:cpu]["0"]["vendor_id"]).to eql("GenuineIntel")
69
69
  end
70
70
 
71
71
  it "should have a family for cpu 0" do
72
72
  @plugin.run
73
- @plugin[:cpu]["0"].should have_key("family")
74
- @plugin[:cpu]["0"]["family"].should eql("6")
73
+ expect(@plugin[:cpu]["0"]).to have_key("family")
74
+ expect(@plugin[:cpu]["0"]["family"]).to eql("6")
75
75
  end
76
76
 
77
77
  it "should have a model for cpu 0" do
78
78
  @plugin.run
79
- @plugin[:cpu]["0"].should have_key("model")
80
- @plugin[:cpu]["0"]["model"].should eql("23")
79
+ expect(@plugin[:cpu]["0"]).to have_key("model")
80
+ expect(@plugin[:cpu]["0"]["model"]).to eql("23")
81
81
  end
82
82
 
83
83
  it "should have a stepping for cpu 0" do
84
84
  @plugin.run
85
- @plugin[:cpu]["0"].should have_key("stepping")
86
- @plugin[:cpu]["0"]["stepping"].should eql("6")
85
+ expect(@plugin[:cpu]["0"]).to have_key("stepping")
86
+ expect(@plugin[:cpu]["0"]["stepping"]).to eql("6")
87
87
  end
88
88
 
89
89
  it "should not have a phyiscal_id for cpu 0" do
90
90
  @plugin.run
91
- @plugin[:cpu]["0"].should_not have_key("physical_id")
91
+ expect(@plugin[:cpu]["0"]).not_to have_key("physical_id")
92
92
  end
93
93
 
94
94
  it "should not have a core_id for cpu 0" do
95
95
  @plugin.run
96
- @plugin[:cpu]["0"].should_not have_key("core_id")
96
+ expect(@plugin[:cpu]["0"]).not_to have_key("core_id")
97
97
  end
98
98
 
99
99
  it "should not have a cores for cpu 0" do
100
100
  @plugin.run
101
- @plugin[:cpu]["0"].should_not have_key("cores")
101
+ expect(@plugin[:cpu]["0"]).not_to have_key("cores")
102
102
  end
103
103
 
104
104
  it "should have a model name for cpu 0" do
105
105
  @plugin.run
106
- @plugin[:cpu]["0"].should have_key("model_name")
107
- @plugin[:cpu]["0"]["model_name"].should eql("Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz")
106
+ expect(@plugin[:cpu]["0"]).to have_key("model_name")
107
+ expect(@plugin[:cpu]["0"]["model_name"]).to eql("Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz")
108
108
  end
109
109
 
110
110
  it "should have a mhz for cpu 0" do
111
111
  @plugin.run
112
- @plugin[:cpu]["0"].should have_key("mhz")
113
- @plugin[:cpu]["0"]["mhz"].should eql("1968.770")
112
+ expect(@plugin[:cpu]["0"]).to have_key("mhz")
113
+ expect(@plugin[:cpu]["0"]["mhz"]).to eql("1968.770")
114
114
  end
115
115
 
116
116
  it "should have a cache_size for cpu 0" do
117
117
  @plugin.run
118
- @plugin[:cpu]["0"].should have_key("cache_size")
119
- @plugin[:cpu]["0"]["cache_size"].should eql("64 KB")
118
+ expect(@plugin[:cpu]["0"]).to have_key("cache_size")
119
+ expect(@plugin[:cpu]["0"]["cache_size"]).to eql("64 KB")
120
120
  end
121
121
 
122
122
  it "should have flags for cpu 0" do
123
123
  @plugin.run
124
- @plugin[:cpu]["0"].should have_key("flags")
125
- @plugin[:cpu]["0"]["flags"].should == %w{fpu pse tsc msr mce cx8 sep mtrr pge cmov}
124
+ expect(@plugin[:cpu]["0"]).to have_key("flags")
125
+ expect(@plugin[:cpu]["0"]["flags"]).to eq(%w{fpu pse tsc msr mce cx8 sep mtrr pge cmov})
126
126
  end
127
127
  end
@@ -21,27 +21,27 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
  describe Ohai::System, "Linux filesystem plugin" do
22
22
  before(:each) do
23
23
  @plugin = get_plugin("linux/filesystem")
24
- @plugin.stub(:collect_os).and_return(:linux)
24
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
25
25
 
26
- @plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
27
- @plugin.stub(:shell_out).with("df -i").and_return(mock_shell_out(0, "", ""))
28
- @plugin.stub(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
29
- File.stub(:exist?).with("/bin/lsblk").and_return(false)
30
- @plugin.stub(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, "", ""))
31
- @plugin.stub(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, "", ""))
32
- @plugin.stub(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, "", ""))
26
+ allow(@plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
27
+ allow(@plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, "", ""))
28
+ allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
29
+ allow(File).to receive(:exist?).with("/bin/lsblk").and_return(false)
30
+ allow(@plugin).to receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, "", ""))
31
+ allow(@plugin).to receive(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, "", ""))
32
+ allow(@plugin).to receive(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, "", ""))
33
33
 
34
- @plugin.stub(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
34
+ allow(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
35
35
  and_return(mock_shell_out(0, "", ""))
36
- @plugin.stub(:shell_out).with("lsblk -r -n -o NAME,UUID").
36
+ allow(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,UUID").
37
37
  and_return(mock_shell_out(0, "", ""))
38
- @plugin.stub(:shell_out).with("lsblk -r -n -o NAME,LABEL").
38
+ allow(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,LABEL").
39
39
  and_return(mock_shell_out(0, "", ""))
40
40
 
41
- File.stub(:exist?).with("/proc/mounts").and_return(false)
41
+ allow(File).to receive(:exist?).with("/proc/mounts").and_return(false)
42
42
 
43
43
  %w{sdb1 sdb2 sda1 sda2 md0 md1 md2}.each do |name|
44
- File.stub(:exist?).with("/dev/#{name}").and_return(true)
44
+ allow(File).to receive(:exist?).with("/dev/#{name}").and_return(true)
45
45
  end
46
46
  %w{
47
47
  sys.vg-root.lv
@@ -51,8 +51,8 @@ describe Ohai::System, "Linux filesystem plugin" do
51
51
  sys.vg-var.lv
52
52
  sys.vg-home.lv
53
53
  }.each do |name|
54
- File.stub(:exist?).with("/dev/#{name}").and_return(false)
55
- File.stub(:exist?).with("/dev/mapper/#{name}").and_return(true)
54
+ allow(File).to receive(:exist?).with("/dev/#{name}").and_return(false)
55
+ allow(File).to receive(:exist?).with("/dev/mapper/#{name}").and_return(true)
56
56
  end
57
57
  end
58
58
 
@@ -71,7 +71,7 @@ tmpfs 2030944 2960 2027984 1% /dev/shm
71
71
  /dev/mapper/sys.vg-var.lv 19223252 3436556 14810212 19% /var
72
72
  /dev/md0 960492 36388 875312 4% /boot
73
73
  DF
74
- @plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, @stdout, ""))
74
+ allow(@plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @stdout, ""))
75
75
 
76
76
  @inode_stdout = <<-DFi
77
77
  Filesystem Inodes IUsed IFree IUse% Mounted on
@@ -81,53 +81,53 @@ tmpfs 126922 273 126649 1% /run
81
81
  none 126922 1 126921 1% /run/lock
82
82
  none 126922 1 126921 1% /run/shm
83
83
  DFi
84
- @plugin.stub(:shell_out).with("df -i").and_return(mock_shell_out(0, @inode_stdout, ""))
84
+ allow(@plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, @inode_stdout, ""))
85
85
  end
86
86
 
87
87
  it "should run df -P and df -i" do
88
- @plugin.should_receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
89
- @plugin.should_receive(:shell_out).ordered.with("df -i").and_return(mock_shell_out(0, @inode_stdout, ""))
88
+ expect(@plugin).to receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
89
+ expect(@plugin).to receive(:shell_out).ordered.with("df -i").and_return(mock_shell_out(0, @inode_stdout, ""))
90
90
  @plugin.run
91
91
  end
92
92
 
93
93
  it "should set kb_size to value from df -P" do
94
94
  @plugin.run
95
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_size].should be == "97605057"
95
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_size]).to eq("97605057")
96
96
  end
97
97
 
98
98
  it "should set kb_used to value from df -P" do
99
99
  @plugin.run
100
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_used].should be == "53563253"
100
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_used]).to eq("53563253")
101
101
  end
102
102
 
103
103
  it "should set kb_available to value from df -P" do
104
104
  @plugin.run
105
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_available].should be == "44041805"
105
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_available]).to eq("44041805")
106
106
  end
107
107
 
108
108
  it "should set percent_used to value from df -P" do
109
109
  @plugin.run
110
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:percent_used].should be == "56%"
110
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:percent_used]).to eq("56%")
111
111
  end
112
112
 
113
113
  it "should set mount to value from df -P" do
114
114
  @plugin.run
115
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount].should be == "/special"
115
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
116
116
  end
117
117
 
118
118
  it "should set total_inodes to value from df -i" do
119
119
  @plugin.run
120
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:total_inodes].should be == "124865"
120
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:total_inodes]).to eq("124865")
121
121
  end
122
122
 
123
123
  it "should set inodes_used to value from df -i" do
124
124
  @plugin.run
125
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_used].should be == "380"
125
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_used]).to eq("380")
126
126
  end
127
127
 
128
128
  it "should set inodes_available to value from df -i" do
129
129
  @plugin.run
130
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_available].should be == "124485"
130
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_available]).to eq("124485")
131
131
  end
132
132
  end
133
133
 
@@ -150,27 +150,27 @@ devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
150
150
  fusectl on /sys/fs/fuse/connections type fusectl (rw)
151
151
  binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
152
152
  MOUNT
153
- @plugin.stub(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
153
+ allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
154
154
  end
155
155
 
156
156
  it "should run mount" do
157
- @plugin.should_receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
157
+ expect(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
158
158
  @plugin.run
159
159
  end
160
160
 
161
161
  it "should set mount to value from mount" do
162
162
  @plugin.run
163
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount].should be == "/special"
163
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
164
164
  end
165
165
 
166
166
  it "should set fs_type to value from mount" do
167
167
  @plugin.run
168
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type].should be == "xfs"
168
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type]).to eq("xfs")
169
169
  end
170
170
 
171
171
  it "should set mount_options to an array of values from mount" do
172
172
  @plugin.run
173
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options].should be == [ "ro", "noatime" ]
173
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options]).to eq([ "ro", "noatime" ])
174
174
  end
175
175
  end
176
176
 
@@ -190,23 +190,23 @@ MOUNT
190
190
  /dev/mapper/sys.vg-var.lv: TYPE=\"ext4\"
191
191
  /dev/mapper/sys.vg-home.lv: TYPE=\"xfs\"
192
192
  BLKID_TYPE
193
- @plugin.stub(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, @stdout, ""))
193
+ allow(@plugin).to receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, @stdout, ""))
194
194
  end
195
195
 
196
196
  it "should run blkid -s TYPE" do
197
- @plugin.should_receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, @stdout, ""))
197
+ expect(@plugin).to receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, @stdout, ""))
198
198
  @plugin.run
199
199
  end
200
200
 
201
201
  it "should set kb_size to value from blkid -s TYPE" do
202
202
  @plugin.run
203
- @plugin[:filesystem]["/dev/md1"][:fs_type].should be == "LVM2_member"
203
+ expect(@plugin[:filesystem]["/dev/md1"][:fs_type]).to eq("LVM2_member")
204
204
  end
205
205
  end
206
206
 
207
207
  describe "when gathering filesystem type data from lsblk" do
208
208
  before(:each) do
209
- File.stub(:exist?).with("/bin/lsblk").and_return(true)
209
+ allow(File).to receive(:exist?).with("/bin/lsblk").and_return(true)
210
210
  @stdout = <<-BLKID_TYPE
211
211
  sdb1 linux_raid_member
212
212
  sdb2 linux_raid_member
@@ -221,19 +221,19 @@ sys.vg-usr.lv ext4
221
221
  sys.vg-var.lv ext4
222
222
  sys.vg-home.lv xfs
223
223
  BLKID_TYPE
224
- @plugin.stub(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
224
+ allow(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
225
225
  and_return(mock_shell_out(0, @stdout, ""))
226
226
  end
227
227
 
228
228
  it "should run lsblk -r -n -o NAME,FSTYPE" do
229
- @plugin.should_receive(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
229
+ expect(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
230
230
  and_return(mock_shell_out(0, @stdout, ""))
231
231
  @plugin.run
232
232
  end
233
233
 
234
234
  it "should set kb_size to value from lsblk -r -n -o NAME,FSTYPE" do
235
235
  @plugin.run
236
- @plugin[:filesystem]["/dev/md1"][:fs_type].should be == "LVM2_member"
236
+ expect(@plugin[:filesystem]["/dev/md1"][:fs_type]).to eq("LVM2_member")
237
237
  end
238
238
  end
239
239
 
@@ -253,23 +253,23 @@ BLKID_TYPE
253
253
  /dev/mapper/sys.vg-var.lv: UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\"
254
254
  /dev/mapper/sys.vg-home.lv: UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\"
255
255
  BLKID_UUID
256
- @plugin.stub(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, @stdout, ""))
256
+ allow(@plugin).to receive(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, @stdout, ""))
257
257
  end
258
258
 
259
259
  it "should run blkid -s UUID" do
260
- @plugin.should_receive(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, @stdout, ""))
260
+ expect(@plugin).to receive(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, @stdout, ""))
261
261
  @plugin.run
262
262
  end
263
263
 
264
264
  it "should set kb_size to value from blkid -s UUID" do
265
265
  @plugin.run
266
- @plugin[:filesystem]["/dev/sda2"][:uuid].should be == "e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa"
266
+ expect(@plugin[:filesystem]["/dev/sda2"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
267
267
  end
268
268
  end
269
269
 
270
270
  describe "when gathering filesystem uuid data from lsblk" do
271
271
  before(:each) do
272
- File.stub(:exist?).with("/bin/lsblk").and_return(true)
272
+ allow(File).to receive(:exist?).with("/bin/lsblk").and_return(true)
273
273
  @stdout = <<-BLKID_UUID
274
274
  sdb1 bd1197e0-6997-1f3a-e27e-7801388308b5
275
275
  sdb2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa
@@ -284,20 +284,21 @@ sys.vg-usr.lv 26ec33c5-d00b-4f88-a550-492def013bbc
284
284
  sys.vg-var.lv 6b559c35-7847-4ae2-b512-c99012d3f5b3
285
285
  sys.vg-home.lv d6efda02-1b73-453c-8c74-7d8dee78fa5e
286
286
  BLKID_UUID
287
- @plugin.stub(:shell_out).with("lsblk -r -n -o NAME,UUID").
287
+ allow(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,UUID").
288
288
  and_return(mock_shell_out(0, @stdout, ""))
289
289
  end
290
290
 
291
291
  it "should run lsblk -r -n -o NAME,UUID" do
292
- @plugin.should_receive(:shell_out).with("lsblk -r -n -o NAME,UUID").
292
+ expect(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,UUID").
293
293
  and_return(mock_shell_out(0, @stdout, ""))
294
294
  @plugin.run
295
295
  end
296
296
 
297
297
  it "should set kb_size to value from lsblk -r -n -o NAME,UUID" do
298
298
  @plugin.run
299
- @plugin[:filesystem]["/dev/sda2"][:uuid].should be ==
299
+ expect(@plugin[:filesystem]["/dev/sda2"][:uuid]).to eq(
300
300
  "e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa"
301
+ )
301
302
  end
302
303
  end
303
304
 
@@ -315,23 +316,23 @@ BLKID_UUID
315
316
  /dev/mapper/sys.vg-var.lv: LABEL=\"/var\"
316
317
  /dev/mapper/sys.vg-home.lv: LABEL=\"/home\"
317
318
  BLKID_LABEL
318
- @plugin.stub(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, @stdout, ""))
319
+ allow(@plugin).to receive(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, @stdout, ""))
319
320
  end
320
321
 
321
322
  it "should run blkid -s LABEL" do
322
- @plugin.should_receive(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, @stdout, ""))
323
+ expect(@plugin).to receive(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, @stdout, ""))
323
324
  @plugin.run
324
325
  end
325
326
 
326
327
  it "should set kb_size to value from blkid -s LABEL" do
327
328
  @plugin.run
328
- @plugin[:filesystem]["/dev/md0"][:label].should be == "/boot"
329
+ expect(@plugin[:filesystem]["/dev/md0"][:label]).to eq("/boot")
329
330
  end
330
331
  end
331
332
 
332
333
  describe "when gathering filesystem label data from lsblk" do
333
334
  before(:each) do
334
- File.stub(:exist?).with("/bin/lsblk").and_return(true)
335
+ allow(File).to receive(:exist?).with("/bin/lsblk").and_return(true)
335
336
  @stdout = <<-BLKID_LABEL
336
337
  sda1 fuego:0
337
338
  sda2 fuego:1
@@ -344,26 +345,26 @@ sys.vg-usr.lv /usr
344
345
  sys.vg-var.lv /var
345
346
  sys.vg-home.lv /home
346
347
  BLKID_LABEL
347
- @plugin.stub(:shell_out).with("lsblk -r -n -o NAME,LABEL").
348
+ allow(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,LABEL").
348
349
  and_return(mock_shell_out(0, @stdout, ""))
349
350
  end
350
351
 
351
352
  it "should run blkid -s LABEL" do
352
- @plugin.should_receive(:shell_out).with("lsblk -r -n -o NAME,LABEL").
353
+ expect(@plugin).to receive(:shell_out).with("lsblk -r -n -o NAME,LABEL").
353
354
  and_return(mock_shell_out(0, @stdout, ""))
354
355
  @plugin.run
355
356
  end
356
357
 
357
358
  it "should set kb_size to value from blkid -s LABEL" do
358
359
  @plugin.run
359
- @plugin[:filesystem]["/dev/md0"][:label].should be == "/boot"
360
+ expect(@plugin[:filesystem]["/dev/md0"][:label]).to eq("/boot")
360
361
  end
361
362
  end
362
363
 
363
364
 
364
365
  describe "when gathering data from /proc/mounts" do
365
366
  before(:each) do
366
- File.stub(:exist?).with("/proc/mounts").and_return(true)
367
+ allow(File).to receive(:exist?).with("/proc/mounts").and_return(true)
367
368
  @double_file = double("/proc/mounts")
368
369
  @mounts = <<-MOUNTS
369
370
  rootfs / rootfs rw 0 0
@@ -384,28 +385,28 @@ fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
384
385
  binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
385
386
  MOUNTS
386
387
  @counter = 0
387
- @double_file.stub(:read_nonblock) do
388
+ allow(@double_file).to receive(:read_nonblock) do
388
389
  @counter += 1
389
390
  raise EOFError if @counter == 2
390
391
  @mounts
391
392
  end
392
- @double_file.stub(:close)
393
- File.stub(:open).with("/proc/mounts").and_return(@double_file)
393
+ allow(@double_file).to receive(:close)
394
+ allow(File).to receive(:open).with("/proc/mounts").and_return(@double_file)
394
395
  end
395
396
 
396
397
  it "should set mount to value from /proc/mounts" do
397
398
  @plugin.run
398
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount].should be == "/special"
399
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
399
400
  end
400
401
 
401
402
  it "should set fs_type to value from /proc/mounts" do
402
403
  @plugin.run
403
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type].should be == "xfs"
404
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type]).to eq("xfs")
404
405
  end
405
406
 
406
407
  it "should set mount_options to an array of values from /proc/mounts" do
407
408
  @plugin.run
408
- @plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options].should be == [ "ro", "noatime", "attr2", "noquota" ]
409
+ expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options]).to eq([ "ro", "noatime", "attr2", "noquota" ])
409
410
  end
410
411
  end
411
412