ohai 14.2.0 → 14.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/lib/ohai/application.rb +29 -29
- data/lib/ohai/common/dmi.rb +5 -5
- data/lib/ohai/dsl/plugin.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvii.rb +3 -3
- data/lib/ohai/mixin/azure_metadata.rb +2 -2
- data/lib/ohai/mixin/do_metadata.rb +3 -3
- data/lib/ohai/mixin/ec2_metadata.rb +8 -8
- data/lib/ohai/mixin/gce_metadata.rb +2 -2
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugins/aix/cpu.rb +3 -3
- data/lib/ohai/plugins/aix/filesystem.rb +1 -1
- data/lib/ohai/plugins/aix/kernel.rb +1 -1
- data/lib/ohai/plugins/aix/memory.rb +1 -1
- data/lib/ohai/plugins/aix/network.rb +3 -3
- data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +1 -1
- data/lib/ohai/plugins/darwin/hardware.rb +1 -1
- data/lib/ohai/plugins/darwin/network.rb +5 -5
- data/lib/ohai/plugins/darwin/platform.rb +1 -1
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/filesystem.rb +5 -5
- data/lib/ohai/plugins/hostname.rb +5 -5
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linux/lspci.rb +4 -4
- data/lib/ohai/plugins/linux/memory.rb +4 -4
- data/lib/ohai/plugins/linux/network.rb +16 -16
- data/lib/ohai/plugins/linux/platform.rb +7 -1
- data/lib/ohai/plugins/netbsd/network.rb +1 -1
- data/lib/ohai/plugins/network.rb +5 -5
- data/lib/ohai/plugins/openbsd/network.rb +1 -1
- data/lib/ohai/plugins/packages.rb +1 -1
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +13 -13
- data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
- data/lib/ohai/plugins/solaris2/filesystem.rb +6 -6
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +36 -36
- data/lib/ohai/plugins/windows/network.rb +2 -2
- data/lib/ohai/util/win32/group_helper.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/functional/application_spec.rb +6 -6
- data/spec/functional/loader_spec.rb +4 -4
- data/spec/functional/plugins/windows/uptime_spec.rb +1 -2
- data/spec/spec_helper.rb +5 -5
- data/spec/unit/application_spec.rb +11 -11
- data/spec/unit/config_spec.rb +5 -5
- data/spec/unit/dsl/plugin_spec.rb +5 -5
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +41 -41
- data/spec/unit/mixin/azure_metadata_spec.rb +3 -3
- data/spec/unit/mixin/command_spec.rb +64 -64
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +9 -9
- data/spec/unit/plugins/abort_spec.rb +6 -6
- data/spec/unit/plugins/aix/cpu_spec.rb +16 -16
- data/spec/unit/plugins/aix/filesystem_spec.rb +57 -57
- data/spec/unit/plugins/aix/network_spec.rb +35 -35
- data/spec/unit/plugins/aix/virtualization_spec.rb +210 -210
- data/spec/unit/plugins/azure_spec.rb +49 -49
- data/spec/unit/plugins/bsd/filesystem_spec.rb +13 -13
- data/spec/unit/plugins/bsd/virtualization_spec.rb +10 -10
- data/spec/unit/plugins/c_spec.rb +54 -54
- data/spec/unit/plugins/chef_spec.rb +3 -3
- data/spec/unit/plugins/darwin/cpu_spec.rb +54 -54
- data/spec/unit/plugins/darwin/filesystem_spec.rb +34 -34
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +1070 -1070
- data/spec/unit/plugins/darwin/memory_spec.rb +16 -16
- data/spec/unit/plugins/darwin/network_spec.rb +382 -382
- data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
- data/spec/unit/plugins/dmi_spec.rb +83 -83
- data/spec/unit/plugins/docker_spec.rb +2 -2
- data/spec/unit/plugins/ec2_spec.rb +156 -156
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/cpu_spec.rb +18 -18
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +4 -4
- data/spec/unit/plugins/joyent_spec.rb +9 -9
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +155 -155
- data/spec/unit/plugins/linux/filesystem_spec.rb +229 -229
- data/spec/unit/plugins/linux/kernel_spec.rb +9 -9
- data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
- data/spec/unit/plugins/linux/lspci_spec.rb +58 -58
- data/spec/unit/plugins/linux/mdadm_spec.rb +54 -54
- data/spec/unit/plugins/linux/memory_spec.rb +35 -35
- data/spec/unit/plugins/linux/network_spec.rb +464 -464
- data/spec/unit/plugins/linux/platform_spec.rb +84 -68
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +40 -40
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +197 -197
- data/spec/unit/plugins/mono_spec.rb +11 -11
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +2 -2
- data/spec/unit/plugins/openstack_spec.rb +43 -43
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/passwd_spec.rb +9 -9
- data/spec/unit/plugins/php_spec.rb +22 -22
- data/spec/unit/plugins/powershell_spec.rb +13 -13
- data/spec/unit/plugins/rackspace_spec.rb +38 -38
- data/spec/unit/plugins/ruby_spec.rb +14 -14
- data/spec/unit/plugins/scaleway_spec.rb +6 -6
- data/spec/unit/plugins/scsi_spec.rb +7 -7
- data/spec/unit/plugins/solaris2/cpu_spec.rb +2594 -2594
- data/spec/unit/plugins/solaris2/dmi_spec.rb +91 -91
- data/spec/unit/plugins/solaris2/filesystem.rb +8 -8
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +92 -93
- data/spec/unit/plugins/solaris2/platform_spec.rb +24 -24
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +22 -22
- data/spec/unit/plugins/ssh_host_keys_spec.rb +12 -12
- data/spec/unit/plugins/sysconf_spec.rb +321 -321
- data/spec/unit/plugins/virtualbox_spec.rb +27 -27
- data/spec/unit/plugins/windows/cpu_spec.rb +9 -9
- data/spec/unit/plugins/windows/kernel_spec.rb +12 -12
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/zpools_spec.rb +41 -41
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/system_spec.rb +55 -55
- metadata +3 -4
- data/docs/man/man1/ohai.1 +0 -97
@@ -21,15 +21,15 @@ require_relative "../../../spec_helper.rb"
|
|
21
21
|
|
22
22
|
describe Ohai::System, "Linux kernel plugin" do
|
23
23
|
before(:each) do
|
24
|
-
@env_lsmod =
|
25
|
-
Module Size Used by
|
26
|
-
dm_crypt 22321 0
|
27
|
-
psmouse 81038 0
|
28
|
-
acpiphp 23314 0
|
29
|
-
microcode 18286 0
|
30
|
-
serio_raw 13031 0
|
31
|
-
virtio_balloon 13168 0
|
32
|
-
floppy 55441 0
|
24
|
+
@env_lsmod = <<~ENV_LSMOD
|
25
|
+
Module Size Used by
|
26
|
+
dm_crypt 22321 0
|
27
|
+
psmouse 81038 0
|
28
|
+
acpiphp 23314 0
|
29
|
+
microcode 18286 0
|
30
|
+
serio_raw 13031 0
|
31
|
+
virtio_balloon 13168 0
|
32
|
+
floppy 55441 0
|
33
33
|
ENV_LSMOD
|
34
34
|
@version_module = {
|
35
35
|
dm_crypt: "",
|
@@ -29,11 +29,11 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
29
29
|
describe "on systems with /etc/lsb-release" do
|
30
30
|
before(:each) do
|
31
31
|
@double_file = double("/etc/lsb-release")
|
32
|
-
allow(@double_file).to receive(:each)
|
33
|
-
and_yield("DISTRIB_ID=Ubuntu")
|
34
|
-
and_yield("DISTRIB_RELEASE=8.04")
|
35
|
-
and_yield("DISTRIB_CODENAME=hardy")
|
36
|
-
and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
|
32
|
+
allow(@double_file).to receive(:each)
|
33
|
+
.and_yield("DISTRIB_ID=Ubuntu")
|
34
|
+
.and_yield("DISTRIB_RELEASE=8.04")
|
35
|
+
.and_yield("DISTRIB_CODENAME=hardy")
|
36
|
+
.and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
|
37
37
|
allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
|
38
38
|
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(false)
|
39
39
|
allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(true)
|
@@ -64,7 +64,7 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
64
64
|
before(:each) do
|
65
65
|
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(true)
|
66
66
|
|
67
|
-
@stdin = double("STDIN", { :
|
67
|
+
@stdin = double("STDIN", { close: true })
|
68
68
|
@pid = 10
|
69
69
|
@stderr = double("STDERR")
|
70
70
|
@stdout = double("STDOUT")
|
@@ -74,12 +74,12 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
74
74
|
|
75
75
|
describe "on Centos 5.4 correctly" do
|
76
76
|
before(:each) do
|
77
|
-
@stdout =
|
78
|
-
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
|
79
|
-
Distributor ID: CentOS
|
80
|
-
Description: CentOS release 5.4 (Final)
|
81
|
-
Release: 5.4
|
82
|
-
Codename: Final
|
77
|
+
@stdout = <<~LSB_RELEASE
|
78
|
+
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
|
79
|
+
Distributor ID: CentOS
|
80
|
+
Description: CentOS release 5.4 (Final)
|
81
|
+
Release: 5.4
|
82
|
+
Codename: Final
|
83
83
|
LSB_RELEASE
|
84
84
|
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
85
85
|
end
|
@@ -107,12 +107,12 @@ LSB_RELEASE
|
|
107
107
|
|
108
108
|
describe "on Fedora 14 correctly" do
|
109
109
|
before(:each) do
|
110
|
-
@stdout =
|
111
|
-
LSB Version: :core-4.0-ia32:core-4.0-noarch
|
112
|
-
Distributor ID: Fedora
|
113
|
-
Description: Fedora release 14 (Laughlin)
|
114
|
-
Release: 14
|
115
|
-
Codename: Laughlin
|
110
|
+
@stdout = <<~LSB_RELEASE
|
111
|
+
LSB Version: :core-4.0-ia32:core-4.0-noarch
|
112
|
+
Distributor ID: Fedora
|
113
|
+
Description: Fedora release 14 (Laughlin)
|
114
|
+
Release: 14
|
115
|
+
Codename: Laughlin
|
116
116
|
LSB_RELEASE
|
117
117
|
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
118
118
|
end
|
@@ -22,69 +22,69 @@ describe Ohai::System, "Linux lspci plugin" do
|
|
22
22
|
let(:plugin) { get_plugin("linux/lspci") }
|
23
23
|
before(:each) do
|
24
24
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
25
|
-
@stdout =
|
26
|
-
Device: 00:1f.3
|
27
|
-
Class: Audio device [0403]
|
28
|
-
Vendor: Intel Corporation [8086]
|
29
|
-
Device: Sunrise Point-LP HD Audio [9d71]
|
30
|
-
SVendor: Lenovo [17aa]
|
31
|
-
SDevice: Sunrise Point-LP HD Audio [224e]
|
32
|
-
Rev: 21
|
33
|
-
Driver: snd_hda_intel
|
34
|
-
Module: snd_hda_intel
|
35
|
-
Module: snd_soc_skl
|
25
|
+
@stdout = <<~LSPCI
|
26
|
+
Device: 00:1f.3
|
27
|
+
Class: Audio device [0403]
|
28
|
+
Vendor: Intel Corporation [8086]
|
29
|
+
Device: Sunrise Point-LP HD Audio [9d71]
|
30
|
+
SVendor: Lenovo [17aa]
|
31
|
+
SDevice: Sunrise Point-LP HD Audio [224e]
|
32
|
+
Rev: 21
|
33
|
+
Driver: snd_hda_intel
|
34
|
+
Module: snd_hda_intel
|
35
|
+
Module: snd_soc_skl
|
36
36
|
|
37
|
-
Device: 00:1f.4
|
38
|
-
Class: SMBus [0c05]
|
39
|
-
Vendor: Intel Corporation [8086]
|
40
|
-
Device: Sunrise Point-LP SMBus [9d23]
|
41
|
-
SVendor: Lenovo [17aa]
|
42
|
-
SDevice: Sunrise Point-LP SMBus [224e]
|
43
|
-
Rev: 21
|
44
|
-
Driver: i801_smbus
|
45
|
-
Module: i2c_i801
|
37
|
+
Device: 00:1f.4
|
38
|
+
Class: SMBus [0c05]
|
39
|
+
Vendor: Intel Corporation [8086]
|
40
|
+
Device: Sunrise Point-LP SMBus [9d23]
|
41
|
+
SVendor: Lenovo [17aa]
|
42
|
+
SDevice: Sunrise Point-LP SMBus [224e]
|
43
|
+
Rev: 21
|
44
|
+
Driver: i801_smbus
|
45
|
+
Module: i2c_i801
|
46
46
|
|
47
|
-
Device: 00:1f.6
|
48
|
-
Class: Ethernet controller [0200]
|
49
|
-
Vendor: Intel Corporation [8086]
|
50
|
-
Device: Ethernet Connection (4) I219-LM [15d7]
|
51
|
-
SVendor: Lenovo [17aa]
|
52
|
-
SDevice: Ethernet Connection (4) I219-LM [224e]
|
53
|
-
Rev: 21
|
54
|
-
Driver: e1000e
|
55
|
-
Module: e1000e
|
47
|
+
Device: 00:1f.6
|
48
|
+
Class: Ethernet controller [0200]
|
49
|
+
Vendor: Intel Corporation [8086]
|
50
|
+
Device: Ethernet Connection (4) I219-LM [15d7]
|
51
|
+
SVendor: Lenovo [17aa]
|
52
|
+
SDevice: Ethernet Connection (4) I219-LM [224e]
|
53
|
+
Rev: 21
|
54
|
+
Driver: e1000e
|
55
|
+
Module: e1000e
|
56
56
|
|
57
|
-
Device: 02:00.0
|
58
|
-
Class: Unassigned class [ff00]
|
59
|
-
Vendor: Realtek Semiconductor Co., Ltd. [10ec]
|
60
|
-
Device: RTS525A PCI Express Card Reader [525a]
|
61
|
-
SVendor: Lenovo [17aa]
|
62
|
-
SDevice: RTS525A PCI Express Card Reader [224e]
|
63
|
-
Rev: 01
|
64
|
-
Driver: rtsx_pci
|
65
|
-
Module: rtsx_pci
|
57
|
+
Device: 02:00.0
|
58
|
+
Class: Unassigned class [ff00]
|
59
|
+
Vendor: Realtek Semiconductor Co., Ltd. [10ec]
|
60
|
+
Device: RTS525A PCI Express Card Reader [525a]
|
61
|
+
SVendor: Lenovo [17aa]
|
62
|
+
SDevice: RTS525A PCI Express Card Reader [224e]
|
63
|
+
Rev: 01
|
64
|
+
Driver: rtsx_pci
|
65
|
+
Module: rtsx_pci
|
66
66
|
|
67
|
-
Device: 04:00.0
|
68
|
-
Class: Network controller [0280]
|
69
|
-
Vendor: Intel Corporation [8086]
|
70
|
-
Device: Wireless 8265 / 8275 [24fd]
|
71
|
-
SVendor: Intel Corporation [8086]
|
72
|
-
SDevice: Wireless 8265 / 8275 [0130]
|
73
|
-
Rev: 88
|
74
|
-
Driver: iwlwifi
|
75
|
-
Module: iwlwifi
|
67
|
+
Device: 04:00.0
|
68
|
+
Class: Network controller [0280]
|
69
|
+
Vendor: Intel Corporation [8086]
|
70
|
+
Device: Wireless 8265 / 8275 [24fd]
|
71
|
+
SVendor: Intel Corporation [8086]
|
72
|
+
SDevice: Wireless 8265 / 8275 [0130]
|
73
|
+
Rev: 88
|
74
|
+
Driver: iwlwifi
|
75
|
+
Module: iwlwifi
|
76
76
|
|
77
|
-
Device: 05:00.0
|
78
|
-
Class: Non-Volatile memory controller [0108]
|
79
|
-
Vendor: Toshiba America Info Systems [1179]
|
80
|
-
Device: Device [0115]
|
81
|
-
SVendor: Toshiba America Info Systems [1179]
|
82
|
-
SDevice: Device [0001]
|
83
|
-
Rev: 01
|
84
|
-
ProgIf: 02
|
85
|
-
Driver: nvme
|
86
|
-
Module: nvme
|
87
|
-
NUMANode: 0
|
77
|
+
Device: 05:00.0
|
78
|
+
Class: Non-Volatile memory controller [0108]
|
79
|
+
Vendor: Toshiba America Info Systems [1179]
|
80
|
+
Device: Device [0115]
|
81
|
+
SVendor: Toshiba America Info Systems [1179]
|
82
|
+
SDevice: Device [0001]
|
83
|
+
Rev: 01
|
84
|
+
ProgIf: 02
|
85
|
+
Driver: nvme
|
86
|
+
Module: nvme
|
87
|
+
NUMANode: 0
|
88
88
|
LSPCI
|
89
89
|
allow(plugin).to receive(:shell_out).with("lspci -vnnmk").and_return(
|
90
90
|
mock_shell_out(0, @stdout, ""))
|
@@ -20,46 +20,46 @@ require_relative "../../../spec_helper.rb"
|
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux Mdadm Plugin" do
|
22
22
|
before(:each) do
|
23
|
-
@md0 =
|
24
|
-
/dev/md0:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
Working Devices : 6
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
23
|
+
@md0 = <<~MD
|
24
|
+
/dev/md0:
|
25
|
+
Version : 1.2
|
26
|
+
Creation Time : Thu Jan 30 03:11:40 2014
|
27
|
+
Raid Level : raid10
|
28
|
+
Array Size : 2929893888 (2794.16 GiB 3000.21 GB)
|
29
|
+
Used Dev Size : 976631296 (931.39 GiB 1000.07 GB)
|
30
|
+
Raid Devices : 6
|
31
|
+
Total Devices : 6
|
32
|
+
Persistence : Superblock is persistent
|
33
|
+
|
34
|
+
Update Time : Tue May 6 23:30:32 2014
|
35
|
+
State : clean
|
36
|
+
Active Devices : 6
|
37
|
+
Working Devices : 6
|
38
|
+
Failed Devices : 0
|
39
|
+
Spare Devices : 0
|
40
|
+
|
41
|
+
Layout : near=2
|
42
|
+
Chunk Size : 256K
|
43
|
+
|
44
|
+
Name : host.therealtimsmith.com:3 (local to host host.therealtimsmith.com)
|
45
|
+
UUID : 5ed74d5b:70bfe21d:8cd57792:c1e13d65
|
46
|
+
Events : 155
|
47
|
+
|
48
|
+
Number Major Minor RaidDevice State
|
49
|
+
0 8 32 0 active sync /dev/sdc
|
50
|
+
1 8 48 1 active sync /dev/sdd
|
51
|
+
2 8 64 2 active sync /dev/sde
|
52
|
+
3 8 80 3 active sync /dev/sdf
|
53
|
+
4 8 96 4 active sync /dev/sdg
|
54
|
+
5 8 112 5 active sync /dev/sdh
|
55
55
|
MD
|
56
56
|
@plugin = get_plugin("linux/mdadm")
|
57
57
|
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
58
58
|
@double_file = double("/proc/mdstat")
|
59
|
-
allow(@double_file).to receive(:each)
|
60
|
-
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
|
61
|
-
and_yield("md0 : active raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
|
62
|
-
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
59
|
+
allow(@double_file).to receive(:each)
|
60
|
+
.and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
|
61
|
+
.and_yield("md0 : active raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
|
62
|
+
.and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
63
63
|
allow(File).to receive(:open).with("/proc/mdstat").and_return(@double_file)
|
64
64
|
allow(File).to receive(:exist?).with("/proc/mdstat").and_return(true)
|
65
65
|
allow(@plugin).to receive(:shell_out).with("mdadm --detail /dev/md0").and_return(mock_shell_out(0, @md0, ""))
|
@@ -91,7 +91,7 @@ MD
|
|
91
91
|
expect(@plugin[:mdadm][:md0][:version]).to eq(1.2)
|
92
92
|
end
|
93
93
|
|
94
|
-
device_counts = { :
|
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
96
|
it "should detect device count of \"#{item}\"" do
|
97
97
|
@plugin.run
|
@@ -108,10 +108,10 @@ MD
|
|
108
108
|
|
109
109
|
it "should detect member devices even if there are multi-digit numbers" do
|
110
110
|
new_mdstat = double("/proc/mdstat2")
|
111
|
-
allow(new_mdstat).to receive(:each)
|
112
|
-
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
|
113
|
-
and_yield("md0 : active raid10 sdj[2010] sdi[99] sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
|
114
|
-
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
111
|
+
allow(new_mdstat).to receive(:each)
|
112
|
+
.and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
|
113
|
+
.and_yield("md0 : active raid10 sdj[2010] sdi[99] sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
|
114
|
+
.and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
115
115
|
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
116
116
|
|
117
117
|
@plugin.run
|
@@ -122,10 +122,10 @@ MD
|
|
122
122
|
|
123
123
|
it "should detect member devices even if mdstat has extra entries" do
|
124
124
|
new_mdstat = double("/proc/mdstat2")
|
125
|
-
allow(new_mdstat).to receive(:each)
|
126
|
-
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
|
127
|
-
and_yield("md0 : active (somecraphere) <morestuff> raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
|
128
|
-
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
125
|
+
allow(new_mdstat).to receive(:each)
|
126
|
+
.and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
|
127
|
+
.and_yield("md0 : active (somecraphere) <morestuff> raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
|
128
|
+
.and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
129
129
|
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
130
130
|
|
131
131
|
@plugin.run
|
@@ -136,9 +136,9 @@ MD
|
|
136
136
|
|
137
137
|
it "should accurately report inactive arrays" do
|
138
138
|
new_mdstat = double("/proc/mdstat_inactive")
|
139
|
-
allow(new_mdstat).to receive(:each)
|
140
|
-
and_yield("Personalities :")
|
141
|
-
and_yield("md0 : inactive nvme2n1p3[2](S)")
|
139
|
+
allow(new_mdstat).to receive(:each)
|
140
|
+
.and_yield("Personalities :")
|
141
|
+
.and_yield("md0 : inactive nvme2n1p3[2](S)")
|
142
142
|
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
143
143
|
|
144
144
|
@plugin.run
|
@@ -147,9 +147,9 @@ MD
|
|
147
147
|
|
148
148
|
it "should report journal devices" do
|
149
149
|
new_mdstat = double("/proc/mdstat_journal")
|
150
|
-
allow(new_mdstat).to receive(:each)
|
151
|
-
and_yield("Personalies : [raid6]")
|
152
|
-
and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] nvme2n1p3[0](J)")
|
150
|
+
allow(new_mdstat).to receive(:each)
|
151
|
+
.and_yield("Personalies : [raid6]")
|
152
|
+
.and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] nvme2n1p3[0](J)")
|
153
153
|
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
154
154
|
|
155
155
|
@plugin.run
|
@@ -158,9 +158,9 @@ MD
|
|
158
158
|
|
159
159
|
it "should report spare devices" do
|
160
160
|
new_mdstat = double("/proc/mdstat_spare")
|
161
|
-
allow(new_mdstat).to receive(:each)
|
162
|
-
and_yield("Personalies : [raid6]")
|
163
|
-
and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] sdh1[0](S)")
|
161
|
+
allow(new_mdstat).to receive(:each)
|
162
|
+
.and_yield("Personalies : [raid6]")
|
163
|
+
.and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] sdh1[0](S)")
|
164
164
|
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
165
165
|
|
166
166
|
@plugin.run
|
@@ -21,41 +21,41 @@ describe Ohai::System, "Linux memory plugin" 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")
|
24
|
-
allow(@double_file).to receive(:each)
|
25
|
-
and_yield("MemTotal: 131932120 kB")
|
26
|
-
and_yield("MemFree: 2269032 kB")
|
27
|
-
and_yield("MemAvailable: 9208922 kB")
|
28
|
-
and_yield("Buffers: 646368 kB")
|
29
|
-
and_yield("Cached: 32346556 kB")
|
30
|
-
and_yield("SwapCached: 312 kB")
|
31
|
-
and_yield("Active: 98595796 kB")
|
32
|
-
and_yield("Inactive: 18477320 kB")
|
33
|
-
and_yield("HighTotal: 0 kB")
|
34
|
-
and_yield("HighFree: 0 kB")
|
35
|
-
and_yield("LowTotal: 131932120 kB")
|
36
|
-
and_yield("LowFree: 2269032 kB")
|
37
|
-
and_yield("SwapTotal: 16777208 kB")
|
38
|
-
and_yield("SwapFree: 14127356 kB")
|
39
|
-
and_yield("Dirty: 3212 kB")
|
40
|
-
and_yield("Writeback: 0 kB")
|
41
|
-
and_yield("AnonPages: 84082132 kB")
|
42
|
-
and_yield("Mapped: 3445224 kB")
|
43
|
-
and_yield("Slab: 9892096 kB")
|
44
|
-
and_yield("SReclaimable: 362636 kB")
|
45
|
-
and_yield("SUnreclaim: 18860 kB")
|
46
|
-
and_yield("PageTables: 1759332 kB")
|
47
|
-
and_yield("NFS_Unstable: 0 kB")
|
48
|
-
and_yield("Bounce: 0 kB")
|
49
|
-
and_yield("CommitLimit: 148709328 kB")
|
50
|
-
and_yield("Committed_AS: 333717060 kB")
|
51
|
-
and_yield("VmallocTotal: 34359738367 kB")
|
52
|
-
and_yield("VmallocUsed: 276796 kB")
|
53
|
-
and_yield("VmallocChunk: 34359461515 kB")
|
54
|
-
and_yield("HugePages_Total: 11542")
|
55
|
-
and_yield("HugePages_Free: 11235")
|
56
|
-
and_yield("HugePages_Rsvd: 11226")
|
57
|
-
and_yield("HugePages_Surp: 0")
|
58
|
-
and_yield("Hugepagesize: 2048 kB")
|
24
|
+
allow(@double_file).to receive(:each)
|
25
|
+
.and_yield("MemTotal: 131932120 kB")
|
26
|
+
.and_yield("MemFree: 2269032 kB")
|
27
|
+
.and_yield("MemAvailable: 9208922 kB")
|
28
|
+
.and_yield("Buffers: 646368 kB")
|
29
|
+
.and_yield("Cached: 32346556 kB")
|
30
|
+
.and_yield("SwapCached: 312 kB")
|
31
|
+
.and_yield("Active: 98595796 kB")
|
32
|
+
.and_yield("Inactive: 18477320 kB")
|
33
|
+
.and_yield("HighTotal: 0 kB")
|
34
|
+
.and_yield("HighFree: 0 kB")
|
35
|
+
.and_yield("LowTotal: 131932120 kB")
|
36
|
+
.and_yield("LowFree: 2269032 kB")
|
37
|
+
.and_yield("SwapTotal: 16777208 kB")
|
38
|
+
.and_yield("SwapFree: 14127356 kB")
|
39
|
+
.and_yield("Dirty: 3212 kB")
|
40
|
+
.and_yield("Writeback: 0 kB")
|
41
|
+
.and_yield("AnonPages: 84082132 kB")
|
42
|
+
.and_yield("Mapped: 3445224 kB")
|
43
|
+
.and_yield("Slab: 9892096 kB")
|
44
|
+
.and_yield("SReclaimable: 362636 kB")
|
45
|
+
.and_yield("SUnreclaim: 18860 kB")
|
46
|
+
.and_yield("PageTables: 1759332 kB")
|
47
|
+
.and_yield("NFS_Unstable: 0 kB")
|
48
|
+
.and_yield("Bounce: 0 kB")
|
49
|
+
.and_yield("CommitLimit: 148709328 kB")
|
50
|
+
.and_yield("Committed_AS: 333717060 kB")
|
51
|
+
.and_yield("VmallocTotal: 34359738367 kB")
|
52
|
+
.and_yield("VmallocUsed: 276796 kB")
|
53
|
+
.and_yield("VmallocChunk: 34359461515 kB")
|
54
|
+
.and_yield("HugePages_Total: 11542")
|
55
|
+
.and_yield("HugePages_Free: 11235")
|
56
|
+
.and_yield("HugePages_Rsvd: 11226")
|
57
|
+
.and_yield("HugePages_Surp: 0")
|
58
|
+
.and_yield("Hugepagesize: 2048 kB")
|
59
59
|
allow(File).to receive(:open).with("/proc/meminfo").and_return(@double_file)
|
60
60
|
end
|
61
61
|
|