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
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "plugin kernel" do
22
- before(:each) do
22
+ before do
23
23
  @plugin = get_plugin("kernel")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:default) # for debugging
25
25
  allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "Darwin\n", ""))
@@ -41,7 +41,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
41
41
  tmp_double
42
42
  end
43
43
 
44
- before(:each) do
44
+ before do
45
45
  @plugin = get_plugin("linux/block_device")
46
46
  allow(@plugin).to receive(:collect_os).and_return(:linux)
47
47
 
@@ -66,7 +66,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
66
66
  end
67
67
  end
68
68
 
69
- it "should collect all relevant data from disks" do
69
+ it "collects all relevant data from disks" do
70
70
  @plugin.run
71
71
  DISKS.each do |disk, checks|
72
72
  expect(@plugin[:block_device][disk.to_sym]).to include(checks)
@@ -86,12 +86,12 @@ describe Ohai::System, "General Linux cpu plugin" do
86
86
  tempfile
87
87
  end
88
88
 
89
- before(:each) do
89
+ before do
90
90
  allow(plugin).to receive(:collect_os).and_return(:linux)
91
91
  allow(File).to receive(:open).with("/proc/cpuinfo").and_return(tempfile_handle)
92
92
  end
93
93
 
94
- after(:each) do
94
+ after do
95
95
 
96
96
  tempfile.close
97
97
  tempfile.unlink
@@ -154,15 +154,15 @@ describe Ohai::System, "General Linux cpu plugin" do
154
154
  EOF
155
155
  end
156
156
 
157
- it_behaves_like "Common cpu info", 1, 1
158
-
159
- before(:each) do
157
+ before do
160
158
  allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(0, lscpu, ""))
161
159
  end
162
160
 
161
+ it_behaves_like "Common cpu info", 1, 1
162
+
163
163
  it "gets total cores" do
164
164
  plugin.run
165
- expect(plugin[:cpu][:cores]).to eql(1)
165
+ expect(plugin[:cpu][:cores]).to be(1)
166
166
  end
167
167
 
168
168
  it "doesn't have a cpu 1" do
@@ -233,6 +233,7 @@ describe Ohai::System, "General Linux cpu plugin" do
233
233
  expect(plugin[:cpu]["0"]["flags"]).to eq(%w{fpu pse tsc msr mce cx8 sep mtrr pge cmov})
234
234
  end
235
235
  end
236
+
236
237
  context "with a dual-core hyperthreaded /proc/cpuinfo" do
237
238
  let(:cpuinfo_contents) do
238
239
  <<~EOF
@@ -363,7 +364,7 @@ end
363
364
  describe Ohai::System, "S390 linux cpu plugin" do
364
365
  let(:plugin) { get_plugin("cpu") }
365
366
 
366
- before(:each) do
367
+ before do
367
368
  allow(plugin).to receive(:collect_os).and_return(:linux)
368
369
  allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(1, "", ""))
369
370
 
@@ -410,7 +411,7 @@ end
410
411
  describe Ohai::System, "arm64 linux cpu plugin" do
411
412
  let(:plugin) { get_plugin("cpu") }
412
413
 
413
- before(:each) do
414
+ before do
414
415
  allow(plugin).to receive(:collect_os).and_return(:linux)
415
416
  allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(1, "", ""))
416
417
 
@@ -20,7 +20,8 @@ require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "Linux filesystem plugin" do
22
22
  let(:plugin) { get_plugin("filesystem") }
23
- before(:each) do
23
+
24
+ before do
24
25
  allow(plugin).to receive(:collect_os).and_return(:linux)
25
26
 
26
27
  allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
@@ -56,7 +57,7 @@ describe Ohai::System, "Linux filesystem plugin" do
56
57
  end
57
58
 
58
59
  describe "when gathering filesystem usage data from df" do
59
- before(:each) do
60
+ before do
60
61
  @stdout = <<~DF
61
62
  Filesystem 1024-blocks Used Available Capacity Mounted on
62
63
  /dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -83,55 +84,55 @@ describe Ohai::System, "Linux filesystem plugin" do
83
84
  allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
84
85
  end
85
86
 
86
- it "should run df -P and df -iP" do
87
+ it "runs df -P and df -iP" do
87
88
  expect(plugin).to receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
88
89
  expect(plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
89
90
  plugin.run
90
91
  end
91
92
 
92
- it "should set kb_size to value from df -P" do
93
+ it "sets kb_size to value from df -P" do
93
94
  plugin.run
94
95
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_size]).to eq("97605057")
95
96
  end
96
97
 
97
- it "should set kb_used to value from df -P" do
98
+ it "sets kb_used to value from df -P" do
98
99
  plugin.run
99
100
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_used]).to eq("53563253")
100
101
  end
101
102
 
102
- it "should set kb_available to value from df -P" do
103
+ it "sets kb_available to value from df -P" do
103
104
  plugin.run
104
105
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_available]).to eq("44041805")
105
106
  end
106
107
 
107
- it "should set percent_used to value from df -P" do
108
+ it "sets percent_used to value from df -P" do
108
109
  plugin.run
109
110
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:percent_used]).to eq("56%")
110
111
  end
111
112
 
112
- it "should set mount to value from df -P" do
113
+ it "sets mount to value from df -P" do
113
114
  plugin.run
114
115
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
115
116
  end
116
117
 
117
- it "should set total_inodes to value from df -iP" do
118
+ it "sets total_inodes to value from df -iP" do
118
119
  plugin.run
119
120
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:total_inodes]).to eq("124865")
120
121
  end
121
122
 
122
- it "should set inodes_used to value from df -iP" do
123
+ it "sets inodes_used to value from df -iP" do
123
124
  plugin.run
124
125
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_used]).to eq("380")
125
126
  end
126
127
 
127
- it "should set inodes_available to value from df -iP" do
128
+ it "sets inodes_available to value from df -iP" do
128
129
  plugin.run
129
130
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_available]).to eq("124485")
130
131
  end
131
132
  end
132
133
 
133
134
  describe "when gathering mounted filesystem data from mount" do
134
- before(:each) do
135
+ before do
135
136
  @stdout = <<~MOUNT
136
137
  /dev/mapper/sys.vg-root.lv on / type ext4 (rw,noatime,errors=remount-ro)
137
138
  tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
@@ -152,29 +153,29 @@ describe Ohai::System, "Linux filesystem plugin" do
152
153
  allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
153
154
  end
154
155
 
155
- it "should run mount" do
156
+ it "runs mount" do
156
157
  expect(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
157
158
  plugin.run
158
159
  end
159
160
 
160
- it "should set mount to value from mount" do
161
+ it "sets mount to value from mount" do
161
162
  plugin.run
162
163
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
163
164
  end
164
165
 
165
- it "should set fs_type to value from mount" do
166
+ it "sets fs_type to value from mount" do
166
167
  plugin.run
167
168
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
168
169
  end
169
170
 
170
- it "should set mount_options to an array of values from mount" do
171
+ it "sets mount_options to an array of values from mount" do
171
172
  plugin.run
172
173
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime})
173
174
  end
174
175
  end
175
176
 
176
177
  describe "when gathering filesystem type data from blkid" do
177
- before(:each) do
178
+ before do
178
179
  # blkid and lsblk output are coorelated with df/mount output, so the
179
180
  # most full test of them actually requires we have both
180
181
  @dfstdout = <<~DF
@@ -219,11 +220,11 @@ describe Ohai::System, "Linux filesystem plugin" do
219
220
  allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
220
221
  end
221
222
 
222
- it "should run blkid" do
223
+ it "runs blkid" do
223
224
  plugin.run
224
225
  end
225
226
 
226
- it "should set kb_size to value from blkid" do
227
+ it "sets kb_size to value from blkid" do
227
228
  plugin.run
228
229
  expect(plugin[:filesystem]["by_pair"]["/dev/md1,"][:fs_type]).to eq("LVM2_member")
229
230
  expect(plugin[:filesystem]["by_pair"]["/dev/sda2,"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
@@ -232,7 +233,7 @@ describe Ohai::System, "Linux filesystem plugin" do
232
233
  end
233
234
 
234
235
  describe "when gathering filesystem type data from lsblk" do
235
- before(:each) do
236
+ before do
236
237
  @dfstdout = <<~DF
237
238
  Filesystem 1024-blocks Used Available Capacity Mounted on
238
239
  /dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -280,18 +281,18 @@ describe Ohai::System, "Linux filesystem plugin" do
280
281
  .and_return(mock_shell_out(0, @stdout, ""))
281
282
  end
282
283
 
283
- it "should run lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
284
+ it "runs lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
284
285
  plugin.run
285
286
  end
286
287
 
287
- it "should set kb_size to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
288
+ it "sets kb_size to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
288
289
  plugin.run
289
290
  expect(plugin[:filesystem]["by_pair"]["/dev/md1,"][:fs_type]).to eq("LVM2_member")
290
291
  expect(plugin[:filesystem]["by_pair"]["/dev/sda2,"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
291
292
  expect(plugin[:filesystem]["by_pair"]["/dev/md0,/boot"][:label]).to eq("/boot")
292
293
  end
293
294
 
294
- it "should ignore extra info in name and set label to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
295
+ it "ignores extra info in name and set label to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
295
296
  plugin.run
296
297
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/debian--7-root,"][:label]).to eq("root")
297
298
  end
@@ -299,7 +300,7 @@ describe Ohai::System, "Linux filesystem plugin" do
299
300
  end
300
301
 
301
302
  describe "when gathering filesystem type data from both lsblk and blkid" do
302
- before(:each) do
303
+ before do
303
304
  @dfstdout = <<~DF
304
305
  Filesystem 1024-blocks Used Available Capacity Mounted on
305
306
  /dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -362,21 +363,21 @@ describe Ohai::System, "Linux filesystem plugin" do
362
363
  allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
363
364
  end
364
365
 
365
- it "should fill in missing FS data from lsblk using blkid" do
366
+ it "fills in missing FS data from lsblk using blkid" do
366
367
  plugin.run
367
368
  pairs = plugin[:filesystem]["by_pair"]
368
369
  expect(pairs["/dev/mapper/sys.vg-root.lv,/"]["fs_type"]).to eq("ext4")
369
370
  expect(pairs["/dev/mapper/sys.vg-usr.lv,/usr"]["fs_type"]).to eq("ext4")
370
371
  end
371
372
 
372
- it "should fill in missing FS data from blkid using lsblk" do
373
+ it "fills in missing FS data from blkid using lsblk" do
373
374
  plugin.run
374
375
  pairs = plugin[:filesystem]["by_pair"]
375
376
  expect(pairs["/dev/sdb1,"]["uuid"]).to eq("bd1197e0-6997-1f3a-e27e-7801388308b5")
376
377
  expect(pairs["/dev/sdb2,"]["uuid"]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
377
378
  end
378
379
 
379
- it "should prefer lsblk data to blkid data when they conflict" do
380
+ it "prefers lsblk data to blkid data when they conflict" do
380
381
  plugin.run
381
382
  pairs = plugin[:filesystem]["by_pair"]
382
383
  expect(pairs["/dev/mapper/sys.vg-home.lv,/home"]["label"]).to eq("/home")
@@ -385,7 +386,7 @@ describe Ohai::System, "Linux filesystem plugin" do
385
386
  end
386
387
 
387
388
  describe "when gathering data from /proc/mounts" do
388
- before(:each) do
389
+ before do
389
390
  allow(File).to receive(:exist?).with("/proc/mounts").and_return(true)
390
391
  @double_file = double("/proc/mounts")
391
392
  @mounts = <<~MOUNTS
@@ -417,24 +418,24 @@ describe Ohai::System, "Linux filesystem plugin" do
417
418
  allow(File).to receive(:open).with("/proc/mounts").and_return(@double_file)
418
419
  end
419
420
 
420
- it "should set mount to value from /proc/mounts" do
421
+ it "sets mount to value from /proc/mounts" do
421
422
  plugin.run
422
423
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
423
424
  end
424
425
 
425
- it "should set fs_type to value from /proc/mounts" do
426
+ it "sets fs_type to value from /proc/mounts" do
426
427
  plugin.run
427
428
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
428
429
  end
429
430
 
430
- it "should set mount_options to an array of values from /proc/mounts" do
431
+ it "sets mount_options to an array of values from /proc/mounts" do
431
432
  plugin.run
432
433
  expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime attr2 noquota})
433
434
  end
434
435
  end
435
436
 
436
437
  describe "when gathering filesystem data with devices mounted more than once" do
437
- before(:each) do
438
+ before do
438
439
  # there's a few different examples one can run into in this output:
439
440
  # 1. A device physically mounted in more than one place: /home and /home2
440
441
  # 2. A bind-mounted directory, which shows up as the same device in a
@@ -475,7 +476,7 @@ describe Ohai::System, "Linux filesystem plugin" do
475
476
  .and_return(mock_shell_out(0, @stdout, ""))
476
477
  end
477
478
 
478
- it "should provide a devices view with all mountpoints" do
479
+ it "provides a devices view with all mountpoints" do
479
480
  plugin.run
480
481
  expect(plugin[:filesystem]["by_device"]["/dev/mapper/sys.vg-root.lv"][:mounts]).to eq(["/", "/var/chroot"])
481
482
  expect(plugin[:filesystem]["by_device"]["/dev/mapper/sys.vg-home.lv"][:mounts]).to eq(["/home", "/home2"])
@@ -484,7 +485,7 @@ describe Ohai::System, "Linux filesystem plugin" do
484
485
  end
485
486
 
486
487
  describe "when gathering filesystem data with double-mounts" do
487
- before(:each) do
488
+ before do
488
489
  @dfstdout = <<~DF
489
490
  Filesystem 1024-blocks Used Available Capacity Mounted on
490
491
  /dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
@@ -522,7 +523,7 @@ describe Ohai::System, "Linux filesystem plugin" do
522
523
  .and_return(mock_shell_out(0, @stdout, ""))
523
524
  end
524
525
 
525
- it "should provide a mounts view with all devices" do
526
+ it "provides a mounts view with all devices" do
526
527
  plugin.run
527
528
  expect(plugin[:filesystem]["by_mountpoint"]["/mnt"][:devices]).to eq(["/dev/sdb1", "/dev/sdc1"])
528
529
  end
@@ -20,16 +20,16 @@ require "spec_helper"
20
20
  require "openssl"
21
21
 
22
22
  describe Ohai::System, "plugin fips" do
23
- let(:enabled) { "0" }
24
- let(:plugin) { get_plugin("linux/fips") }
25
- let(:openssl_test_mode) { false }
26
-
27
23
  subject do
28
24
  plugin.run
29
25
  plugin["fips"]["kernel"]["enabled"]
30
26
  end
31
27
 
32
- before(:each) do
28
+ let(:enabled) { "0" }
29
+ let(:plugin) { get_plugin("linux/fips") }
30
+ let(:openssl_test_mode) { false }
31
+
32
+ before do
33
33
  allow(plugin).to receive(:collect_os).and_return(:linux)
34
34
  end
35
35
 
@@ -44,6 +44,7 @@ describe Ohai::System, "plugin fips" do
44
44
 
45
45
  context "with OpenSSL.fips_mode == false" do
46
46
  before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
47
+
47
48
  it "does not set fips plugin" do
48
49
  expect(subject).to be(false)
49
50
  end
@@ -51,6 +52,7 @@ describe Ohai::System, "plugin fips" do
51
52
 
52
53
  context "with OpenSSL.fips_mode == true" do
53
54
  before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
55
+
54
56
  it "sets fips plugin" do
55
57
  expect(subject).to be(true)
56
58
  end
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "Linux hostname plugin" do
22
- before(:each) do
22
+ before do
23
23
  @plugin = get_plugin("hostname")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:linux)
25
25
  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
34
34
  it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
35
35
 
36
36
  describe "when domain name is unset" do
37
- before(:each) do
37
+ before do
38
38
  expect(@plugin).to receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
39
39
  end
40
40
 
41
- it "should not raise an error" do
41
+ it "does not raise an error" do
42
42
  expect { @plugin.run }.not_to raise_error
43
43
  end
44
44
 
45
- it "should not set fqdn" do
45
+ it "does not set fqdn" do
46
46
  @plugin.run
47
47
  expect(@plugin.fqdn).to eq(nil)
48
48
  end
@@ -21,11 +21,11 @@ require "spec_helper"
21
21
  describe Ohai::System, "Linux hostnamectl plugin" do
22
22
  let(:plugin) { get_plugin("linux/hostnamectl") }
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 populate hostnamectl if hostnamectl is available" do
28
+ it "populates hostnamectl if hostnamectl is available" do
29
29
  hostnamectl_out = <<-HOSTNAMECTL_OUT
30
30
  Static hostname: foo
31
31
  Icon name: computer-laptop
@@ -52,7 +52,7 @@ describe Ohai::System, "Linux hostnamectl plugin" do
52
52
  })
53
53
  end
54
54
 
55
- it "should not populate hostnamectl if hostnamectl is not available" do
55
+ it "does not populate hostnamectl if hostnamectl is not available" do
56
56
  allow(plugin).to receive(:which).with("hostnamectl").and_return(false)
57
57
  expect(plugin[:hostnamectl]).to eq(nil)
58
58
  end
@@ -20,7 +20,7 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Ohai::System, "Linux kernel plugin" do
23
- before(:each) do
23
+ before do
24
24
  @env_lsmod = <<~ENV_LSMOD
25
25
  Module Size Used by
26
26
  dm_crypt 22321 0
@@ -21,13 +21,13 @@ require "spec_helper"
21
21
  # We do not alter case for lsb attributes and consume them as provided
22
22
 
23
23
  describe Ohai::System, "Linux lsb plugin" do
24
- before(:each) do
24
+ before do
25
25
  @plugin = get_plugin("linux/lsb")
26
26
  allow(@plugin).to receive(:collect_os).and_return(:linux)
27
27
  end
28
28
 
29
29
  describe "on systems with /etc/lsb-release" do
30
- before(:each) do
30
+ before do
31
31
  @double_file = double("/etc/lsb-release")
32
32
  allow(@double_file).to receive(:each)
33
33
  .and_yield("DISTRIB_ID=Ubuntu")
@@ -39,29 +39,29 @@ describe Ohai::System, "Linux lsb plugin" do
39
39
  allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(true)
40
40
  end
41
41
 
42
- it "should set lsb[:id]" do
42
+ it "sets lsb[:id]" do
43
43
  @plugin.run
44
44
  expect(@plugin[:lsb][:id]).to eq("Ubuntu")
45
45
  end
46
46
 
47
- it "should set lsb[:release]" do
47
+ it "sets lsb[:release]" do
48
48
  @plugin.run
49
49
  expect(@plugin[:lsb][:release]).to eq("8.04")
50
50
  end
51
51
 
52
- it "should set lsb[:codename]" do
52
+ it "sets lsb[:codename]" do
53
53
  @plugin.run
54
54
  expect(@plugin[:lsb][:codename]).to eq("hardy")
55
55
  end
56
56
 
57
- it "should set lsb[:description]" do
57
+ it "sets lsb[:description]" do
58
58
  @plugin.run
59
59
  expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
60
60
  end
61
61
  end
62
62
 
63
63
  describe "on systems with /usr/bin/lsb_release" do
64
- before(:each) do
64
+ before do
65
65
  allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(true)
66
66
 
67
67
  @stdin = double("STDIN", { close: true })
@@ -73,7 +73,7 @@ describe Ohai::System, "Linux lsb plugin" do
73
73
  end
74
74
 
75
75
  describe "on Centos 5.4 correctly" do
76
- before(:each) do
76
+ before do
77
77
  @stdout = <<~LSB_RELEASE
78
78
  LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
79
79
  Distributor ID: CentOS
@@ -84,29 +84,29 @@ describe Ohai::System, "Linux lsb plugin" do
84
84
  allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
85
85
  end
86
86
 
87
- it "should set lsb[:id]" do
87
+ it "sets lsb[:id]" do
88
88
  @plugin.run
89
89
  expect(@plugin[:lsb][:id]).to eq("CentOS")
90
90
  end
91
91
 
92
- it "should set lsb[:release]" do
92
+ it "sets lsb[:release]" do
93
93
  @plugin.run
94
94
  expect(@plugin[:lsb][:release]).to eq("5.4")
95
95
  end
96
96
 
97
- it "should set lsb[:codename]" do
97
+ it "sets lsb[:codename]" do
98
98
  @plugin.run
99
99
  expect(@plugin[:lsb][:codename]).to eq("Final")
100
100
  end
101
101
 
102
- it "should set lsb[:description]" do
102
+ it "sets lsb[:description]" do
103
103
  @plugin.run
104
104
  expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
105
105
  end
106
106
  end
107
107
 
108
108
  describe "on Fedora 14 correctly" do
109
- before(:each) do
109
+ before do
110
110
  @stdout = <<~LSB_RELEASE
111
111
  LSB Version: :core-4.0-ia32:core-4.0-noarch
112
112
  Distributor ID: Fedora
@@ -117,29 +117,29 @@ describe Ohai::System, "Linux lsb plugin" do
117
117
  allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
118
118
  end
119
119
 
120
- it "should set lsb[:id]" do
120
+ it "sets lsb[:id]" do
121
121
  @plugin.run
122
122
  expect(@plugin[:lsb][:id]).to eq("Fedora")
123
123
  end
124
124
 
125
- it "should set lsb[:release]" do
125
+ it "sets lsb[:release]" do
126
126
  @plugin.run
127
127
  expect(@plugin[:lsb][:release]).to eq("14")
128
128
  end
129
129
 
130
- it "should set lsb[:codename]" do
130
+ it "sets lsb[:codename]" do
131
131
  @plugin.run
132
132
  expect(@plugin[:lsb][:codename]).to eq("Laughlin")
133
133
  end
134
134
 
135
- it "should set lsb[:description]" do
135
+ it "sets lsb[:description]" do
136
136
  @plugin.run
137
137
  expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
138
138
  end
139
139
  end
140
140
  end
141
141
 
142
- it "should not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
142
+ it "does not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
143
143
  allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(false)
144
144
  allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(false)
145
145
  expect(@plugin.attribute?(:lsb)).to be(false)