ohai 7.4.1 → 7.6.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +8 -8
- data/Rakefile +2 -2
- data/lib/ohai/mixin/cloudstack_metadata.rb +88 -0
- data/lib/ohai/plugins/aix/kernel.rb +15 -1
- data/lib/ohai/plugins/aix/network.rb +5 -2
- data/lib/ohai/plugins/aix/virtualization.rb +39 -0
- data/lib/ohai/plugins/cloud.rb +32 -0
- data/lib/ohai/plugins/cloudstack.rb +43 -0
- data/lib/ohai/plugins/darwin/cpu.rb +2 -2
- data/lib/ohai/plugins/go.rb +30 -0
- data/lib/ohai/plugins/hostname.rb +1 -1
- data/lib/ohai/plugins/linux/filesystem.rb +19 -5
- data/lib/ohai/plugins/linux/platform.rb +5 -1
- data/lib/ohai/plugins/openstack.rb +22 -0
- data/lib/ohai/plugins/passwd.rb +5 -1
- data/lib/ohai/plugins/python.rb +3 -3
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/mixin/cloudstack_metadata_spec.rb +33 -0
- data/spec/unit/plugins/aix/kernel_spec.rb +6 -3
- data/spec/unit/plugins/aix/network_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +53 -0
- data/spec/unit/plugins/cloud_spec.rb +31 -0
- data/spec/unit/plugins/cloudstack_spec.rb +155 -0
- data/spec/unit/plugins/darwin/cpu_spec.rb +2 -2
- data/spec/unit/plugins/go_spec.rb +44 -0
- data/spec/unit/plugins/hostname_spec.rb +12 -0
- data/spec/unit/plugins/linux/filesystem_spec.rb +55 -40
- data/spec/unit/plugins/linux/platform_spec.rb +36 -0
- data/spec/unit/plugins/openstack_spec.rb +55 -0
- data/spec/unit/plugins/passwd_spec.rb +3 -2
- data/spec/unit/plugins/python_spec.rb +22 -20
- data/spec/unit/plugins/solaris2/zpools_spec.rb +153 -0
- metadata +75 -59
@@ -72,6 +72,18 @@ describe Ohai::System, "hostname plugin" do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
context "when a system has a bare hostname without a FQDN" do
|
76
|
+
before(:each) do
|
77
|
+
@plugin.stub(:collect_os).and_return(:default)
|
78
|
+
@plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie", ""))
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should correctly set the [short] hostname" do
|
82
|
+
@plugin.run
|
83
|
+
@plugin[:hostname].should == "katie"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
75
87
|
context "hostname --fqdn when it returns empty string" do
|
76
88
|
before(:each) do
|
77
89
|
@plugin.stub(:collect_os).and_return(:linux)
|
@@ -26,7 +26,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
26
26
|
@plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
|
27
27
|
@plugin.stub(:shell_out).with("df -i").and_return(mock_shell_out(0, "", ""))
|
28
28
|
@plugin.stub(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
|
29
|
-
File.stub(:
|
29
|
+
File.stub(:exist?).with("/bin/lsblk").and_return(false)
|
30
30
|
@plugin.stub(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, "", ""))
|
31
31
|
@plugin.stub(:shell_out).with("blkid -s UUID").and_return(mock_shell_out(0, "", ""))
|
32
32
|
@plugin.stub(:shell_out).with("blkid -s LABEL").and_return(mock_shell_out(0, "", ""))
|
@@ -38,7 +38,22 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
38
38
|
@plugin.stub(:shell_out).with("lsblk -r -n -o NAME,LABEL").
|
39
39
|
and_return(mock_shell_out(0, "", ""))
|
40
40
|
|
41
|
-
File.stub(:
|
41
|
+
File.stub(:exist?).with("/proc/mounts").and_return(false)
|
42
|
+
|
43
|
+
%w{sdb1 sdb2 sda1 sda2 md0 md1 md2}.each do |name|
|
44
|
+
File.stub(:exist?).with("/dev/#{name}").and_return(true)
|
45
|
+
end
|
46
|
+
%w{
|
47
|
+
sys.vg-root.lv
|
48
|
+
sys.vg-swap.lv
|
49
|
+
sys.vg-tmp.lv
|
50
|
+
sys.vg-usr.lv
|
51
|
+
sys.vg-var.lv
|
52
|
+
sys.vg-home.lv
|
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)
|
56
|
+
end
|
42
57
|
end
|
43
58
|
|
44
59
|
describe "when gathering filesystem usage data from df" do
|
@@ -191,20 +206,20 @@ BLKID_TYPE
|
|
191
206
|
|
192
207
|
describe "when gathering filesystem type data from lsblk" do
|
193
208
|
before(:each) do
|
194
|
-
File.stub(:
|
209
|
+
File.stub(:exist?).with("/bin/lsblk").and_return(true)
|
195
210
|
@stdout = <<-BLKID_TYPE
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
211
|
+
sdb1 linux_raid_member
|
212
|
+
sdb2 linux_raid_member
|
213
|
+
sda1 linux_raid_member
|
214
|
+
sda2 linux_raid_member
|
215
|
+
md0 ext3
|
216
|
+
md1 LVM2_member
|
217
|
+
sys.vg-root.lv ext4
|
218
|
+
sys.vg-swap.lv swap
|
219
|
+
sys.vg-tmp.lv ext4
|
220
|
+
sys.vg-usr.lv ext4
|
221
|
+
sys.vg-var.lv ext4
|
222
|
+
sys.vg-home.lv xfs
|
208
223
|
BLKID_TYPE
|
209
224
|
@plugin.stub(:shell_out).with("lsblk -r -n -o NAME,FSTYPE").
|
210
225
|
and_return(mock_shell_out(0, @stdout, ""))
|
@@ -254,20 +269,20 @@ BLKID_UUID
|
|
254
269
|
|
255
270
|
describe "when gathering filesystem uuid data from lsblk" do
|
256
271
|
before(:each) do
|
257
|
-
File.stub(:
|
272
|
+
File.stub(:exist?).with("/bin/lsblk").and_return(true)
|
258
273
|
@stdout = <<-BLKID_UUID
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
274
|
+
sdb1 bd1197e0-6997-1f3a-e27e-7801388308b5
|
275
|
+
sdb2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa
|
276
|
+
sda1 bd1197e0-6997-1f3a-e27e-7801388308b5
|
277
|
+
sda2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa
|
278
|
+
md0 37b8de8e-0fe3-4b5a-b9b4-dde33e19bb32
|
279
|
+
md1 YsIe0R-fj1y-LXTd-imla-opKo-OuIe-TBoxSK
|
280
|
+
sys.vg-root.lv 7742d14b-80a3-4e97-9a32-478be9ea9aea
|
281
|
+
sys.vg-swap.lv 9bc2e515-8ddc-41c3-9f63-4eaebde9ce96
|
282
|
+
sys.vg-tmp.lv 74cf7eb9-428f-479e-9a4a-9943401e81e5
|
283
|
+
sys.vg-usr.lv 26ec33c5-d00b-4f88-a550-492def013bbc
|
284
|
+
sys.vg-var.lv 6b559c35-7847-4ae2-b512-c99012d3f5b3
|
285
|
+
sys.vg-home.lv d6efda02-1b73-453c-8c74-7d8dee78fa5e
|
271
286
|
BLKID_UUID
|
272
287
|
@plugin.stub(:shell_out).with("lsblk -r -n -o NAME,UUID").
|
273
288
|
and_return(mock_shell_out(0, @stdout, ""))
|
@@ -316,18 +331,18 @@ BLKID_LABEL
|
|
316
331
|
|
317
332
|
describe "when gathering filesystem label data from lsblk" do
|
318
333
|
before(:each) do
|
319
|
-
File.stub(:
|
334
|
+
File.stub(:exist?).with("/bin/lsblk").and_return(true)
|
320
335
|
@stdout = <<-BLKID_LABEL
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
336
|
+
sda1 fuego:0
|
337
|
+
sda2 fuego:1
|
338
|
+
sdb1 fuego:0
|
339
|
+
sdb2 fuego:1
|
340
|
+
md0 /boot
|
341
|
+
sys.vg-root.lv /
|
342
|
+
sys.vg-tmp.lv /tmp
|
343
|
+
sys.vg-usr.lv /usr
|
344
|
+
sys.vg-var.lv /var
|
345
|
+
sys.vg-home.lv /home
|
331
346
|
BLKID_LABEL
|
332
347
|
@plugin.stub(:shell_out).with("lsblk -r -n -o NAME,LABEL").
|
333
348
|
and_return(mock_shell_out(0, @stdout, ""))
|
@@ -348,7 +363,7 @@ BLKID_LABEL
|
|
348
363
|
|
349
364
|
describe "when gathering data from /proc/mounts" do
|
350
365
|
before(:each) do
|
351
|
-
File.stub(:
|
366
|
+
File.stub(:exist?).with("/proc/mounts").and_return(true)
|
352
367
|
@double_file = double("/proc/mounts")
|
353
368
|
@mounts = <<-MOUNTS
|
354
369
|
rootfs / rootfs rw 0 0
|
@@ -35,6 +35,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
35
35
|
File.stub(:exists?).with("/etc/slackware-version").and_return(false)
|
36
36
|
File.stub(:exists?).with("/etc/enterprise-release").and_return(false)
|
37
37
|
File.stub(:exists?).with("/etc/oracle-release").and_return(false)
|
38
|
+
File.stub(:exists?).with("/etc/parallels-release").and_return(false)
|
38
39
|
File.stub(:exists?).with("/usr/bin/raspi-config").and_return(false)
|
39
40
|
end
|
40
41
|
|
@@ -295,6 +296,41 @@ describe Ohai::System, "Linux plugin platform" do
|
|
295
296
|
@plugin[:platform].should == "fedora"
|
296
297
|
@plugin[:platform_version].to_i.should == 13
|
297
298
|
end
|
299
|
+
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
describe "on pcs linux" do
|
304
|
+
describe "with lsb_result" do
|
305
|
+
it "should read the platform as parallels and version as 6.0.5" do
|
306
|
+
@plugin[:lsb][:id] = "CloudLinuxServer"
|
307
|
+
@plugin[:lsb][:release] = "6.5"
|
308
|
+
File.stub(:exists?).with("/etc/redhat-release").and_return(true)
|
309
|
+
File.stub(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
|
310
|
+
File.should_receive(:exists?).with("/etc/parallels-release").and_return(true)
|
311
|
+
File.should_receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
|
312
|
+
@plugin.run
|
313
|
+
@plugin[:platform].should == "parallels"
|
314
|
+
@plugin[:platform_version].should == "6.0.5"
|
315
|
+
@plugin[:platform_family].should == "rhel"
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
describe "without lsb_results" do
|
320
|
+
before(:each) do
|
321
|
+
@plugin.lsb = nil
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should read the platform as parallels and version as 6.0.5" do
|
325
|
+
File.stub(:exists?).with("/etc/redhat-release").and_return(true)
|
326
|
+
File.stub(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
|
327
|
+
File.should_receive(:exists?).with("/etc/parallels-release").and_return(true)
|
328
|
+
File.should_receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
|
329
|
+
@plugin.run
|
330
|
+
@plugin[:platform].should == "parallels"
|
331
|
+
@plugin[:platform_version].should == "6.0.5"
|
332
|
+
@plugin[:platform_family].should == "rhel"
|
333
|
+
end
|
298
334
|
end
|
299
335
|
end
|
300
336
|
|
@@ -118,6 +118,26 @@ EOM
|
|
118
118
|
}
|
119
119
|
end
|
120
120
|
|
121
|
+
let(:openstack_metadata_version) { "2013-04-04" }
|
122
|
+
let(:openstack_metadata_endpoint) { "http://169.254.169.254/openstack/" }
|
123
|
+
|
124
|
+
let(:openstack_metadata_values) do
|
125
|
+
'{
|
126
|
+
"availability_zone" : "nova",
|
127
|
+
"hostname" : "ohai.novalocal",
|
128
|
+
"launch_index" : 0,
|
129
|
+
"meta" : {
|
130
|
+
"priority" : "low",
|
131
|
+
"role" : "ohaiserver"
|
132
|
+
},
|
133
|
+
"name" : "ohai_spec",
|
134
|
+
"public_keys" : {
|
135
|
+
"mykey" : "SSH KEY DATA"
|
136
|
+
},
|
137
|
+
"uuid" : "00000000-0000-0000-0000-100000000000"
|
138
|
+
}'
|
139
|
+
end
|
140
|
+
|
121
141
|
let(:http_client) { double("Net::HTTP", :read_timeout= => nil) }
|
122
142
|
|
123
143
|
def expect_get(url, response_body)
|
@@ -126,6 +146,12 @@ EOM
|
|
126
146
|
and_return(double("HTTP Response", :code => "200", :body => response_body))
|
127
147
|
end
|
128
148
|
|
149
|
+
def expect_get_response(url, response_body)
|
150
|
+
http_client.should_receive(:get_response).
|
151
|
+
with(url,nil,nil).
|
152
|
+
and_return(double("HTTP Response", :code => "200", :body => response_body))
|
153
|
+
end
|
154
|
+
|
129
155
|
before do
|
130
156
|
openstack_plugin.should_receive(:can_metadata_connect?).
|
131
157
|
with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR,80).
|
@@ -143,6 +169,11 @@ EOM
|
|
143
169
|
expect_get("/#{metadata_version}/meta-data/#{md_id}", md_value)
|
144
170
|
end
|
145
171
|
|
172
|
+
expect_get_response(
|
173
|
+
URI.parse("#{openstack_metadata_endpoint}#{openstack_metadata_version}/meta_data.json"),
|
174
|
+
openstack_metadata_values
|
175
|
+
)
|
176
|
+
|
146
177
|
openstack_plugin.run
|
147
178
|
end
|
148
179
|
|
@@ -206,6 +237,30 @@ EOM
|
|
206
237
|
it "reads the provider from the metadata service" do
|
207
238
|
expect(ohai_data['openstack']['provider']).to eq("openstack")
|
208
239
|
end
|
240
|
+
|
241
|
+
context 'Retreive openStack specific metadata' do
|
242
|
+
it "reads the availability_zone from the openstack metadata service" do
|
243
|
+
expect(ohai_data['openstack']['metadata']['availability_zone']).to eq('nova')
|
244
|
+
end
|
245
|
+
it "reads the hostname from the openstack metadata service" do
|
246
|
+
expect(ohai_data['openstack']['metadata']['hostname']).to eq('ohai.novalocal')
|
247
|
+
end
|
248
|
+
it "reads the launch_index from the openstack metadata service" do
|
249
|
+
expect(ohai_data['openstack']['metadata']['launch_index']).to eq(0)
|
250
|
+
end
|
251
|
+
it "reads the meta from the openstack metadata service" do
|
252
|
+
expect(ohai_data['openstack']['metadata']['meta']).to eq({ "priority" => "low", "role" => "ohaiserver"})
|
253
|
+
end
|
254
|
+
it "reads the name from the openstack metadata service" do
|
255
|
+
expect(ohai_data['openstack']['metadata']['name']).to eq('ohai_spec')
|
256
|
+
end
|
257
|
+
it "reads the public_keys from the openstack metadata service" do
|
258
|
+
expect(ohai_data['openstack']['metadata']['public_keys']).to eq({"mykey" => "SSH KEY DATA"})
|
259
|
+
end
|
260
|
+
it "reads the uuid from the openstack metadata service" do
|
261
|
+
expect(ohai_data['openstack']['metadata']['uuid']).to eq('00000000-0000-0000-0000-100000000000')
|
262
|
+
end
|
263
|
+
end
|
209
264
|
end
|
210
265
|
|
211
266
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
2
2
|
|
3
|
-
describe Ohai::System, "plugin etc" do
|
3
|
+
describe Ohai::System, "plugin etc", :unix_only do
|
4
4
|
before(:each) do
|
5
5
|
@plugin = get_plugin("passwd")
|
6
6
|
end
|
@@ -24,7 +24,8 @@ describe Ohai::System, "plugin etc" do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should set the current user" do
|
27
|
-
|
27
|
+
Process.should_receive(:euid).and_return('31337')
|
28
|
+
Etc.should_receive(:getpwuid).and_return(PasswdEntry.new('chef', 31337, 31337, '/home/chef', '/bin/ksh', 'Julia Child'))
|
28
29
|
@plugin.run
|
29
30
|
@plugin[:current_user].should == 'chef'
|
30
31
|
end
|
@@ -7,9 +7,9 @@
|
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -17,33 +17,35 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
|
21
20
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
22
21
|
|
23
22
|
describe Ohai::System, "plugin python" do
|
23
|
+
let(:stdout) { "2.5.2 (r252:60911, Jan 4 2009, 17:40:26)\n[GCC 4.3.2]\n" }
|
24
|
+
|
25
|
+
let(:retval) { 0 }
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
let(:plugin) do
|
28
|
+
plugin = get_plugin("python")
|
29
|
+
plugin[:languages] = Mash.new
|
30
|
+
expect(plugin).to receive(:shell_out).with("python -c \"import sys; print (sys.version)\"").and_return(mock_shell_out(retval, stdout, ""))
|
31
|
+
plugin
|
30
32
|
end
|
31
|
-
|
33
|
+
|
32
34
|
it "should get the python version from printing sys.version and sys.platform" do
|
33
|
-
|
34
|
-
@plugin.run
|
35
|
+
plugin.run
|
35
36
|
end
|
36
37
|
|
37
38
|
it "should set languages[:python][:version]" do
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should not set the languages[:python] tree up if python command fails" do
|
43
|
-
@stdout = "2.5.2 (r252:60911, Jan 4 2009, 17:40:26)\n[GCC 4.3.2]\n"
|
44
|
-
@plugin.stub(:shell_out).with("python -c \"import sys; print sys.version\"").and_return(mock_shell_out(1, @stdout, ""))
|
45
|
-
@plugin.run
|
46
|
-
@plugin.languages.should_not have_key(:python)
|
39
|
+
plugin.run
|
40
|
+
expect(plugin.languages[:python][:version]).to eql("2.5.2")
|
47
41
|
end
|
48
42
|
|
43
|
+
context "when the python command fails" do
|
44
|
+
let(:retval) { 1 }
|
45
|
+
|
46
|
+
it "should not set the languages[:python] tree up" do
|
47
|
+
plugin.run
|
48
|
+
expect(plugin.languages).not_to have_key(:python)
|
49
|
+
end
|
50
|
+
end
|
49
51
|
end
|
@@ -0,0 +1,153 @@
|
|
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 File.expand_path(File.dirname(__FILE__) + '/../../../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
|
+
@plugin.stub(: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
|
+
@plugin.stub(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0,@zpool_out,""))
|
66
|
+
@plugin.stub(:shell_out).with("su adm -c \"zpool status rpool\"").and_return(mock_shell_out(0,@zpool_status_rpool,""))
|
67
|
+
@plugin.stub(: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
|
+
@plugin.stub(: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
|
+
@plugin.stub(: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
|