ohai 15.2.5 → 15.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ohai/application.rb +2 -2
  3. data/lib/ohai/mixin/dmi_decode.rb +4 -1
  4. data/lib/ohai/plugins/linux/sysctl.rb +38 -0
  5. data/lib/ohai/plugins/linux/virtualization.rb +11 -10
  6. data/lib/ohai/plugins/openstack.rb +8 -3
  7. data/lib/ohai/plugins/passwd.rb +4 -0
  8. data/lib/ohai/version.rb +1 -1
  9. data/spec/functional/application_spec.rb +5 -5
  10. data/spec/functional/loader_spec.rb +2 -2
  11. data/spec/functional/plugins/powershell_spec.rb +11 -5
  12. data/spec/functional/plugins/root_group_spec.rb +1 -1
  13. data/spec/functional/plugins/windows/uptime_spec.rb +3 -3
  14. data/spec/ohai_spec.rb +1 -1
  15. data/spec/spec_helper.rb +8 -8
  16. data/spec/support/integration_helper.rb +3 -3
  17. data/spec/unit/application_spec.rb +5 -5
  18. data/spec/unit/dsl/plugin_spec.rb +8 -7
  19. data/spec/unit/mixin/command_spec.rb +2 -2
  20. data/spec/unit/mixin/dmi_decode.rb +8 -1
  21. data/spec/unit/plugins/abort_spec.rb +4 -4
  22. data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
  23. data/spec/unit/plugins/aix/filesystem_spec.rb +1 -1
  24. data/spec/unit/plugins/aix/hostname_spec.rb +2 -2
  25. data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
  26. data/spec/unit/plugins/aix/memory_spec.rb +5 -5
  27. data/spec/unit/plugins/aix/network_spec.rb +4 -1
  28. data/spec/unit/plugins/aix/platform_spec.rb +4 -4
  29. data/spec/unit/plugins/aix/uptime_spec.rb +3 -3
  30. data/spec/unit/plugins/aix/virtualization_spec.rb +1 -1
  31. data/spec/unit/plugins/azure_spec.rb +8 -8
  32. data/spec/unit/plugins/bsd/filesystem_spec.rb +17 -16
  33. data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
  34. data/spec/unit/plugins/c_spec.rb +6 -5
  35. data/spec/unit/plugins/chef_spec.rb +2 -2
  36. data/spec/unit/plugins/cloud_spec.rb +4 -4
  37. data/spec/unit/plugins/darwin/cpu_spec.rb +11 -11
  38. data/spec/unit/plugins/darwin/filesystem_spec.rb +14 -13
  39. data/spec/unit/plugins/darwin/hardware_spec.rb +2 -1
  40. data/spec/unit/plugins/darwin/hostname_spec.rb +3 -3
  41. data/spec/unit/plugins/darwin/kernel_spec.rb +5 -5
  42. data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
  43. data/spec/unit/plugins/darwin/network_spec.rb +3 -3
  44. data/spec/unit/plugins/darwin/platform_spec.rb +9 -9
  45. data/spec/unit/plugins/darwin/virtualization_spec.rb +10 -10
  46. data/spec/unit/plugins/digital_ocean_spec.rb +14 -12
  47. data/spec/unit/plugins/dmi_spec.rb +1 -1
  48. data/spec/unit/plugins/docker_spec.rb +2 -2
  49. data/spec/unit/plugins/ec2_spec.rb +41 -30
  50. data/spec/unit/plugins/elixir_spec.rb +2 -2
  51. data/spec/unit/plugins/erlang_spec.rb +1 -1
  52. data/spec/unit/plugins/eucalyptus_spec.rb +17 -13
  53. data/spec/unit/plugins/fail_spec.rb +15 -15
  54. data/spec/unit/plugins/freebsd/cpu_spec.rb +2 -2
  55. data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
  56. data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -2
  57. data/spec/unit/plugins/freebsd/platform_spec.rb +3 -3
  58. data/spec/unit/plugins/gce_spec.rb +9 -7
  59. data/spec/unit/plugins/go_spec.rb +2 -2
  60. data/spec/unit/plugins/groovy_spec.rb +1 -1
  61. data/spec/unit/plugins/haskell_spec.rb +10 -10
  62. data/spec/unit/plugins/hostname_spec.rb +15 -14
  63. data/spec/unit/plugins/init_package_spec.rb +4 -4
  64. data/spec/unit/plugins/java_spec.rb +7 -3
  65. data/spec/unit/plugins/joyent_spec.rb +4 -4
  66. data/spec/unit/plugins/kernel_spec.rb +1 -1
  67. data/spec/unit/plugins/linux/block_device_spec.rb +2 -2
  68. data/spec/unit/plugins/linux/cpu_spec.rb +9 -8
  69. data/spec/unit/plugins/linux/filesystem_spec.rb +36 -35
  70. data/spec/unit/plugins/linux/fips_spec.rb +7 -5
  71. data/spec/unit/plugins/linux/hostname_spec.rb +4 -4
  72. data/spec/unit/plugins/linux/hostnamectl_spec.rb +3 -3
  73. data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
  74. data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
  75. data/spec/unit/plugins/linux/lspci_spec.rb +2 -1
  76. data/spec/unit/plugins/linux/machineid_spec.rb +3 -3
  77. data/spec/unit/plugins/linux/mdadm_spec.rb +13 -13
  78. data/spec/unit/plugins/linux/memory_spec.rb +39 -39
  79. data/spec/unit/plugins/linux/network_spec.rb +20 -19
  80. data/spec/unit/plugins/linux/platform_spec.rb +60 -57
  81. data/spec/unit/plugins/linux/sessions_spec.rb +3 -3
  82. data/spec/unit/plugins/linux/sysctl_spec.rb +53 -0
  83. data/spec/unit/plugins/linux/systemd_paths_spec.rb +3 -3
  84. data/spec/unit/plugins/linux/uptime_spec.rb +5 -5
  85. data/spec/unit/plugins/linux/virtualization_spec.rb +4 -4
  86. data/spec/unit/plugins/lua_spec.rb +1 -1
  87. data/spec/unit/plugins/mono_spec.rb +1 -1
  88. data/spec/unit/plugins/netbsd/hostname_spec.rb +3 -3
  89. data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
  90. data/spec/unit/plugins/netbsd/platform_spec.rb +3 -3
  91. data/spec/unit/plugins/network_spec.rb +3 -3
  92. data/spec/unit/plugins/nodejs_spec.rb +1 -1
  93. data/spec/unit/plugins/ohai_spec.rb +2 -2
  94. data/spec/unit/plugins/ohai_time_spec.rb +4 -4
  95. data/spec/unit/plugins/openbsd/hostname_spec.rb +3 -3
  96. data/spec/unit/plugins/openbsd/kernel_spec.rb +2 -2
  97. data/spec/unit/plugins/openbsd/platform_spec.rb +2 -2
  98. data/spec/unit/plugins/openstack_spec.rb +13 -8
  99. data/spec/unit/plugins/os_spec.rb +12 -12
  100. data/spec/unit/plugins/packages_spec.rb +10 -7
  101. data/spec/unit/plugins/passwd_spec.rb +18 -19
  102. data/spec/unit/plugins/perl_spec.rb +1 -1
  103. data/spec/unit/plugins/php_spec.rb +1 -1
  104. data/spec/unit/plugins/platform_spec.rb +7 -7
  105. data/spec/unit/plugins/powershell_spec.rb +1 -1
  106. data/spec/unit/plugins/rackspace_spec.rb +25 -20
  107. data/spec/unit/plugins/root_group_spec.rb +14 -10
  108. data/spec/unit/plugins/ruby_spec.rb +2 -2
  109. data/spec/unit/plugins/rust_spec.rb +3 -3
  110. data/spec/unit/plugins/scala_spec.rb +2 -2
  111. data/spec/unit/plugins/scaleway_spec.rb +14 -12
  112. data/spec/unit/plugins/scsi_spec.rb +2 -1
  113. data/spec/unit/plugins/shard_spec.rb +18 -16
  114. data/spec/unit/plugins/solaris2/cpu_spec.rb +29 -29
  115. data/spec/unit/plugins/solaris2/dmi_spec.rb +4 -4
  116. data/spec/unit/plugins/solaris2/filesystem.rb +3 -3
  117. data/spec/unit/plugins/solaris2/hostname_spec.rb +2 -2
  118. data/spec/unit/plugins/solaris2/kernel_spec.rb +4 -4
  119. data/spec/unit/plugins/solaris2/memory_spec.rb +4 -4
  120. data/spec/unit/plugins/solaris2/platform_spec.rb +9 -9
  121. data/spec/unit/plugins/solaris2/virtualization_spec.rb +6 -6
  122. data/spec/unit/plugins/ssh_host_keys_spec.rb +4 -1
  123. data/spec/unit/plugins/sysconf_spec.rb +2 -2
  124. data/spec/unit/plugins/timezone_spec.rb +2 -2
  125. data/spec/unit/plugins/virtualbox_spec.rb +10 -10
  126. data/spec/unit/plugins/vmware_spec.rb +4 -4
  127. data/spec/unit/plugins/windows/cpu_spec.rb +13 -13
  128. data/spec/unit/plugins/windows/filesystem_spec.rb +1 -1
  129. data/spec/unit/plugins/windows/fips_spec.rb +7 -5
  130. data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
  131. data/spec/unit/plugins/windows/memory_spec.rb +4 -4
  132. data/spec/unit/plugins/windows/network_spec.rb +1 -1
  133. data/spec/unit/plugins/windows/system_enclosure_spec.rb +2 -2
  134. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  135. data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
  136. data/spec/unit/plugins/zpools_spec.rb +2 -0
  137. data/spec/unit/provides_map_spec.rb +18 -18
  138. data/spec/unit/runner_spec.rb +29 -29
  139. data/spec/unit/system_spec.rb +13 -13
  140. data/spec/unit/util/file_helper_spec.rb +1 -1
  141. data/spec/unit/util/ip_helper_spec.rb +6 -6
  142. metadata +4 -2
@@ -20,7 +20,8 @@ require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "Linux lspci plugin" do
22
22
  let(:plugin) { get_plugin("linux/lspci") }
23
- before(:each) do
23
+
24
+ before do
24
25
  allow(plugin).to receive(:collect_os).and_return(:linux)
25
26
  @stdout = <<~LSPCI
26
27
  Device: 00:1f.3
@@ -21,11 +21,11 @@ require "spec_helper"
21
21
  describe Ohai::System, "Machine id plugin" do
22
22
  let(:plugin) { get_plugin("linux/machineid") }
23
23
 
24
- before(:each) do
24
+ before do
25
25
  allow(plugin).to receive(:collect_os).and_return(:linux)
26
26
  end
27
27
 
28
- it "should read /etc/machine-id if available" do
28
+ it "reads /etc/machine-id if available" do
29
29
  machine_id = "6f702523e2fc7499eb1dc68e5314dacf"
30
30
 
31
31
  allow(::File).to receive(:exist?).with("/etc/machine-id").and_return(true)
@@ -34,7 +34,7 @@ describe Ohai::System, "Machine id plugin" do
34
34
  expect(plugin[:machine_id]).to eq(machine_id)
35
35
  end
36
36
 
37
- it "should read /var/lib/dbus/machine-id if available" do
37
+ it "reads /var/lib/dbus/machine-id if available" do
38
38
  machine_id = "6f702523e2fc7499eb1dc68e5314dacf"
39
39
 
40
40
  allow(::File).to receive(:exist?).with("/etc/machine-id").and_return(false)
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "Linux Mdadm Plugin" do
22
- before(:each) do
22
+ before do
23
23
  @md0 = <<~MD
24
24
  /dev/md0:
25
25
  Version : 1.2
@@ -67,46 +67,46 @@ describe Ohai::System, "Linux Mdadm Plugin" do
67
67
 
68
68
  describe "gathering Mdadm information via /proc/mdstat and mdadm" do
69
69
 
70
- it "should not raise an error" do
70
+ it "does not raise an error" do
71
71
  expect { @plugin.run }.not_to raise_error
72
72
  end
73
73
 
74
- it "should detect raid level" do
74
+ it "detects raid level" do
75
75
  @plugin.run
76
76
  expect(@plugin[:mdadm][:md0][:level]).to eq(10)
77
77
  end
78
78
 
79
- it "should detect raid state" do
79
+ it "detects raid state" do
80
80
  @plugin.run
81
81
  expect(@plugin[:mdadm][:md0][:state]).to eq("clean")
82
82
  end
83
83
 
84
- it "should detect raid size" do
84
+ it "detects raid size" do
85
85
  @plugin.run
86
86
  expect(@plugin[:mdadm][:md0][:size]).to eq(2794.16)
87
87
  end
88
88
 
89
- it "should detect raid metadata level" do
89
+ it "detects raid metadata level" do
90
90
  @plugin.run
91
91
  expect(@plugin[:mdadm][:md0][:version]).to eq(1.2)
92
92
  end
93
93
 
94
94
  device_counts = { raid: 6, total: 6, active: 6, working: 6, failed: 0, spare: 0 }
95
95
  device_counts.each_pair do |item, expected_value|
96
- it "should detect device count of \"#{item}\"" do
96
+ it "detects device count of \"#{item}\"" do
97
97
  @plugin.run
98
98
  expect(@plugin[:mdadm][:md0][:device_counts][item]).to eq(expected_value)
99
99
  end
100
100
  end
101
101
 
102
- it "should detect member devices" do
102
+ it "detects member devices" do
103
103
  @plugin.run
104
104
  expect(@plugin[:mdadm][:md0][:members].sort).to eq(
105
105
  %w{sdc sdd sde sdf sdg sdh}
106
106
  )
107
107
  end
108
108
 
109
- it "should detect member devices even if there are multi-digit numbers" do
109
+ it "detects member devices even if there are multi-digit numbers" do
110
110
  new_mdstat = double("/proc/mdstat2")
111
111
  allow(new_mdstat).to receive(:each)
112
112
  .and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
@@ -120,7 +120,7 @@ describe Ohai::System, "Linux Mdadm Plugin" do
120
120
  )
121
121
  end
122
122
 
123
- it "should detect member devices even if mdstat has extra entries" do
123
+ it "detects member devices even if mdstat has extra entries" do
124
124
  new_mdstat = double("/proc/mdstat2")
125
125
  allow(new_mdstat).to receive(:each)
126
126
  .and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
@@ -134,7 +134,7 @@ describe Ohai::System, "Linux Mdadm Plugin" do
134
134
  )
135
135
  end
136
136
 
137
- it "should accurately report inactive arrays" do
137
+ it "accuratelies report inactive arrays" do
138
138
  new_mdstat = double("/proc/mdstat_inactive")
139
139
  allow(new_mdstat).to receive(:each)
140
140
  .and_yield("Personalities :")
@@ -145,7 +145,7 @@ describe Ohai::System, "Linux Mdadm Plugin" do
145
145
  expect(@plugin[:mdadm][:md0][:spares]).to eq(%w{nvme2n1p3})
146
146
  end
147
147
 
148
- it "should report journal devices" do
148
+ it "reports journal devices" do
149
149
  new_mdstat = double("/proc/mdstat_journal")
150
150
  allow(new_mdstat).to receive(:each)
151
151
  .and_yield("Personalies : [raid6]")
@@ -156,7 +156,7 @@ describe Ohai::System, "Linux Mdadm Plugin" do
156
156
  expect(@plugin[:mdadm][:md0][:journal]).to eq("nvme2n1p3")
157
157
  end
158
158
 
159
- it "should report spare devices" do
159
+ it "reports spare devices" do
160
160
  new_mdstat = double("/proc/mdstat_spare")
161
161
  allow(new_mdstat).to receive(:each)
162
162
  .and_yield("Personalies : [raid6]")
@@ -17,7 +17,7 @@
17
17
  require "spec_helper"
18
18
 
19
19
  describe Ohai::System, "Linux memory plugin" do
20
- before(:each) do
20
+ before do
21
21
  @plugin = get_plugin("linux/memory")
22
22
  allow(@plugin).to receive(:collect_os).and_return(:linux)
23
23
  @double_file = double("/proc/meminfo")
@@ -64,192 +64,192 @@ describe Ohai::System, "Linux memory plugin" do
64
64
  allow(File).to receive(:open).with("/proc/meminfo").and_return(@double_file)
65
65
  end
66
66
 
67
- it "should get total memory" do
67
+ it "gets total memory" do
68
68
  @plugin.run
69
69
  expect(@plugin[:memory][:total]).to eql("131932120kB")
70
70
  end
71
71
 
72
- it "should get free memory" do
72
+ it "gets free memory" do
73
73
  @plugin.run
74
74
  expect(@plugin[:memory][:free]).to eql("2269032kB")
75
75
  end
76
76
 
77
- it "should get available memory" do
77
+ it "gets available memory" do
78
78
  @plugin.run
79
79
  expect(@plugin[:memory][:available]).to eql("9208922kB")
80
80
  end
81
81
 
82
- it "should get memory used for file buffers" do
82
+ it "gets memory used for file buffers" do
83
83
  @plugin.run
84
84
  expect(@plugin[:memory][:buffers]).to eql("646368kB")
85
85
  end
86
86
 
87
- it "should get cache memory" do
87
+ it "gets cache memory" do
88
88
  @plugin.run
89
89
  expect(@plugin[:memory][:cached]).to eql("32346556kB")
90
90
  end
91
91
 
92
- it "should get active memory" do
92
+ it "gets active memory" do
93
93
  @plugin.run
94
94
  expect(@plugin[:memory][:active]).to eql("98595796kB")
95
95
  end
96
96
 
97
- it "should get inactive memory" do
97
+ it "gets inactive memory" do
98
98
  @plugin.run
99
99
  expect(@plugin[:memory][:inactive]).to eql("18477320kB")
100
100
  end
101
101
 
102
- it "should get high_total memory" do
102
+ it "gets high_total memory" do
103
103
  @plugin.run
104
104
  expect(@plugin[:memory][:high_total]).to eql("0kB")
105
105
  end
106
106
 
107
- it "should get high_free memory" do
107
+ it "gets high_free memory" do
108
108
  @plugin.run
109
109
  expect(@plugin[:memory][:high_free]).to eql("0kB")
110
110
  end
111
111
 
112
- it "should get low_total memory" do
112
+ it "gets low_total memory" do
113
113
  @plugin.run
114
114
  expect(@plugin[:memory][:low_total]).to eql("131932120kB")
115
115
  end
116
116
 
117
- it "should get low_free memory" do
117
+ it "gets low_free memory" do
118
118
  @plugin.run
119
119
  expect(@plugin[:memory][:low_free]).to eql("2269032kB")
120
120
  end
121
121
 
122
- it "should get dirty memory" do
122
+ it "gets dirty memory" do
123
123
  @plugin.run
124
124
  expect(@plugin[:memory][:dirty]).to eql("3212kB")
125
125
  end
126
126
 
127
- it "should get writeback memory" do
127
+ it "gets writeback memory" do
128
128
  @plugin.run
129
129
  expect(@plugin[:memory][:writeback]).to eql("0kB")
130
130
  end
131
131
 
132
- it "should get anon_pages memory" do
132
+ it "gets anon_pages memory" do
133
133
  @plugin.run
134
134
  expect(@plugin[:memory][:anon_pages]).to eql("84082132kB")
135
135
  end
136
136
 
137
- it "should get mapped memory" do
137
+ it "gets mapped memory" do
138
138
  @plugin.run
139
139
  expect(@plugin[:memory][:mapped]).to eql("3445224kB")
140
140
  end
141
141
 
142
- it "should get slab memory" do
142
+ it "gets slab memory" do
143
143
  @plugin.run
144
144
  expect(@plugin[:memory][:slab]).to eql("9892096kB")
145
145
  end
146
146
 
147
- it "should get slab_reclaimable memory" do
147
+ it "gets slab_reclaimable memory" do
148
148
  @plugin.run
149
149
  expect(@plugin[:memory][:slab_reclaimable]).to eql("362636kB")
150
150
  end
151
151
 
152
- it "should get slab_reclaimable memory" do
152
+ it "gets slab_reclaimable memory" do
153
153
  @plugin.run
154
154
  expect(@plugin[:memory][:slab_unreclaim]).to eql("18860kB")
155
155
  end
156
156
 
157
- it "should get page_tables memory" do
157
+ it "gets page_tables memory" do
158
158
  @plugin.run
159
159
  expect(@plugin[:memory][:page_tables]).to eql("1759332kB")
160
160
  end
161
161
 
162
- it "should get nfs_unstable memory" do
162
+ it "gets nfs_unstable memory" do
163
163
  @plugin.run
164
164
  expect(@plugin[:memory][:nfs_unstable]).to eql("0kB")
165
165
  end
166
166
 
167
- it "should get bounce memory" do
167
+ it "gets bounce memory" do
168
168
  @plugin.run
169
169
  expect(@plugin[:memory][:bounce]).to eql("0kB")
170
170
  end
171
171
 
172
- it "should get commit_limit memory" do
172
+ it "gets commit_limit memory" do
173
173
  @plugin.run
174
174
  expect(@plugin[:memory][:commit_limit]).to eql("148709328kB")
175
175
  end
176
176
 
177
- it "should get committed_as memory" do
177
+ it "gets committed_as memory" do
178
178
  @plugin.run
179
179
  expect(@plugin[:memory][:committed_as]).to eql("333717060kB")
180
180
  end
181
181
 
182
- it "should get vmalloc_total memory" do
182
+ it "gets vmalloc_total memory" do
183
183
  @plugin.run
184
184
  expect(@plugin[:memory][:vmalloc_total]).to eql("34359738367kB")
185
185
  end
186
186
 
187
- it "should get vmalloc_used memory" do
187
+ it "gets vmalloc_used memory" do
188
188
  @plugin.run
189
189
  expect(@plugin[:memory][:vmalloc_used]).to eql("276796kB")
190
190
  end
191
191
 
192
- it "should get vmalloc_chunk memory" do
192
+ it "gets vmalloc_chunk memory" do
193
193
  @plugin.run
194
194
  expect(@plugin[:memory][:vmalloc_chunk]).to eql("34359461515kB")
195
195
  end
196
196
 
197
- it "should get total swap" do
197
+ it "gets total swap" do
198
198
  @plugin.run
199
199
  expect(@plugin[:memory][:swap][:total]).to eql("16777208kB")
200
200
  end
201
201
 
202
- it "should get cached swap" do
202
+ it "gets cached swap" do
203
203
  @plugin.run
204
204
  expect(@plugin[:memory][:swap][:cached]).to eql("312kB")
205
205
  end
206
206
 
207
- it "should get free swap" do
207
+ it "gets free swap" do
208
208
  @plugin.run
209
209
  expect(@plugin[:memory][:swap][:free]).to eql("14127356kB")
210
210
  end
211
211
 
212
- it "should get total hugepages" do
212
+ it "gets total hugepages" do
213
213
  @plugin.run
214
214
  expect(@plugin[:memory][:hugepages][:total]).to eql("11542")
215
215
  end
216
216
 
217
- it "should get free hugepages" do
217
+ it "gets free hugepages" do
218
218
  @plugin.run
219
219
  expect(@plugin[:memory][:hugepages][:free]).to eql("11235")
220
220
  end
221
221
 
222
- it "should get reserved hugepages" do
222
+ it "gets reserved hugepages" do
223
223
  @plugin.run
224
224
  expect(@plugin[:memory][:hugepages][:reserved]).to eql("11226")
225
225
  end
226
226
 
227
- it "should get surplus hugepages" do
227
+ it "gets surplus hugepages" do
228
228
  @plugin.run
229
229
  expect(@plugin[:memory][:hugepages][:surplus]).to eql("0")
230
230
  end
231
231
 
232
- it "should get hugepage size" do
232
+ it "gets hugepage size" do
233
233
  @plugin.run
234
234
  expect(@plugin[:memory][:hugepage_size]).to eql("2048kB")
235
235
  end
236
236
 
237
- it "should get hugetlb memory" do
237
+ it "gets hugetlb memory" do
238
238
  @plugin.run
239
239
  expect(@plugin[:memory][:hugetlb]).to eql("0kB")
240
240
  end
241
241
 
242
- it "should get directmap 4k memory" do
242
+ it "gets directmap 4k memory" do
243
243
  @plugin.run
244
244
  expect(@plugin[:memory][:directmap][:'4k']).to eql("3720736kB")
245
245
  end
246
246
 
247
- it "should get directmap 2M memory" do
247
+ it "gets directmap 2M memory" do
248
248
  @plugin.run
249
249
  expect(@plugin[:memory][:directmap][:'2M']).to eql("12795904kB")
250
250
  end
251
251
 
252
- it "should get directmap 1G memory" do
252
+ it "gets directmap 1G memory" do
253
253
  @plugin.run
254
254
  expect(@plugin[:memory][:directmap][:'1G']).to eql("0kB")
255
255
  end
@@ -371,7 +371,7 @@ describe Ohai::System, "Linux Network Plugin" do
371
371
  EOM
372
372
  end
373
373
 
374
- before(:each) do
374
+ before do
375
375
  allow(plugin).to receive(:collect_os).and_return(:linux)
376
376
 
377
377
  allow(plugin).to receive(:shell_out).with("ip addr").and_return(mock_shell_out(0, linux_ip_addr, ""))
@@ -545,7 +545,7 @@ describe Ohai::System, "Linux Network Plugin" do
545
545
 
546
546
  %w{ifconfig iproute2}.each do |network_method|
547
547
  describe "gathering IP layer address info via #{network_method}" do
548
- before(:each) do
548
+ before do
549
549
  allow(plugin).to receive(:which).with("ip").and_return( network_method == "iproute2" ? "/sbin/ip" : false )
550
550
  allow(plugin).to receive(:which).with("ethtool").and_return( "/sbin/ethtool" )
551
551
  plugin.run
@@ -688,7 +688,7 @@ describe Ohai::System, "Linux Network Plugin" do
688
688
  end
689
689
 
690
690
  describe "gathering interface counters via #{network_method}" do
691
- before(:each) do
691
+ before do
692
692
  allow(plugin).to receive(:which).with("ip").and_return(network_method == "iproute2" ? "/sbin/ip" : false)
693
693
  allow(plugin).to receive(:which).with("ethtool").and_return("/sbin/ethtool")
694
694
  plugin.run
@@ -727,7 +727,7 @@ describe Ohai::System, "Linux Network Plugin" do
727
727
  end
728
728
 
729
729
  describe "setting the node's default IP address attribute with #{network_method}" do
730
- before(:each) do
730
+ before do
731
731
  allow(plugin).to receive(:which).with("ip").and_return(network_method == "iproute2" ? "/sbin/ip" : false)
732
732
  allow(plugin).to receive(:which).with("ethtool").and_return("/sbin/ethtool")
733
733
  plugin.run
@@ -760,7 +760,7 @@ describe Ohai::System, "Linux Network Plugin" do
760
760
  EOM
761
761
  end
762
762
 
763
- before(:each) do
763
+ before do
764
764
  plugin.run
765
765
  end
766
766
 
@@ -790,7 +790,7 @@ describe Ohai::System, "Linux Network Plugin" do
790
790
  EOM
791
791
  end
792
792
 
793
- before(:each) do
793
+ before do
794
794
  plugin.run
795
795
  end
796
796
 
@@ -806,7 +806,7 @@ describe Ohai::System, "Linux Network Plugin" do
806
806
  end
807
807
 
808
808
  describe "for newer network features using iproute2 only" do
809
- before(:each) do
809
+ before do
810
810
  allow(plugin).to receive(:which).with("ip").and_return("/sbin/ip")
811
811
  allow(plugin).to receive(:which).with("ethtool").and_return( "/sbin/ethtool" )
812
812
  allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(true) # ipv6 is enabled
@@ -860,7 +860,7 @@ describe Ohai::System, "Linux Network Plugin" do
860
860
  end
861
861
 
862
862
  describe "when IPv6 is disabled" do
863
- before :each do
863
+ before do
864
864
  allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(false)
865
865
  plugin.run
866
866
  end
@@ -891,7 +891,7 @@ describe Ohai::System, "Linux Network Plugin" do
891
891
  EOM
892
892
  end
893
893
 
894
- before(:each) do
894
+ before do
895
895
  plugin.run
896
896
  end
897
897
 
@@ -929,7 +929,7 @@ describe Ohai::System, "Linux Network Plugin" do
929
929
  EOM
930
930
  end
931
931
 
932
- before(:each) do
932
+ before do
933
933
  plugin.run
934
934
  end
935
935
 
@@ -970,7 +970,7 @@ describe Ohai::System, "Linux Network Plugin" do
970
970
  EOM
971
971
  end
972
972
 
973
- before(:each) do
973
+ before do
974
974
  plugin.run
975
975
  end
976
976
 
@@ -1013,7 +1013,7 @@ describe Ohai::System, "Linux Network Plugin" do
1013
1013
  EOM
1014
1014
  end
1015
1015
 
1016
- before(:each) do
1016
+ before do
1017
1017
  plugin.run
1018
1018
  end
1019
1019
 
@@ -1114,7 +1114,7 @@ describe Ohai::System, "Linux Network Plugin" do
1114
1114
  EOM
1115
1115
  end
1116
1116
 
1117
- before(:each) do
1117
+ before do
1118
1118
  plugin.run
1119
1119
  end
1120
1120
 
@@ -1135,7 +1135,7 @@ describe Ohai::System, "Linux Network Plugin" do
1135
1135
  EOM
1136
1136
  end
1137
1137
 
1138
- before(:each) do
1138
+ before do
1139
1139
  plugin.run
1140
1140
  end
1141
1141
 
@@ -1160,7 +1160,7 @@ describe Ohai::System, "Linux Network Plugin" do
1160
1160
  EOM
1161
1161
  end
1162
1162
 
1163
- before(:each) do
1163
+ before do
1164
1164
  plugin.run
1165
1165
  end
1166
1166
 
@@ -1185,7 +1185,8 @@ describe Ohai::System, "Linux Network Plugin" do
1185
1185
  default via fe80::21c:eff:fe12:3456 dev eth0.153 src fe80::2e0:81ff:fe2b:48e7 metric 1024
1186
1186
  EOM
1187
1187
  end
1188
- before(:each) do
1188
+
1189
+ before do
1189
1190
  plugin.run
1190
1191
  end
1191
1192
 
@@ -1219,7 +1220,7 @@ describe Ohai::System, "Linux Network Plugin" do
1219
1220
  EOM
1220
1221
  end
1221
1222
 
1222
- before(:each) do
1223
+ before do
1223
1224
  plugin.run
1224
1225
  end
1225
1226
 
@@ -1258,7 +1259,7 @@ describe Ohai::System, "Linux Network Plugin" do
1258
1259
  let(:linux_ip_route_inet6) { "" }
1259
1260
  let(:linux_ip_inet6_neighbor_show) { "" }
1260
1261
 
1261
- before(:each) do
1262
+ before do
1262
1263
  allow(plugin).to receive(:is_openvz?).and_return true
1263
1264
  allow(plugin).to receive(:is_openvz_host?).and_return false
1264
1265
  plugin.run
@@ -1303,7 +1304,7 @@ describe Ohai::System, "Linux Network Plugin" do
1303
1304
  EOM
1304
1305
  end
1305
1306
 
1306
- before(:each) do
1307
+ before do
1307
1308
  plugin.run
1308
1309
  end
1309
1310