ohai 15.2.5 → 15.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/mixin/dmi_decode.rb +4 -1
- data/lib/ohai/plugins/linux/sysctl.rb +38 -0
- data/lib/ohai/plugins/linux/virtualization.rb +11 -10
- data/lib/ohai/plugins/openstack.rb +8 -3
- data/lib/ohai/plugins/passwd.rb +4 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/functional/application_spec.rb +5 -5
- data/spec/functional/loader_spec.rb +2 -2
- data/spec/functional/plugins/powershell_spec.rb +11 -5
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +3 -3
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +8 -8
- data/spec/support/integration_helper.rb +3 -3
- data/spec/unit/application_spec.rb +5 -5
- data/spec/unit/dsl/plugin_spec.rb +8 -7
- data/spec/unit/mixin/command_spec.rb +2 -2
- data/spec/unit/mixin/dmi_decode.rb +8 -1
- data/spec/unit/plugins/abort_spec.rb +4 -4
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/aix/hostname_spec.rb +2 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +5 -5
- data/spec/unit/plugins/aix/network_spec.rb +4 -1
- data/spec/unit/plugins/aix/platform_spec.rb +4 -4
- data/spec/unit/plugins/aix/uptime_spec.rb +3 -3
- data/spec/unit/plugins/aix/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/azure_spec.rb +8 -8
- data/spec/unit/plugins/bsd/filesystem_spec.rb +17 -16
- data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/c_spec.rb +6 -5
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +4 -4
- data/spec/unit/plugins/darwin/cpu_spec.rb +11 -11
- data/spec/unit/plugins/darwin/filesystem_spec.rb +14 -13
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -1
- data/spec/unit/plugins/darwin/hostname_spec.rb +3 -3
- data/spec/unit/plugins/darwin/kernel_spec.rb +5 -5
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +3 -3
- data/spec/unit/plugins/darwin/platform_spec.rb +9 -9
- data/spec/unit/plugins/darwin/virtualization_spec.rb +10 -10
- data/spec/unit/plugins/digital_ocean_spec.rb +14 -12
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/docker_spec.rb +2 -2
- data/spec/unit/plugins/ec2_spec.rb +41 -30
- data/spec/unit/plugins/elixir_spec.rb +2 -2
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +17 -13
- data/spec/unit/plugins/fail_spec.rb +15 -15
- data/spec/unit/plugins/freebsd/cpu_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/platform_spec.rb +3 -3
- data/spec/unit/plugins/gce_spec.rb +9 -7
- data/spec/unit/plugins/go_spec.rb +2 -2
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +10 -10
- data/spec/unit/plugins/hostname_spec.rb +15 -14
- data/spec/unit/plugins/init_package_spec.rb +4 -4
- data/spec/unit/plugins/java_spec.rb +7 -3
- data/spec/unit/plugins/joyent_spec.rb +4 -4
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +2 -2
- data/spec/unit/plugins/linux/cpu_spec.rb +9 -8
- data/spec/unit/plugins/linux/filesystem_spec.rb +36 -35
- data/spec/unit/plugins/linux/fips_spec.rb +7 -5
- data/spec/unit/plugins/linux/hostname_spec.rb +4 -4
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +3 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
- data/spec/unit/plugins/linux/lspci_spec.rb +2 -1
- data/spec/unit/plugins/linux/machineid_spec.rb +3 -3
- data/spec/unit/plugins/linux/mdadm_spec.rb +13 -13
- data/spec/unit/plugins/linux/memory_spec.rb +39 -39
- data/spec/unit/plugins/linux/network_spec.rb +20 -19
- data/spec/unit/plugins/linux/platform_spec.rb +60 -57
- data/spec/unit/plugins/linux/sessions_spec.rb +3 -3
- data/spec/unit/plugins/linux/sysctl_spec.rb +53 -0
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +3 -3
- data/spec/unit/plugins/linux/uptime_spec.rb +5 -5
- data/spec/unit/plugins/linux/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/lua_spec.rb +1 -1
- data/spec/unit/plugins/mono_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/hostname_spec.rb +3 -3
- data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +3 -3
- data/spec/unit/plugins/network_spec.rb +3 -3
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +2 -2
- data/spec/unit/plugins/ohai_time_spec.rb +4 -4
- data/spec/unit/plugins/openbsd/hostname_spec.rb +3 -3
- data/spec/unit/plugins/openbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +2 -2
- data/spec/unit/plugins/openstack_spec.rb +13 -8
- data/spec/unit/plugins/os_spec.rb +12 -12
- data/spec/unit/plugins/packages_spec.rb +10 -7
- data/spec/unit/plugins/passwd_spec.rb +18 -19
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +1 -1
- data/spec/unit/plugins/platform_spec.rb +7 -7
- data/spec/unit/plugins/powershell_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +25 -20
- data/spec/unit/plugins/root_group_spec.rb +14 -10
- data/spec/unit/plugins/ruby_spec.rb +2 -2
- data/spec/unit/plugins/rust_spec.rb +3 -3
- data/spec/unit/plugins/scala_spec.rb +2 -2
- data/spec/unit/plugins/scaleway_spec.rb +14 -12
- data/spec/unit/plugins/scsi_spec.rb +2 -1
- data/spec/unit/plugins/shard_spec.rb +18 -16
- data/spec/unit/plugins/solaris2/cpu_spec.rb +29 -29
- data/spec/unit/plugins/solaris2/dmi_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/filesystem.rb +3 -3
- data/spec/unit/plugins/solaris2/hostname_spec.rb +2 -2
- data/spec/unit/plugins/solaris2/kernel_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/memory_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/platform_spec.rb +9 -9
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +4 -1
- data/spec/unit/plugins/sysconf_spec.rb +2 -2
- data/spec/unit/plugins/timezone_spec.rb +2 -2
- data/spec/unit/plugins/virtualbox_spec.rb +10 -10
- data/spec/unit/plugins/vmware_spec.rb +4 -4
- data/spec/unit/plugins/windows/cpu_spec.rb +13 -13
- data/spec/unit/plugins/windows/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/windows/fips_spec.rb +7 -5
- data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +4 -4
- data/spec/unit/plugins/windows/network_spec.rb +1 -1
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +2 -2
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/zpools_spec.rb +2 -0
- data/spec/unit/provides_map_spec.rb +18 -18
- data/spec/unit/runner_spec.rb +29 -29
- data/spec/unit/system_spec.rb +13 -13
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +6 -6
- metadata +4 -2
@@ -34,7 +34,7 @@ describe Ohai::System, "plugin scala" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
context "if scala is installed" do
|
37
|
-
before
|
37
|
+
before do
|
38
38
|
setup_plugin
|
39
39
|
plugin.run
|
40
40
|
end
|
@@ -45,7 +45,7 @@ describe Ohai::System, "plugin scala" do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
context "if scala is not installed" do
|
48
|
-
before
|
48
|
+
before do
|
49
49
|
allow(plugin).to receive(:shell_out)
|
50
50
|
.and_raise( Ohai::Exceptions::Exec )
|
51
51
|
plugin.run
|
@@ -20,13 +20,13 @@ require "spec_helper"
|
|
20
20
|
describe Ohai::System, "plugin scaleway" do
|
21
21
|
let(:plugin) { get_plugin("scaleway") }
|
22
22
|
|
23
|
-
before
|
23
|
+
before do
|
24
24
|
allow(plugin).to receive(:hint?).with("scaleway").and_return(false)
|
25
25
|
allow(File).to receive(:read).with("/proc/cmdline").and_return(false)
|
26
26
|
end
|
27
27
|
|
28
28
|
shared_examples_for "!scaleway" do
|
29
|
-
it "
|
29
|
+
it "does not attempt to fetch the scaleway metadata" do
|
30
30
|
expect(plugin).not_to receive(:http_client)
|
31
31
|
expect(plugin[:scaleway]).to be_nil
|
32
32
|
plugin.run
|
@@ -34,7 +34,7 @@ describe Ohai::System, "plugin scaleway" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
shared_examples_for "scaleway" do
|
37
|
-
before
|
37
|
+
before do
|
38
38
|
@http_client = double("Net::HTTP client")
|
39
39
|
allow(plugin).to receive(:http_client).and_return(@http_client)
|
40
40
|
allow(IO).to receive(:select).and_return([[], [1], []])
|
@@ -48,7 +48,7 @@ describe Ohai::System, "plugin scaleway" do
|
|
48
48
|
'{"tags": [], "state_detail": "booted", "public_ip": {"dynamic": false, "id": "7564c721-a128-444e-9c95-0754a7616482", "address": "5.1.9.3"}, "ssh_public_keys": [{"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA5qK2s41yyrNpaXXiQtb/1ADaVHVZZp9rYEtG6Dz7trOPtxkxNsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/j2C+NAzo6TZCLTbJjBf89ieazqVqhY/dMNLDJINY2Ss2ytgyiJm9bp5bYcZz441czijBlmY/qmI0cFCVOJoDq6X9Lmn/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee+hmLFaTE3FeMr1hmeZT2ChH6ruHi8m6m18SfW0fl2fS8zG4yB+WE2IawdsoZmtgtY/Re3CpvhYP9S/JxpUedl+zzzzzzzzzzzzzzzzz5+YONBAt/PWMelXThfMukbwykto6IXmsX2qflBPsRVrWe0D7vt48loVScHDv5D05ZwqWY9rizFqCx3Y8xCLr6649ieonnnjHEsSOBREU507eXVJL6njHard+s+vuTC4bNH5LiP2INQS+9MaT37/l8WzIAL3U+hvcj95HS8KfATX+7XWa54bGJgeOnPle8ojwp1ssl7ddh2yFJozgk2CkUEyE4f1lmEX2YFJGoEoaW0QC2j0nNYiLs37yHG0h84AOgjoIAJo1rxpBAGGJOgFTkgnSdHjtDZsC9WjJYeu/QpxQ7Lf2Z+FCKoypfnZz/F10/z6nxnkZ3IKKM=", "fingerprint": "4096 4c:71:db:64:cd:24:da:4a:fa:5f:9e:70:af:ea:40:6e (no comment) (RSA)"}], "private_ip": "10.8.23.7", "timezone": "UTC", "id": "77fab916-e7ff-44c6-a025-ae08837b4c4f", "extra_networks": [], "name": "sample-hostname", "hostname": "sample-hostname", "bootscript": {"kernel": "http://169.254.42.24/kernel/x86_64-4.9.20-std-1/vmlinuz-4.9.20-std-1", "title": "x86_64 4.9.20 std #1 (longterm/latest)", "default": false, "dtb": "", "public": false, "initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.12.7.gz", "bootcmdargs": "LINUX_COMMON scaleway boot=local", "architecture": "x86_64", "organization": "11111110-1112-4112-8112-111111111116", "id": "855f21ba-e7f9-421d-91b0-976a6ad59910"}, "location": {"platform_id": "21", "hypervisor_id": "518", "node_id": "4", "cluster_id": "82", "zone_id": "par1"}, "volumes": {"0": {"name": "x86_64-debian-stretch-2017-06-29_10:17", "modification_date": "2018-01-26T10:22:28.268074+00:00", "export_uri": "device://dev/vda", "volume_type": "l_ssd", "creation_date": "2018-01-26T10:22:28.268074+00:00", "organization": "90f39224-d0a2-4771-a2f0-1036a9402b97", "server": {"id": "77fab916-e7ff-44c6-a024-ae08837b4c4f", "name": "sample-hostname"}, "id": "3be53d4d-93d7-4430-a513-61cb4410624b", "size": 50000000000}}, "ipv6": null, "organization": "89f39224-d0a2-4771-a2f0-1036a9402b97", "commercial_type": "VC1S"}'
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "fetches and properly parse json metadata" do
|
52
52
|
expect(@http_client).to receive(:get)
|
53
53
|
.with("/conf?format=json")
|
54
54
|
.and_return(double("Net::HTTP Response", body: body, code: "200"))
|
@@ -59,7 +59,7 @@ describe Ohai::System, "plugin scaleway" do
|
|
59
59
|
expect(plugin[:scaleway]["hostname"]).to eq("sample-hostname")
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
62
|
+
it "completes the run despite unavailable metadata" do
|
63
63
|
expect(@http_client).to receive(:get)
|
64
64
|
.with("/conf?format=json")
|
65
65
|
.and_return(double("Net::HTTP Response", body: "", code: "404"))
|
@@ -70,22 +70,24 @@ describe Ohai::System, "plugin scaleway" do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
describe "without hint or cmdline" do
|
73
|
-
|
73
|
+
it_behaves_like "!scaleway"
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "with scaleway hint file" do
|
77
|
-
|
78
|
-
|
79
|
-
before(:each) do
|
77
|
+
before do
|
80
78
|
allow(plugin).to receive(:hint?).with("scaleway").and_return(true)
|
81
79
|
end
|
80
|
+
|
81
|
+
it_behaves_like "scaleway"
|
82
|
+
|
82
83
|
end
|
83
84
|
|
84
85
|
describe "with scaleway cmdline" do
|
85
|
-
|
86
|
-
|
87
|
-
before(:each) do
|
86
|
+
before do
|
88
87
|
allow(File).to receive(:read).with("/proc/cmdline").and_return("initrd=initrd showopts console=ttyS0,115200 nousb vga=0 root=/dev/vda scaleway boot=local")
|
89
88
|
end
|
89
|
+
|
90
|
+
it_behaves_like "scaleway"
|
91
|
+
|
90
92
|
end
|
91
93
|
end
|
@@ -20,7 +20,8 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Ohai::System, "lsscsi plugin" do
|
22
22
|
let(:plugin) { get_plugin("scsi") }
|
23
|
-
|
23
|
+
|
24
|
+
before do
|
24
25
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
25
26
|
@stdout = <<~LSSCSI
|
26
27
|
[5:0:0:0] disk ATA Hitachi HUA72205 A3EA /dev/sda
|
@@ -20,6 +20,11 @@ require "digest/md5"
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Ohai::System, "shard plugin" do
|
23
|
+
subject do
|
24
|
+
plugin.run
|
25
|
+
plugin[:shard_seed]
|
26
|
+
end
|
27
|
+
|
23
28
|
let(:plugin) { get_plugin("shard") }
|
24
29
|
let(:fqdn) { "somehost004.someregion.somecompany.com" }
|
25
30
|
let(:uuid) { "48555CF4-5BB1-21D9-BC4C-E8B73DDE5801" }
|
@@ -29,12 +34,7 @@ describe Ohai::System, "shard plugin" do
|
|
29
34
|
let(:fips) { false }
|
30
35
|
let(:os) { "linux" }
|
31
36
|
|
32
|
-
|
33
|
-
plugin.run
|
34
|
-
plugin[:shard_seed]
|
35
|
-
end
|
36
|
-
|
37
|
-
before(:each) do
|
37
|
+
before do
|
38
38
|
plugin["machinename"] = machinename
|
39
39
|
plugin["machine_id"] = machine_id
|
40
40
|
plugin["fqdn"] = fqdn
|
@@ -45,11 +45,11 @@ describe Ohai::System, "shard plugin" do
|
|
45
45
|
allow(plugin).to receive(:collect_os).and_return(os)
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "provides a shard with a default-safe set of sources" do
|
49
49
|
expect(subject).to eq(27767217)
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "provides a shard with a configured source" do
|
53
53
|
Ohai.config[:plugin][:shard_seed][:sources] = [:fqdn]
|
54
54
|
expect(subject).to eq(203669792)
|
55
55
|
end
|
@@ -59,26 +59,28 @@ describe Ohai::System, "shard plugin" do
|
|
59
59
|
expect { subject }.to raise_error(RuntimeError)
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
62
|
+
it "provides a shard with a configured algorithm" do
|
63
63
|
Ohai.config[:plugin][:shard_seed][:digest_algorithm] = "sha256"
|
64
|
-
expect(Digest::MD5).
|
64
|
+
expect(Digest::MD5).not_to receive(:new)
|
65
65
|
expect(subject).to eq(117055036)
|
66
66
|
end
|
67
67
|
|
68
68
|
context "with Darwin OS" do
|
69
69
|
let(:os) { "darwin" }
|
70
|
+
|
70
71
|
before do
|
71
72
|
plugin.data.delete("fips") # FIPS is undefined on Macs, make sure this still work
|
72
73
|
plugin["hardware"] = { "serial_number" => serial, "platform_UUID" => uuid }
|
73
74
|
end
|
74
75
|
|
75
|
-
it "
|
76
|
+
it "provides a shard with a default-safe set of sources" do
|
76
77
|
expect(subject).to eq(27767217)
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
81
|
context "with Windows OS" do
|
81
82
|
let(:os) { "windows" }
|
83
|
+
|
82
84
|
before do
|
83
85
|
wmi = double("WmiLite::Wmi")
|
84
86
|
allow(WmiLite::Wmi).to receive(:new).and_return(wmi)
|
@@ -88,11 +90,11 @@ describe Ohai::System, "shard plugin" do
|
|
88
90
|
plugin.data.delete("dmi") # To make sure we aren't using the wrong data.
|
89
91
|
end
|
90
92
|
|
91
|
-
it "
|
93
|
+
it "provides a shard with a default-safe set of sources" do
|
92
94
|
expect(subject).to eq(27767217)
|
93
95
|
end
|
94
96
|
|
95
|
-
it "
|
97
|
+
it "allows os_serial source" do
|
96
98
|
Ohai.config[:plugin][:shard_seed][:sources] = %i{machinename os_serial uuid}
|
97
99
|
# Different from above.
|
98
100
|
expect(subject).to eq(178738102)
|
@@ -102,7 +104,7 @@ describe Ohai::System, "shard plugin" do
|
|
102
104
|
context "with a weird OS" do
|
103
105
|
let(:os) { "aix" }
|
104
106
|
|
105
|
-
it "
|
107
|
+
it "provides a shard with a default-safe set of sources" do
|
106
108
|
# Note: this is different than the other defaults.
|
107
109
|
expect(subject).to eq(253499154)
|
108
110
|
end
|
@@ -111,8 +113,8 @@ describe Ohai::System, "shard plugin" do
|
|
111
113
|
context "with FIPS mode enabled" do
|
112
114
|
let(:fips) { true }
|
113
115
|
|
114
|
-
it "
|
115
|
-
expect(Digest::MD5).
|
116
|
+
it "uses SHA2" do
|
117
|
+
expect(Digest::MD5).not_to receive(:hexdigest)
|
116
118
|
expect(subject).to eq(117055036)
|
117
119
|
end
|
118
120
|
end
|
@@ -17,13 +17,13 @@
|
|
17
17
|
require "spec_helper"
|
18
18
|
|
19
19
|
describe Ohai::System, "Solaris2.X cpu plugin" do
|
20
|
-
before
|
20
|
+
before do
|
21
21
|
@plugin = get_plugin("cpu")
|
22
22
|
allow(@plugin).to receive(:collect_os).and_return("solaris2")
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "on x86 processors" do
|
26
|
-
before
|
26
|
+
before do
|
27
27
|
kstatinfo_output = <<~END
|
28
28
|
cpu_info:0:cpu_info0:brand Crazy(r) Argon(r) CPU Y5570 @ 1.93GHz
|
29
29
|
cpu_info:0:cpu_info0:cache_id 1
|
@@ -446,28 +446,28 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
446
446
|
@plugin.run
|
447
447
|
end
|
448
448
|
|
449
|
-
it "
|
449
|
+
it "gets the total virtual processor count" do
|
450
450
|
expect(@plugin["cpu"]["total"]).to eql(16)
|
451
451
|
end
|
452
452
|
|
453
|
-
it "
|
453
|
+
it "gets the total processor count" do
|
454
454
|
expect(@plugin["cpu"]["real"]).to eql(2)
|
455
455
|
end
|
456
456
|
|
457
|
-
it "
|
457
|
+
it "gets the number of threads per core" do
|
458
458
|
expect(@plugin["cpu"]["corethreads"]).to eql(2)
|
459
459
|
end
|
460
460
|
|
461
|
-
it "
|
461
|
+
it "gets the total number of online cores" do
|
462
462
|
expect(@plugin["cpu"]["cpustates"]["on-line"]).to eql(8)
|
463
463
|
end
|
464
464
|
|
465
|
-
it "
|
465
|
+
it "gets the total number of offline cores" do
|
466
466
|
expect(@plugin["cpu"]["cpustates"]["off-line"]).to eql(8)
|
467
467
|
end
|
468
468
|
|
469
469
|
describe "per-cpu information" do
|
470
|
-
it "
|
470
|
+
it "includes processor vendor_ids" do
|
471
471
|
# CPU Socket 0
|
472
472
|
expect(@plugin["cpu"]["15"]["vendor_id"]).to eql("GenuineIntel")
|
473
473
|
expect(@plugin["cpu"]["13"]["vendor_id"]).to eql("GenuineIntel")
|
@@ -488,7 +488,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
488
488
|
expect(@plugin["cpu"]["0"]["vendor_id"]).to eql("CrazyTown")
|
489
489
|
end
|
490
490
|
|
491
|
-
it "
|
491
|
+
it "includes processor families" do
|
492
492
|
expect(@plugin["cpu"]["15"]["family"]).to eql("6")
|
493
493
|
expect(@plugin["cpu"]["13"]["family"]).to eql("6")
|
494
494
|
expect(@plugin["cpu"]["11"]["family"]).to eql("6")
|
@@ -508,7 +508,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
508
508
|
expect(@plugin["cpu"]["0"]["family"]).to eql("12")
|
509
509
|
end
|
510
510
|
|
511
|
-
it "
|
511
|
+
it "includes processor models" do
|
512
512
|
expect(@plugin["cpu"]["15"]["model"]).to eql("26")
|
513
513
|
expect(@plugin["cpu"]["13"]["model"]).to eql("26")
|
514
514
|
expect(@plugin["cpu"]["11"]["model"]).to eql("26")
|
@@ -528,7 +528,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
528
528
|
expect(@plugin["cpu"]["0"]["model"]).to eql("93")
|
529
529
|
end
|
530
530
|
|
531
|
-
it "
|
531
|
+
it "includs processor architecture" do
|
532
532
|
expect(@plugin["cpu"]["15"]["arch"]).to eql("i386")
|
533
533
|
expect(@plugin["cpu"]["13"]["arch"]).to eql("i386")
|
534
534
|
expect(@plugin["cpu"]["11"]["arch"]).to eql("i386")
|
@@ -548,7 +548,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
548
548
|
expect(@plugin["cpu"]["0"]["arch"]).to eql("i386")
|
549
549
|
end
|
550
550
|
|
551
|
-
it "
|
551
|
+
it "includes processor stepping" do
|
552
552
|
expect(@plugin["cpu"]["15"]["stepping"]).to eql("5")
|
553
553
|
expect(@plugin["cpu"]["13"]["stepping"]).to eql("5")
|
554
554
|
expect(@plugin["cpu"]["11"]["stepping"]).to eql("5")
|
@@ -569,7 +569,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
569
569
|
|
570
570
|
end
|
571
571
|
|
572
|
-
it "
|
572
|
+
it "includes processor model names" do
|
573
573
|
expect(@plugin["cpu"]["15"]["model_name"]).to eql("Intel(r) Xeon(r) CPU X5570 @ 2.93GHz")
|
574
574
|
expect(@plugin["cpu"]["13"]["model_name"]).to eql("Intel(r) Xeon(r) CPU X5570 @ 2.93GHz")
|
575
575
|
expect(@plugin["cpu"]["11"]["model_name"]).to eql("Intel(r) Xeon(r) CPU X5570 @ 2.93GHz")
|
@@ -588,7 +588,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
588
588
|
expect(@plugin["cpu"]["0"]["model_name"]).to eql("Crazy(r) Argon(r) CPU Y5570 @ 1.93GHz")
|
589
589
|
end
|
590
590
|
|
591
|
-
it "
|
591
|
+
it "includes processor speed in MHz" do
|
592
592
|
expect(@plugin["cpu"]["15"]["mhz"]).to eql("2926")
|
593
593
|
expect(@plugin["cpu"]["13"]["mhz"]).to eql("2926")
|
594
594
|
expect(@plugin["cpu"]["11"]["mhz"]).to eql("2926")
|
@@ -607,7 +607,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
607
607
|
expect(@plugin["cpu"]["0"]["mhz"]).to eql("1933")
|
608
608
|
end
|
609
609
|
|
610
|
-
it "
|
610
|
+
it "includes processor state" do
|
611
611
|
expect(@plugin["cpu"]["15"]["state"]).to eql("on-line")
|
612
612
|
expect(@plugin["cpu"]["13"]["state"]).to eql("on-line")
|
613
613
|
expect(@plugin["cpu"]["11"]["state"]).to eql("on-line")
|
@@ -629,7 +629,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
629
629
|
end
|
630
630
|
|
631
631
|
describe "on sparc processors" do
|
632
|
-
before
|
632
|
+
before do
|
633
633
|
kstatinfo_output = <<~END
|
634
634
|
cpu_info:0:cpu_info0:brand SPARC-T3
|
635
635
|
cpu_info:0:cpu_info0:chip_id 0
|
@@ -2812,32 +2812,32 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2812
2812
|
@plugin.run
|
2813
2813
|
end
|
2814
2814
|
|
2815
|
-
it "
|
2815
|
+
it "gets the total virtual processor count" do
|
2816
2816
|
expect(@plugin["cpu"]["total"]).to eql(128)
|
2817
2817
|
end
|
2818
2818
|
|
2819
|
-
it "
|
2819
|
+
it "gets the total processor count" do
|
2820
2820
|
expect(@plugin["cpu"]["real"]).to eql(1)
|
2821
2821
|
end
|
2822
2822
|
|
2823
|
-
it "
|
2823
|
+
it "gets the total core count" do
|
2824
2824
|
expect(@plugin["cpu"]["cores"]).to eql(16)
|
2825
2825
|
end
|
2826
2826
|
|
2827
|
-
it "
|
2827
|
+
it "gets the number of threads per core" do
|
2828
2828
|
expect(@plugin["cpu"]["corethreads"]).to eql(8)
|
2829
2829
|
end
|
2830
2830
|
|
2831
|
-
it "
|
2831
|
+
it "gets the total number of online cores" do
|
2832
2832
|
expect(@plugin["cpu"]["cpustates"]["on-line"]).to eql(124)
|
2833
2833
|
end
|
2834
2834
|
|
2835
|
-
it "
|
2835
|
+
it "gets the total number of offline cores" do
|
2836
2836
|
expect(@plugin["cpu"]["cpustates"]["off-line"]).to eql(4)
|
2837
2837
|
end
|
2838
2838
|
|
2839
2839
|
describe "per-cpu information" do
|
2840
|
-
it "
|
2840
|
+
it "includes processor model names" do
|
2841
2841
|
expect(@plugin["cpu"]["0"]["model_name"]).to eql("SPARC-T3")
|
2842
2842
|
expect(@plugin["cpu"]["1"]["model_name"]).to eql("SPARC-T3")
|
2843
2843
|
expect(@plugin["cpu"]["2"]["model_name"]).to eql("SPARC-T3")
|
@@ -2848,7 +2848,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2848
2848
|
expect(@plugin["cpu"]["127"]["model_name"]).to eql("SPARC-T4")
|
2849
2849
|
end
|
2850
2850
|
|
2851
|
-
it "
|
2851
|
+
it "includes processor sockets" do
|
2852
2852
|
expect(@plugin["cpu"]["0"]["socket"]).to eql("0")
|
2853
2853
|
expect(@plugin["cpu"]["1"]["socket"]).to eql("0")
|
2854
2854
|
expect(@plugin["cpu"]["2"]["socket"]).to eql("0")
|
@@ -2859,7 +2859,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2859
2859
|
expect(@plugin["cpu"]["127"]["socket"]).to eql("0")
|
2860
2860
|
end
|
2861
2861
|
|
2862
|
-
it "
|
2862
|
+
it "includes processor MHz" do
|
2863
2863
|
expect(@plugin["cpu"]["0"]["mhz"]).to eql("1649")
|
2864
2864
|
expect(@plugin["cpu"]["1"]["mhz"]).to eql("1649")
|
2865
2865
|
expect(@plugin["cpu"]["2"]["mhz"]).to eql("1649")
|
@@ -2870,7 +2870,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2870
2870
|
expect(@plugin["cpu"]["127"]["mhz"]).to eql("1649")
|
2871
2871
|
end
|
2872
2872
|
|
2873
|
-
it "
|
2873
|
+
it "includes processor core IDs" do
|
2874
2874
|
expect(@plugin["cpu"]["0"]["core_id"]).to eql("1026")
|
2875
2875
|
expect(@plugin["cpu"]["8"]["core_id"]).to eql("1033")
|
2876
2876
|
expect(@plugin["cpu"]["16"]["core_id"]).to eql("1040")
|
@@ -2889,7 +2889,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2889
2889
|
expect(@plugin["cpu"]["120"]["core_id"]).to eql("1131")
|
2890
2890
|
end
|
2891
2891
|
|
2892
|
-
it "
|
2892
|
+
it "includes processor architecture" do
|
2893
2893
|
expect(@plugin["cpu"]["0"]["arch"]).to eql("sparcv9")
|
2894
2894
|
expect(@plugin["cpu"]["1"]["arch"]).to eql("sparcv9")
|
2895
2895
|
expect(@plugin["cpu"]["2"]["arch"]).to eql("sparcv9")
|
@@ -2900,7 +2900,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2900
2900
|
expect(@plugin["cpu"]["127"]["arch"]).to eql("sparcv9")
|
2901
2901
|
end
|
2902
2902
|
|
2903
|
-
it "
|
2903
|
+
it "includes processor FPU type" do
|
2904
2904
|
expect(@plugin["cpu"]["0"]["fpu_type"]).to eql("sparcv9")
|
2905
2905
|
expect(@plugin["cpu"]["1"]["fpu_type"]).to eql("sparcv9")
|
2906
2906
|
expect(@plugin["cpu"]["2"]["fpu_type"]).to eql("sparcv9")
|
@@ -2911,7 +2911,7 @@ describe Ohai::System, "Solaris2.X cpu plugin" do
|
|
2911
2911
|
expect(@plugin["cpu"]["127"]["fpu_type"]).to eql("sparcv9")
|
2912
2912
|
end
|
2913
2913
|
|
2914
|
-
it "
|
2914
|
+
it "includes processor state" do
|
2915
2915
|
expect(@plugin["cpu"]["0"]["state"]).to eql("on-line")
|
2916
2916
|
expect(@plugin["cpu"]["1"]["state"]).to eql("on-line")
|
2917
2917
|
expect(@plugin["cpu"]["2"]["state"]).to eql("on-line")
|
@@ -112,14 +112,14 @@ SOLARIS_DMI_OUT = <<~EOS.freeze
|
|
112
112
|
EOS
|
113
113
|
|
114
114
|
describe Ohai::System, "Solaris2.X DMI plugin" do
|
115
|
-
before
|
115
|
+
before do
|
116
116
|
@plugin = get_plugin("solaris2/dmi")
|
117
117
|
allow(@plugin).to receive(:collect_os).and_return("solaris2")
|
118
118
|
@stdout = SOLARIS_DMI_OUT
|
119
119
|
allow(@plugin).to receive(:shell_out).with("smbios").and_return(mock_shell_out(0, @stdout, ""))
|
120
120
|
end
|
121
121
|
|
122
|
-
it "
|
122
|
+
it "runs smbios" do
|
123
123
|
expect(@plugin).to receive(:shell_out).with("smbios").and_return(mock_shell_out(0, @stdout, ""))
|
124
124
|
@plugin.run
|
125
125
|
end
|
@@ -139,14 +139,14 @@ describe Ohai::System, "Solaris2.X DMI plugin" do
|
|
139
139
|
},
|
140
140
|
}.each do |id, data|
|
141
141
|
data.each do |attribute, value|
|
142
|
-
it "
|
142
|
+
it "has [:dmi][:#{id}][:#{attribute}] set" do
|
143
143
|
@plugin.run
|
144
144
|
expect(@plugin[:dmi][id][attribute]).to eql(value)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
it "
|
149
|
+
it "ignores unwanted types" do
|
150
150
|
@plugin.run
|
151
151
|
expect(@plugin[:dmi]).not_to have_key(:on_board_devices)
|
152
152
|
end
|
@@ -20,14 +20,14 @@ require_relative "spec_helper"
|
|
20
20
|
describe Ohai::System, "Solaris2.X filesystem plugin" do
|
21
21
|
let(:plugin) { get_plugin("filesystem") }
|
22
22
|
|
23
|
-
before
|
23
|
+
before do
|
24
24
|
allow(plugin).to receive(:collect_os).and_return("solaris2")
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "filesystem properties" do
|
28
28
|
let(:plugin_config) { {} }
|
29
29
|
|
30
|
-
before
|
30
|
+
before do
|
31
31
|
@original_plugin_config = Ohai.config[:plugin]
|
32
32
|
Ohai.config[:plugin] = plugin_config
|
33
33
|
allow(plugin).to receive(:shell_out).with("df -Pka").and_return(mock_shell_out(0, "", ""))
|
@@ -326,7 +326,7 @@ describe Ohai::System, "Solaris2.X filesystem plugin" do
|
|
326
326
|
ZFS_GET
|
327
327
|
end
|
328
328
|
|
329
|
-
after
|
329
|
+
after do
|
330
330
|
Ohai.config[:plugin] = @original_plugin_config
|
331
331
|
end
|
332
332
|
|