ohai 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +15 -6
  3. data/lib/ohai/common/dmi.rb +11 -13
  4. data/lib/ohai/dsl/plugin.rb +6 -8
  5. data/lib/ohai/dsl/plugin/versionvi.rb +1 -1
  6. data/lib/ohai/dsl/plugin/versionvii.rb +4 -4
  7. data/lib/ohai/mash.rb +1 -1
  8. data/lib/ohai/mixin/command.rb +3 -3
  9. data/lib/ohai/mixin/dmi_decode.rb +1 -1
  10. data/lib/ohai/mixin/ec2_metadata.rb +10 -10
  11. data/lib/ohai/mixin/os.rb +11 -11
  12. data/lib/ohai/mixin/softlayer_metadata.rb +2 -2
  13. data/lib/ohai/mixin/string.rb +1 -1
  14. data/lib/ohai/plugins/azure.rb +2 -2
  15. data/lib/ohai/plugins/c.rb +9 -10
  16. data/lib/ohai/plugins/darwin/cpu.rb +24 -20
  17. data/lib/ohai/plugins/darwin/hardware.rb +15 -9
  18. data/lib/ohai/plugins/digital_ocean.rb +2 -2
  19. data/lib/ohai/plugins/ec2.rb +5 -5
  20. data/lib/ohai/plugins/elixir.rb +1 -1
  21. data/lib/ohai/plugins/erlang.rb +2 -2
  22. data/lib/ohai/plugins/eucalyptus.rb +2 -2
  23. data/lib/ohai/plugins/go.rb +1 -1
  24. data/lib/ohai/plugins/hostname.rb +7 -10
  25. data/lib/ohai/plugins/ip_scopes.rb +2 -0
  26. data/lib/ohai/plugins/java.rb +19 -21
  27. data/lib/ohai/plugins/kernel.rb +1 -1
  28. data/lib/ohai/plugins/linux/cpu.rb +4 -0
  29. data/lib/ohai/plugins/linux/filesystem.rb +43 -30
  30. data/lib/ohai/plugins/linux/lsb.rb +1 -1
  31. data/lib/ohai/plugins/linux/mdadm.rb +9 -1
  32. data/lib/ohai/plugins/linux/network.rb +8 -12
  33. data/lib/ohai/plugins/linux/platform.rb +9 -1
  34. data/lib/ohai/plugins/linux/systemd_paths.rb +39 -0
  35. data/lib/ohai/plugins/mono.rb +1 -1
  36. data/lib/ohai/plugins/nodejs.rb +1 -1
  37. data/lib/ohai/plugins/openstack.rb +5 -5
  38. data/lib/ohai/plugins/packages.rb +8 -2
  39. data/lib/ohai/plugins/perl.rb +1 -1
  40. data/lib/ohai/plugins/php.rb +1 -1
  41. data/lib/ohai/plugins/powershell.rb +1 -1
  42. data/lib/ohai/plugins/python.rb +1 -1
  43. data/lib/ohai/plugins/rackspace.rb +4 -4
  44. data/lib/ohai/plugins/rust.rb +1 -1
  45. data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
  46. data/lib/ohai/plugins/solaris2/network.rb +2 -2
  47. data/lib/ohai/plugins/ssh_host_key.rb +1 -1
  48. data/lib/ohai/plugins/uptime.rb +1 -1
  49. data/lib/ohai/plugins/{solaris2/zpools.rb → zpools.rb} +39 -16
  50. data/lib/ohai/util/file_helper.rb +2 -2
  51. data/lib/ohai/version.rb +1 -1
  52. data/spec/data/plugins/lslpp.output +1 -0
  53. data/spec/unit/plugins/darwin/cpu_spec.rb +66 -19
  54. data/spec/unit/plugins/darwin/hardware_spec.rb +2 -14
  55. data/spec/unit/plugins/linux/cpu_spec.rb +47 -0
  56. data/spec/unit/plugins/linux/filesystem_spec.rb +99 -9
  57. data/spec/unit/plugins/linux/mdadm_spec.rb +26 -1
  58. data/spec/unit/plugins/linux/network_spec.rb +8 -26
  59. data/spec/unit/plugins/linux/platform_spec.rb +41 -0
  60. data/spec/unit/plugins/linux/systemd_paths_spec.rb +122 -0
  61. data/spec/unit/plugins/packages_spec.rb +4 -0
  62. data/spec/unit/plugins/rackspace_spec.rb +3 -3
  63. data/spec/unit/plugins/zpools_spec.rb +242 -0
  64. metadata +7 -5
  65. data/spec/unit/plugins/solaris2/zpools_spec.rb +0 -153
@@ -210,6 +210,10 @@ describe Ohai::System, "plugin packages" do
210
210
  it "gets packages with version" do
211
211
  expect(plugin[:packages]["chef"][:version]).to eq("12.5.1.1")
212
212
  end
213
+
214
+ it "properly parses package names for RPMs" do
215
+ expect(plugin[:packages]["wget"][:version]).to eq("1.9.1-3")
216
+ end
213
217
  end
214
218
 
215
219
  context "on freebsd" do
@@ -151,7 +151,7 @@ OUT
151
151
 
152
152
  expect(Ohai::Log).
153
153
  to receive(:debug).
154
- with("rackspace plugin: Unable to find xenstore-ls, cannot capture " \
154
+ with("Plugin Rackspace: Unable to find xenstore-ls, cannot capture " \
155
155
  "region information for Rackspace cloud")
156
156
 
157
157
  plugin.run
@@ -174,7 +174,7 @@ OUT
174
174
 
175
175
  expect(Ohai::Log).
176
176
  to receive(:debug).
177
- with("rackspace plugin: Unable to find xenstore-read, cannot capture " \
177
+ with("Plugin Rackspace: Unable to find xenstore-read, cannot capture " \
178
178
  "instance ID information for Rackspace cloud")
179
179
 
180
180
  plugin.run
@@ -266,7 +266,7 @@ OUT
266
266
 
267
267
  expect(Ohai::Log).
268
268
  to receive(:debug).
269
- with("rackspace plugin: Unable to capture custom private networking " \
269
+ with("Plugin Rackspace: Unable to capture custom private networking " \
270
270
  "information for Rackspace cloud")
271
271
 
272
272
  plugin.run
@@ -0,0 +1,242 @@
1
+ # License:: Apache License, Version 2.0
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ require_relative "../../spec_helper.rb"
17
+
18
+ describe Ohai::System, "zpools plugin" do
19
+ let(:plugin) { get_plugin("zpools") }
20
+
21
+ context "on Linux" do
22
+ let(:zpool_status_tank) do
23
+ <<-EOST
24
+ pool: tank
25
+ state: ONLINE
26
+ scan: scrub repaired 0 in 0h0m with 0 errors on Fri Jun 6 14:43:40 2014
27
+ config:
28
+
29
+ NAME STATE READ WRITE CKSUM
30
+ tank ONLINE 0 0 0
31
+ raidz2-0 ONLINE 0 0 0
32
+ sdc ONLINE 0 0 0
33
+ sdd ONLINE 0 0 0
34
+ sde ONLINE 0 0 0
35
+ sdf ONLINE 0 0 0
36
+ sdg ONLINE 0 0 0
37
+ sdh ONLINE 0 0 0
38
+ raidz2-1 ONLINE 0 0 0
39
+ sdi ONLINE 0 0 0
40
+ sdj ONLINE 0 0 0
41
+ sdk ONLINE 0 0 0
42
+ sdl ONLINE 0 0 0
43
+ sdm ONLINE 0 0 0
44
+ sdn ONLINE 0 0 0
45
+ EOST
46
+ end
47
+ let(:zpool_out) do
48
+ <<-EOZO
49
+ rpool 109G 66.2G 42.8G 60% 1.00x ONLINE -
50
+ tank 130T 4.91M 130T 0% 1.00x ONLINE -
51
+ EOZO
52
+ end
53
+ let(:zpool_status_rpool) do
54
+ <<-EOSR
55
+ pool: rpool
56
+ state: ONLINE
57
+ scan: none requested
58
+ config:
59
+
60
+ NAME STATE READ WRITE CKSUM
61
+ rpool ONLINE 0 0 0
62
+ mirror-0 ONLINE 0 0 0
63
+ sda ONLINE 0 0 0
64
+ sdb ONLINE 0 0 0
65
+
66
+ errors: No known data errors
67
+ EOSR
68
+ end
69
+ before do
70
+ allow(plugin).to receive(:platform_family).and_return("rhel")
71
+ allow(plugin).to receive(:collect_os).and_return(:linux)
72
+ allow(plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, zpool_out, ""))
73
+ allow(plugin).to receive(:shell_out).with("zpool status rpool").and_return(mock_shell_out(0, zpool_status_rpool, ""))
74
+ allow(plugin).to receive(:shell_out).with("zpool status tank").and_return(mock_shell_out(0, zpool_status_tank, ""))
75
+ end
76
+
77
+ it "Has entries for both zpools" do
78
+ plugin.run
79
+ expect(plugin[:zpools][:rpool]).to be
80
+ expect(plugin[:zpools][:tank]).to be
81
+ end
82
+
83
+ it "Has the correct pool size" do
84
+ plugin.run
85
+ expect(plugin[:zpools][:rpool][:pool_size]).to match("109G")
86
+ expect(plugin[:zpools][:tank][:pool_size]).to match("130T")
87
+ end
88
+
89
+ it "Has the correct pool allocated size" do
90
+ plugin.run
91
+ expect(plugin[:zpools][:rpool][:pool_allocated]).to match("66.2G")
92
+ expect(plugin[:zpools][:tank][:pool_allocated]).to match("4.91M")
93
+ end
94
+
95
+ it "Has the correct pool free size" do
96
+ plugin.run
97
+ expect(plugin[:zpools][:rpool][:pool_free]).to match("42.8G")
98
+ expect(plugin[:zpools][:tank][:pool_free]).to match("130T")
99
+ end
100
+
101
+ it "Has the correct capacity_used" do
102
+ plugin.run
103
+ expect(plugin[:zpools][:rpool][:capacity_used]).to match("60%")
104
+ expect(plugin[:zpools][:tank][:capacity_used]).to match("0%")
105
+ end
106
+
107
+ it "Has the correct dedup_factor" do
108
+ plugin.run
109
+ expect(plugin[:zpools][:rpool][:dedup_factor]).to match("1.00x")
110
+ expect(plugin[:zpools][:tank][:dedup_factor]).to match("1.00x")
111
+ end
112
+
113
+ it "Has the correct health" do
114
+ plugin.run
115
+ expect(plugin[:zpools][:rpool][:health]).to match("ONLINE")
116
+ expect(plugin[:zpools][:tank][:health]).to match("ONLINE")
117
+ end
118
+
119
+ it "Has the correct number of devices" do
120
+ plugin.run
121
+ expect(plugin[:zpools][:rpool][:devices].keys.size).to match(2)
122
+ expect(plugin[:zpools][:tank][:devices].keys.size).to match(12)
123
+ end
124
+
125
+ it "Won't have a version number" do
126
+ plugin.run
127
+ expect(plugin[:zpools][:rpool][:zpool_version]).to be_nil
128
+ expect(plugin[:zpools][:tank][:zpool_version]).to be_nil
129
+ end
130
+ end
131
+
132
+ context "on Solaris2" do
133
+ let(:zpool_status_tank) do
134
+ <<-EOST
135
+ pool: tank
136
+ state: ONLINE
137
+ scan: scrub repaired 0 in 0h0m with 0 errors on Fri Jun 6 14:43:40 2014
138
+ config:
139
+
140
+ NAME STATE READ WRITE CKSUM
141
+ tank ONLINE 0 0 0
142
+ raidz2-0 ONLINE 0 0 0
143
+ c1t50014EE209D1DBA9d0 ONLINE 0 0 0
144
+ c1t50014EE20A0ECED2d0 ONLINE 0 0 0
145
+ c1t50014EE20A106BFFd0 ONLINE 0 0 0
146
+ c1t50014EE20A1423E8d0 ONLINE 0 0 0
147
+ c1t50014EE20A145447d0 ONLINE 0 0 0
148
+ c1t50014EE20A29EE56d0 ONLINE 0 0 0
149
+ raidz2-1 ONLINE 0 0 0
150
+ c1t50014EE20A2B984Cd0 ONLINE 0 0 0
151
+ c1t50014EE20A2BBC78d0 ONLINE 0 0 0
152
+ c1t50014EE20A2BDCA9d0 ONLINE 0 0 0
153
+ c1t50014EE25F697DC4d0 ONLINE 0 0 0
154
+ c1t50014EE25F698BECd0 ONLINE 0 0 0
155
+ c1t50014EE25F6998DAd0 ONLINE 0 0 0
156
+ EOST
157
+ end
158
+ let(:zpool_out) do
159
+ <<-EOZO
160
+ rpool 109G 66.2G 42.8G 60% 1.00x ONLINE 34
161
+ tank 130T 4.91M 130T 0% 1.00x ONLINE 34
162
+ EOZO
163
+ end
164
+ let(:zpool_status_rpool) do
165
+ <<-EOSR
166
+ pool: rpool
167
+ state: ONLINE
168
+ scan: resilvered 65.6G in 0h8m with 0 errors on Fri Jun 6 14:22:40 2014
169
+ config:
170
+
171
+ NAME STATE READ WRITE CKSUM
172
+ rpool ONLINE 0 0 0
173
+ mirror-0 ONLINE 0 0 0
174
+ c3t5d0s0 ONLINE 0 0 0
175
+ c3t4d0s0 ONLINE 0 0 0
176
+
177
+ errors: No known data errors
178
+ EOSR
179
+ end
180
+ before do
181
+ allow(plugin).to receive(:platform_family).and_return("solaris2")
182
+ allow(plugin).to receive(:collect_os).and_return(:solaris2)
183
+ allow(plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, zpool_out, ""))
184
+ allow(plugin).to receive(:shell_out).with("su adm -c \"zpool status rpool\"").and_return(mock_shell_out(0, zpool_status_rpool, ""))
185
+ allow(plugin).to receive(:shell_out).with("su adm -c \"zpool status tank\"").and_return(mock_shell_out(0, zpool_status_tank, ""))
186
+ end
187
+
188
+ it "Has entries for both zpools" do
189
+ plugin.run
190
+ expect(plugin[:zpools][:rpool]).to be
191
+ expect(plugin[:zpools][:tank]).to be
192
+ end
193
+
194
+ it "Has the correct pool size" do
195
+ plugin.run
196
+ expect(plugin[:zpools][:rpool][:pool_size]).to match("109G")
197
+ expect(plugin[:zpools][:tank][:pool_size]).to match("130T")
198
+ end
199
+
200
+ it "Has the correct pool allocated size" do
201
+ plugin.run
202
+ expect(plugin[:zpools][:rpool][:pool_allocated]).to match("66.2G")
203
+ expect(plugin[:zpools][:tank][:pool_allocated]).to match("4.91M")
204
+ end
205
+
206
+ it "Has the correct pool free size" do
207
+ plugin.run
208
+ expect(plugin[:zpools][:rpool][:pool_free]).to match("42.8G")
209
+ expect(plugin[:zpools][:tank][:pool_free]).to match("130T")
210
+ end
211
+
212
+ it "Has the correct capacity_used" do
213
+ plugin.run
214
+ expect(plugin[:zpools][:rpool][:capacity_used]).to match("60%")
215
+ expect(plugin[:zpools][:tank][:capacity_used]).to match("0%")
216
+ end
217
+
218
+ it "Has the correct dedup_factor" do
219
+ plugin.run
220
+ expect(plugin[:zpools][:rpool][:dedup_factor]).to match("1.00x")
221
+ expect(plugin[:zpools][:tank][:dedup_factor]).to match("1.00x")
222
+ end
223
+
224
+ it "Has the correct health" do
225
+ plugin.run
226
+ expect(plugin[:zpools][:rpool][:health]).to match("ONLINE")
227
+ expect(plugin[:zpools][:tank][:health]).to match("ONLINE")
228
+ end
229
+
230
+ it "Has the correct number of devices" do
231
+ plugin.run
232
+ expect(plugin[:zpools][:rpool][:devices].keys.size).to match(2)
233
+ expect(plugin[:zpools][:tank][:devices].keys.size).to match(12)
234
+ end
235
+
236
+ it "Has a version number" do
237
+ plugin.run
238
+ expect(plugin[:zpools][:rpool][:zpool_version]).to match("34")
239
+ expect(plugin[:zpools][:tank][:zpool_version]).to match("34")
240
+ end
241
+ end
242
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.1.0
4
+ version: 13.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -280,6 +280,7 @@ files:
280
280
  - lib/ohai/plugins/linux/network.rb
281
281
  - lib/ohai/plugins/linux/platform.rb
282
282
  - lib/ohai/plugins/linux/sessions.rb
283
+ - lib/ohai/plugins/linux/systemd_paths.rb
283
284
  - lib/ohai/plugins/linux/virtualization.rb
284
285
  - lib/ohai/plugins/lua.rb
285
286
  - lib/ohai/plugins/mono.rb
@@ -320,7 +321,6 @@ files:
320
321
  - lib/ohai/plugins/solaris2/network.rb
321
322
  - lib/ohai/plugins/solaris2/platform.rb
322
323
  - lib/ohai/plugins/solaris2/virtualization.rb
323
- - lib/ohai/plugins/solaris2/zpools.rb
324
324
  - lib/ohai/plugins/ssh_host_key.rb
325
325
  - lib/ohai/plugins/sysconf.rb
326
326
  - lib/ohai/plugins/timezone.rb
@@ -336,6 +336,7 @@ files:
336
336
  - lib/ohai/plugins/windows/network.rb
337
337
  - lib/ohai/plugins/windows/platform.rb
338
338
  - lib/ohai/plugins/windows/virtualization.rb
339
+ - lib/ohai/plugins/zpools.rb
339
340
  - lib/ohai/provides_map.rb
340
341
  - lib/ohai/runner.rb
341
342
  - lib/ohai/system.rb
@@ -458,6 +459,7 @@ files:
458
459
  - spec/unit/plugins/linux/network_spec.rb
459
460
  - spec/unit/plugins/linux/platform_spec.rb
460
461
  - spec/unit/plugins/linux/sessions_spec.rb
462
+ - spec/unit/plugins/linux/systemd_paths_spec.rb
461
463
  - spec/unit/plugins/linux/uptime_spec.rb
462
464
  - spec/unit/plugins/linux/virtualization_spec.rb
463
465
  - spec/unit/plugins/lua_spec.rb
@@ -498,7 +500,6 @@ files:
498
500
  - spec/unit/plugins/solaris2/network_spec.rb
499
501
  - spec/unit/plugins/solaris2/platform_spec.rb
500
502
  - spec/unit/plugins/solaris2/virtualization_spec.rb
501
- - spec/unit/plugins/solaris2/zpools_spec.rb
502
503
  - spec/unit/plugins/ssh_host_keys_spec.rb
503
504
  - spec/unit/plugins/sysconf_spec.rb
504
505
  - spec/unit/plugins/timezone_spec.rb
@@ -509,6 +510,7 @@ files:
509
510
  - spec/unit/plugins/windows/memory_spec.rb
510
511
  - spec/unit/plugins/windows/uptime_spec.rb
511
512
  - spec/unit/plugins/windows/virtualization_spec.rb
513
+ - spec/unit/plugins/zpools_spec.rb
512
514
  - spec/unit/provides_map_spec.rb
513
515
  - spec/unit/runner_spec.rb
514
516
  - spec/unit/system_spec.rb
@@ -534,7 +536,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
534
536
  version: '0'
535
537
  requirements: []
536
538
  rubyforge_project:
537
- rubygems_version: 2.6.11
539
+ rubygems_version: 2.6.12
538
540
  signing_key:
539
541
  specification_version: 4
540
542
  summary: Ohai profiles your system and emits JSON
@@ -1,153 +0,0 @@
1
- # License:: Apache License, Version 2.0
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require_relative "../../../spec_helper.rb"
17
-
18
- describe Ohai::System, "Solaris 2.x zpool plugin" do
19
- before(:each) do
20
- @plugin = get_plugin("solaris2/zpools")
21
- allow(@plugin).to receive(:collect_os).and_return(:solaris2)
22
-
23
- @zpool_status_rpool = <<-EOSR
24
- pool: rpool
25
- state: ONLINE
26
- scan: resilvered 65.6G in 0h8m with 0 errors on Fri Jun 6 14:22:40 2014
27
- config:
28
-
29
- NAME STATE READ WRITE CKSUM
30
- rpool ONLINE 0 0 0
31
- mirror-0 ONLINE 0 0 0
32
- c3t5d0s0 ONLINE 0 0 0
33
- c3t4d0s0 ONLINE 0 0 0
34
-
35
- errors: No known data errors
36
- EOSR
37
-
38
- @zpool_status_tank = <<-EOST
39
- pool: tank
40
- state: ONLINE
41
- scan: scrub repaired 0 in 0h0m with 0 errors on Fri Jun 6 14:43:40 2014
42
- config:
43
-
44
- NAME STATE READ WRITE CKSUM
45
- tank ONLINE 0 0 0
46
- raidz2-0 ONLINE 0 0 0
47
- c1t50014EE209D1DBA9d0 ONLINE 0 0 0
48
- c1t50014EE20A0ECED2d0 ONLINE 0 0 0
49
- c1t50014EE20A106BFFd0 ONLINE 0 0 0
50
- c1t50014EE20A1423E8d0 ONLINE 0 0 0
51
- c1t50014EE20A145447d0 ONLINE 0 0 0
52
- c1t50014EE20A29EE56d0 ONLINE 0 0 0
53
- raidz2-1 ONLINE 0 0 0
54
- c1t50014EE20A2B984Cd0 ONLINE 0 0 0
55
- c1t50014EE20A2BBC78d0 ONLINE 0 0 0
56
- c1t50014EE20A2BDCA9d0 ONLINE 0 0 0
57
- c1t50014EE25F697DC4d0 ONLINE 0 0 0
58
- c1t50014EE25F698BECd0 ONLINE 0 0 0
59
- c1t50014EE25F6998DAd0 ONLINE 0 0 0
60
- EOST
61
- @zpool_out = <<-EOZO
62
- rpool 109G 66.2G 42.8G 60% 1.00x ONLINE 34
63
- tank 130T 4.91M 130T 0% 1.00x ONLINE 34
64
- EOZO
65
- allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, @zpool_out, ""))
66
- allow(@plugin).to receive(:shell_out).with("su adm -c \"zpool status rpool\"").and_return(mock_shell_out(0, @zpool_status_rpool, ""))
67
- allow(@plugin).to receive(:shell_out).with("su adm -c \"zpool status tank\"").and_return(mock_shell_out(0, @zpool_status_tank, ""))
68
- end
69
-
70
- describe "On Solaris2 Common" do
71
- it "Should have entries for both zpools" do
72
- @plugin.run
73
- expect(@plugin[:zpools][:rpool]).to be
74
- expect(@plugin[:zpools][:tank]).to be
75
- end
76
-
77
- it "Should have the correct pool size" do
78
- @plugin.run
79
- expect(@plugin[:zpools][:rpool][:pool_size]).to match("109G")
80
- expect(@plugin[:zpools][:tank][:pool_size]).to match("130T")
81
- end
82
-
83
- it "Should have the correct pool allocated size" do
84
- @plugin.run
85
- expect(@plugin[:zpools][:rpool][:pool_allocated]).to match("66.2G")
86
- expect(@plugin[:zpools][:tank][:pool_allocated]).to match("4.91M")
87
- end
88
-
89
- it "Should have the correct pool free size" do
90
- @plugin.run
91
- expect(@plugin[:zpools][:rpool][:pool_free]).to match("42.8G")
92
- expect(@plugin[:zpools][:tank][:pool_free]).to match("130T")
93
- end
94
-
95
- it "Should have the correct capacity_used" do
96
- @plugin.run
97
- expect(@plugin[:zpools][:rpool][:capacity_used]).to match("60%")
98
- expect(@plugin[:zpools][:tank][:capacity_used]).to match("0%")
99
- end
100
-
101
- it "Should have the correct dedup_factor" do
102
- @plugin.run
103
- expect(@plugin[:zpools][:rpool][:dedup_factor]).to match("1.00x")
104
- expect(@plugin[:zpools][:tank][:dedup_factor]).to match("1.00x")
105
- end
106
-
107
- it "Should have the correct health" do
108
- @plugin.run
109
- expect(@plugin[:zpools][:rpool][:health]).to match("ONLINE")
110
- expect(@plugin[:zpools][:tank][:health]).to match("ONLINE")
111
- end
112
-
113
- it "Should have the correct number of devices" do
114
- @plugin.run
115
- expect(@plugin[:zpools][:rpool][:devices].keys.size).to match(2)
116
- expect(@plugin[:zpools][:tank][:devices].keys.size).to match(12)
117
- end
118
- end
119
-
120
- describe "On OmniOS_151006" do
121
- before(:each) do
122
- @zpool_out = <<-EOZO
123
- rpool 109G 66.2G 42.8G 60% 1.00x ONLINE -
124
- tank 130T 4.91M 130T 0% 1.00x ONLINE -
125
- EOZO
126
- allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, @zpool_out, ""))
127
- end
128
-
129
- it "Won't have a version number" do
130
- @plugin.run
131
- expect(@plugin[:zpools][:rpool][:zpool_version]).to match("-")
132
- expect(@plugin[:zpools][:tank][:zpool_version]).to match("-")
133
- end
134
-
135
- end
136
-
137
- describe "On Solaris_11.1" do
138
- before(:each) do
139
- @zpool_out = <<-EOZO
140
- rpool 109G 66.2G 42.8G 60% 1.00x ONLINE 34
141
- tank 130T 4.91M 130T 0% 1.00x ONLINE 34
142
- EOZO
143
- allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, @zpool_out, ""))
144
- end
145
-
146
- it "Should have a version number" do
147
- @plugin.run
148
- expect(@plugin[:zpools][:rpool][:zpool_version]).to match("34")
149
- expect(@plugin[:zpools][:tank][:zpool_version]).to match("34")
150
- end
151
-
152
- end
153
- end