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
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris2.X hostname plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("hostname")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:solaris2)
|
25
25
|
allow(@plugin).to receive(:resolve_fqdn).and_return("kitteh.inurfridge.eatinurfoodz")
|
@@ -29,7 +29,7 @@ describe Ohai::System, "Solaris2.X hostname plugin" do
|
|
29
29
|
|
30
30
|
it_should_check_from("solaris2::hostname", "hostname", "hostname", "kitteh")
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "gets the fqdn value from #resolve_fqdn" do
|
33
33
|
@plugin.run
|
34
34
|
expect(@plugin["fqdn"]).to eq("kitteh.inurfridge.eatinurfoodz")
|
35
35
|
end
|
@@ -133,7 +133,7 @@ describe Ohai::System, "Solaris2.X kernel plugin" do
|
|
133
133
|
146 121719e 28c - 1 RT_DPTBL (realtime dispatch table)
|
134
134
|
TOOMUCH
|
135
135
|
|
136
|
-
before
|
136
|
+
before do
|
137
137
|
@plugin = get_plugin("kernel")
|
138
138
|
allow(@plugin).to receive(:collect_os).and_return(:solaris2)
|
139
139
|
allow(@plugin).to receive(:init_kernel).and_return({})
|
@@ -143,21 +143,21 @@ describe Ohai::System, "Solaris2.X kernel plugin" do
|
|
143
143
|
allow(File).to receive(:open).with("/etc/release").and_yield(@release)
|
144
144
|
end
|
145
145
|
|
146
|
-
it "
|
146
|
+
it "gives the Solaris update version information" do
|
147
147
|
@release = StringIO.new(" Solaris 10 10/08 s10s_u6wos_07b SPARC\n Use is subject to license terms.\n Assembled 27 October 2008")
|
148
148
|
allow(File).to receive(:open).with("/etc/release").and_yield(@release)
|
149
149
|
@plugin.run
|
150
150
|
expect(@plugin[:kernel][:update]).to eq("10 10/08 s10s_u6wos_07")
|
151
151
|
end
|
152
152
|
|
153
|
-
it "
|
153
|
+
it "gives the Oracle Solaris update version information" do
|
154
154
|
@release = StringIO.new(" Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC\n Assembled 17 January 2013")
|
155
155
|
allow(File).to receive(:open).with("/etc/release").and_yield(@release)
|
156
156
|
@plugin.run
|
157
157
|
expect(@plugin[:kernel][:update]).to eq("10 1/13 s10s_u11wos_24")
|
158
158
|
end
|
159
159
|
|
160
|
-
it "
|
160
|
+
it "gives the Solaris 11 update version information" do
|
161
161
|
@release = StringIO.new(" Oracle Solaris 11.3 SPARC\n Assembled 25 July 2016")
|
162
162
|
allow(File).to receive(:open).with("/etc/release").and_yield(@release)
|
163
163
|
@plugin.run
|
@@ -17,7 +17,7 @@
|
|
17
17
|
require "spec_helper"
|
18
18
|
|
19
19
|
describe Ohai::System, "Solaris2.X memory plugin" do
|
20
|
-
before
|
20
|
+
before do
|
21
21
|
@plugin = get_plugin("solaris2/memory")
|
22
22
|
allow(@plugin).to receive(:collect_os).and_return("solaris2")
|
23
23
|
allow(@plugin).to receive(:shell_out).with("prtconf | grep Memory").and_return(mock_shell_out(0, "Memory size: 8194 Megabytes\n", ""))
|
@@ -25,17 +25,17 @@ describe Ohai::System, "Solaris2.X memory plugin" do
|
|
25
25
|
allow(@plugin).to receive(:shell_out).with("swap -s").and_return(mock_shell_out(0, @swap_s, ""))
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "gets the total memory" do
|
29
29
|
@plugin.run
|
30
30
|
expect(@plugin[:memory][:total]).to eql("#{8194 * 1024}kB")
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "gets total swap" do
|
34
34
|
@plugin.run
|
35
35
|
expect(@plugin[:memory][:swap][:total]).to eql("#{(470096232 + 47057688)}kB" )
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
38
|
+
it "gets free swap" do
|
39
39
|
@plugin.run
|
40
40
|
expect(@plugin[:memory][:swap][:free]).to eql("47057688kB")
|
41
41
|
end
|
@@ -19,14 +19,14 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris plugin platform" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("solaris2/platform")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:solaris2)
|
25
25
|
allow(@plugin).to receive(:shell_out).with("/sbin/uname -X")
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "on SmartOS" do
|
29
|
-
before
|
29
|
+
before do
|
30
30
|
@uname_x = <<~UNAME_X
|
31
31
|
System = SunOS
|
32
32
|
Node = node.example.com
|
@@ -48,17 +48,17 @@ describe Ohai::System, "Solaris plugin platform" do
|
|
48
48
|
allow(File).to receive(:open).with("/etc/release").and_yield(@release)
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "runs uname and set platform and build" do
|
52
52
|
@plugin.run
|
53
53
|
expect(@plugin[:platform_build]).to eq("joyent_20120130T201844Z")
|
54
54
|
end
|
55
55
|
|
56
|
-
it "
|
56
|
+
it "sets the platform" do
|
57
57
|
@plugin.run
|
58
58
|
expect(@plugin[:platform]).to eq("smartos")
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "sets the platform_version" do
|
62
62
|
@plugin.run
|
63
63
|
expect(@plugin[:platform_version]).to eq("5.11")
|
64
64
|
end
|
@@ -66,7 +66,7 @@ describe Ohai::System, "Solaris plugin platform" do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
describe "on Solaris 11" do
|
69
|
-
before
|
69
|
+
before do
|
70
70
|
@uname_x = <<~UNAME_X
|
71
71
|
System = SunOS
|
72
72
|
Node = node.example.com
|
@@ -88,17 +88,17 @@ describe Ohai::System, "Solaris plugin platform" do
|
|
88
88
|
allow(File).to receive(:open).with("/etc/release").and_yield(@release)
|
89
89
|
end
|
90
90
|
|
91
|
-
it "
|
91
|
+
it "runs uname and set platform and build" do
|
92
92
|
@plugin.run
|
93
93
|
expect(@plugin[:platform_build]).to eq("11.1")
|
94
94
|
end
|
95
95
|
|
96
|
-
it "
|
96
|
+
it "sets the platform" do
|
97
97
|
@plugin.run
|
98
98
|
expect(@plugin[:platform]).to eq("solaris2")
|
99
99
|
end
|
100
100
|
|
101
|
-
it "
|
101
|
+
it "sets the platform_version" do
|
102
102
|
@plugin.run
|
103
103
|
expect(@plugin[:platform_version]).to eq("5.11")
|
104
104
|
end
|
@@ -21,7 +21,7 @@ require "spec_helper"
|
|
21
21
|
describe Ohai::System, "Solaris virtualization platform" do
|
22
22
|
let(:plugin) { get_plugin("solaris2/virtualization") }
|
23
23
|
|
24
|
-
before
|
24
|
+
before do
|
25
25
|
@psrinfo_pv = <<~PSRINFO_PV
|
26
26
|
The physical processor has 1 virtual processor (0)
|
27
27
|
x86 (GenuineIntel family 6 model 2 step 3 clock 2667 MHz)
|
@@ -39,16 +39,16 @@ describe Ohai::System, "Solaris virtualization platform" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "when we are checking for kvm" do
|
42
|
-
before
|
42
|
+
before do
|
43
43
|
expect(File).to receive(:exist?).with("/usr/sbin/psrinfo").and_return(true)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "runs psrinfo -pv" do
|
47
47
|
expect(plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv")
|
48
48
|
plugin.run
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "sets kvm guest if psrinfo -pv contains QEMU Virtual CPU" do
|
52
52
|
allow(plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv").and_return(mock_shell_out(0, "QEMU Virtual CPU", ""))
|
53
53
|
plugin.run
|
54
54
|
expect(plugin[:virtualization][:system]).to eq("kvm")
|
@@ -56,7 +56,7 @@ describe Ohai::System, "Solaris virtualization platform" do
|
|
56
56
|
expect(plugin[:virtualization][:systems][:kvm]).to eq("guest")
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "does not set virtualization if kvm isn't there" do
|
60
60
|
expect(plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv").and_return(mock_shell_out(0, @psrinfo_pv, ""))
|
61
61
|
plugin.run
|
62
62
|
expect(plugin[:virtualization][:systems]).to eq({})
|
@@ -90,7 +90,7 @@ describe Ohai::System, "Solaris virtualization platform" do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
it "
|
93
|
+
it "does not set virtualization if no tests match" do
|
94
94
|
plugin.run
|
95
95
|
expect(plugin[:virtualization][:systems]).to eq({})
|
96
96
|
end
|
@@ -20,7 +20,7 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Ohai::System, "ssh_host_key plugin" do
|
22
22
|
|
23
|
-
before
|
23
|
+
before do
|
24
24
|
@plugin = get_plugin("ssh_host_key")
|
25
25
|
@plugin[:keys] = Mash.new
|
26
26
|
|
@@ -83,6 +83,7 @@ describe Ohai::System, "ssh_host_key plugin" do
|
|
83
83
|
HostKey /etc/ssh/ssh_host_ed25519_key
|
84
84
|
EOS
|
85
85
|
end
|
86
|
+
|
86
87
|
it_behaves_like "loads keys"
|
87
88
|
end
|
88
89
|
|
@@ -96,6 +97,7 @@ describe Ohai::System, "ssh_host_key plugin" do
|
|
96
97
|
#HostKey /etc/ssh/ssh_host_ed25519_key
|
97
98
|
EOS
|
98
99
|
end
|
100
|
+
|
99
101
|
it_behaves_like "loads keys"
|
100
102
|
end
|
101
103
|
|
@@ -103,6 +105,7 @@ describe Ohai::System, "ssh_host_key plugin" do
|
|
103
105
|
let :sshd_config_file do
|
104
106
|
nil
|
105
107
|
end
|
108
|
+
|
106
109
|
before do
|
107
110
|
allow(File).to receive(:exist?).with("/etc/ssh/sshd_config").and_return(false)
|
108
111
|
allow(File).to receive(:exist?).with("/etc/sshd_config").and_return(false)
|
@@ -21,7 +21,7 @@ require "spec_helper"
|
|
21
21
|
describe Ohai::System, "sysconf plugin", :unix_only do
|
22
22
|
let(:plugin) { get_plugin("sysconf") }
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "populates sysconf if getconf is found" do
|
25
25
|
getconf_out = <<~GETCONF_OUT
|
26
26
|
LINK_MAX 65000
|
27
27
|
_POSIX_LINK_MAX 65000
|
@@ -672,7 +672,7 @@ describe Ohai::System, "sysconf plugin", :unix_only do
|
|
672
672
|
})
|
673
673
|
end
|
674
674
|
|
675
|
-
it "
|
675
|
+
it "does not populate sysconf if getconf is not found" do
|
676
676
|
allow(plugin).to receive(:which).with("getconf").and_return(false)
|
677
677
|
plugin.run
|
678
678
|
expect(plugin[:sysconf]).to be(nil)
|
@@ -18,12 +18,12 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
20
|
describe Ohai::System, "timezone plugin" do
|
21
|
-
before
|
21
|
+
before do
|
22
22
|
@plugin = get_plugin("timezone")
|
23
23
|
allow(Time).to receive_message_chain(:now, :getlocal, :zone) { "ZZZ" }
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "gets the local timezone" do
|
27
27
|
@plugin.run
|
28
28
|
expect(@plugin["time"]["timezone"]).to eq("ZZZ")
|
29
29
|
end
|
@@ -299,13 +299,13 @@ EOF
|
|
299
299
|
describe Ohai::System, "plugin virtualbox" do
|
300
300
|
let(:plugin) { get_plugin("virtualbox") }
|
301
301
|
|
302
|
-
before
|
302
|
+
before do
|
303
303
|
plugin[:virtualization] = Mash.new
|
304
304
|
plugin[:virtualization][:systems] = Mash.new
|
305
305
|
end
|
306
306
|
|
307
307
|
context "when not on a virtualbox guest" do
|
308
|
-
it "
|
308
|
+
it "does not set the virtualbox attribute" do
|
309
309
|
plugin[:virtualization][:systems][:vmware] = "host"
|
310
310
|
plugin.run
|
311
311
|
expect(plugin).not_to have_key(:virtualbox)
|
@@ -314,7 +314,7 @@ describe Ohai::System, "plugin virtualbox" do
|
|
314
314
|
|
315
315
|
context "when on a vbox guest" do
|
316
316
|
context "when VBoxControl shellout fails" do
|
317
|
-
it "
|
317
|
+
it "does not set the virtualbox attribute" do
|
318
318
|
plugin[:virtualization][:systems][:vbox] = "guest"
|
319
319
|
allow(plugin).to receive(:shell_out).with("VBoxControl guestproperty enumerate").and_return(mock_shell_out(1, "", ""))
|
320
320
|
plugin.run
|
@@ -323,29 +323,29 @@ describe Ohai::System, "plugin virtualbox" do
|
|
323
323
|
end
|
324
324
|
|
325
325
|
context "when VBoxControl shellout succeeds" do
|
326
|
-
before
|
326
|
+
before do
|
327
327
|
plugin[:virtualization][:systems][:vbox] = "guest"
|
328
328
|
allow(plugin).to receive(:shell_out).with("VBoxControl guestproperty enumerate").and_return(mock_shell_out(0, vbox_output, ""))
|
329
329
|
plugin.run
|
330
330
|
end
|
331
331
|
|
332
|
-
it "
|
332
|
+
it "sets the host version" do
|
333
333
|
expect(plugin[:virtualbox][:host][:version]).to eql("5.0.10")
|
334
334
|
end
|
335
335
|
|
336
|
-
it "
|
336
|
+
it "sets the host revision" do
|
337
337
|
expect(plugin[:virtualbox][:host][:revision]).to eql("104061")
|
338
338
|
end
|
339
339
|
|
340
|
-
it "
|
340
|
+
it "sets the host language" do
|
341
341
|
expect(plugin[:virtualbox][:host][:language]).to eql("en_US")
|
342
342
|
end
|
343
343
|
|
344
|
-
it "
|
344
|
+
it "sets the guest additions version" do
|
345
345
|
expect(plugin[:virtualbox][:guest][:guest_additions_version]).to eql("5.0.2")
|
346
346
|
end
|
347
347
|
|
348
|
-
it "
|
348
|
+
it "sets the guest additions revision" do
|
349
349
|
expect(plugin[:virtualbox][:guest][:guest_additions_revision]).to eql("102096")
|
350
350
|
end
|
351
351
|
end
|
@@ -353,7 +353,7 @@ describe Ohai::System, "plugin virtualbox" do
|
|
353
353
|
|
354
354
|
context "when on a vbox host" do
|
355
355
|
context "if the host has virtualbox installed" do
|
356
|
-
it "
|
356
|
+
it "creates a vbox attribute with accurate data" do
|
357
357
|
plugin[:virtualization][:systems][:vbox] = "host"
|
358
358
|
allow(plugin).to receive(:which).with("VBoxManage").and_return("/usr/bin/VBoxManage")
|
359
359
|
allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted vms").and_return(mock_shell_out(0, vbox_list_vms_stdout, ""))
|
@@ -21,12 +21,12 @@ describe Ohai::System, "plugin vmware" do
|
|
21
21
|
let(:plugin) { get_plugin("vmware") }
|
22
22
|
let(:path) { "/usr/bin/vmware-toolbox-cmd" }
|
23
23
|
|
24
|
-
before
|
24
|
+
before do
|
25
25
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
26
26
|
end
|
27
27
|
|
28
28
|
context "on vmware guest with toolbox installed" do
|
29
|
-
before
|
29
|
+
before do
|
30
30
|
allow(File).to receive(:exist?).with("/usr/bin/vmware-toolbox-cmd").and_return(true)
|
31
31
|
allow(plugin).to receive(:shell_out).with("#{path} stat speed").and_return(mock_shell_out(0, "2000 MHz", nil))
|
32
32
|
allow(plugin).to receive(:shell_out).with("#{path} stat hosttime").and_return(mock_shell_out(0, "04 Jun 2015 19:21:16", nil))
|
@@ -59,7 +59,7 @@ describe Ohai::System, "plugin vmware" do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
context "on vmware guest without toolbox" do
|
62
|
-
it "
|
62
|
+
it "does not create a vmware attribute" do
|
63
63
|
plugin[:virtualization] = Mash.new
|
64
64
|
plugin[:virtualization][:systems] = Mash.new
|
65
65
|
plugin[:virtualization][:systems][:vmware] = Mash.new
|
@@ -70,7 +70,7 @@ describe Ohai::System, "plugin vmware" do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
context "on vbox guest" do
|
73
|
-
it "
|
73
|
+
it "does not create a vmware attribute" do
|
74
74
|
plugin[:virtualization] = Mash.new
|
75
75
|
plugin[:virtualization][:systems] = Mash.new
|
76
76
|
plugin[:virtualization][:systems][:vbox] = Mash.new
|
@@ -20,48 +20,48 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
shared_examples "a cpu" do |cpu_no|
|
22
22
|
describe "cpu #{cpu_no}" do
|
23
|
-
it "
|
23
|
+
it "sets physical_id to CPU#{cpu_no}" do
|
24
24
|
expect(@plugin[:cpu][cpu_no.to_s][:physical_id]).to eq("CPU#{cpu_no}")
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
27
|
+
it "sets mhz to 2793" do
|
28
28
|
expect(@plugin[:cpu][cpu_no.to_s][:mhz]).to eq("2793")
|
29
29
|
end
|
30
30
|
|
31
|
-
it "
|
31
|
+
it "sets vendor_id to GenuineIntel" do
|
32
32
|
expect(@plugin[:cpu][cpu_no.to_s][:vendor_id]).to eq("GenuineIntel")
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "sets model_name to Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz" do
|
36
36
|
expect(@plugin[:cpu][cpu_no.to_s][:model_name])
|
37
37
|
.to eq("Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz")
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "sets description to Intel64 Family 6 Model 70 Stepping 1" do
|
41
41
|
expect(@plugin[:cpu][cpu_no.to_s][:description])
|
42
42
|
.to eq("Intel64 Family 6 Model 70 Stepping 1")
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
45
|
+
it "sets model to 17921" do
|
46
46
|
expect(@plugin[:cpu][cpu_no.to_s][:model]).to eq("17921")
|
47
47
|
end
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "sets family to 2" do
|
50
50
|
expect(@plugin[:cpu][cpu_no.to_s][:family]).to eq("2")
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "sets stepping to 9" do
|
54
54
|
expect(@plugin[:cpu][cpu_no.to_s][:stepping]).to eq(9)
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "sets cache_size to 64 KB" do
|
58
58
|
expect(@plugin[:cpu][cpu_no.to_s][:cache_size]).to eq("64 KB")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe Ohai::System, "Windows cpu plugin" do
|
64
|
-
before
|
64
|
+
before do
|
65
65
|
@plugin = get_plugin("cpu")
|
66
66
|
allow(@plugin).to receive(:collect_os).and_return(:windows)
|
67
67
|
|
@@ -100,15 +100,15 @@ describe Ohai::System, "Windows cpu plugin" do
|
|
100
100
|
@plugin.run
|
101
101
|
end
|
102
102
|
|
103
|
-
it "
|
103
|
+
it "sets total cpu to 2" do
|
104
104
|
expect(@plugin[:cpu][:total]).to eq(4)
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "sets real cpu to 2" do
|
108
108
|
expect(@plugin[:cpu][:real]).to eq(2)
|
109
109
|
end
|
110
110
|
|
111
|
-
it "
|
111
|
+
it "sets 2 distinct cpus numbered 0 and 1" do
|
112
112
|
expect(@plugin[:cpu]).to have_key("0")
|
113
113
|
expect(@plugin[:cpu]).to have_key("1")
|
114
114
|
end
|