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
@@ -21,7 +21,7 @@ require "spec_helper"
|
|
21
21
|
describe Ohai::System, "BSD virtualization plugin" do
|
22
22
|
let(:plugin) { get_plugin("bsd/virtualization") }
|
23
23
|
|
24
|
-
before
|
24
|
+
before do
|
25
25
|
allow(plugin).to receive(:collect_os).and_return(:freebsd)
|
26
26
|
allow(plugin).to receive(:shell_out).with("sysctl -n security.jail.jailed").and_return(mock_shell_out(0, "0", ""))
|
27
27
|
allow(plugin).to receive(:shell_out).with((Ohai.abs_path( "/sbin/kldstat" )).to_s).and_return(mock_shell_out(0, "", ""))
|
data/spec/unit/plugins/c_spec.rb
CHANGED
@@ -74,7 +74,7 @@ describe Ohai::System, "plugin c" do
|
|
74
74
|
|
75
75
|
let(:plugin) { get_plugin("c") }
|
76
76
|
|
77
|
-
before
|
77
|
+
before do
|
78
78
|
|
79
79
|
plugin[:languages] = Mash.new
|
80
80
|
# gcc
|
@@ -82,7 +82,7 @@ describe Ohai::System, "plugin c" do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
context "on AIX" do
|
85
|
-
before
|
85
|
+
before do
|
86
86
|
allow(plugin).to receive(:collect_os).and_return(:aix)
|
87
87
|
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
|
88
88
|
end
|
@@ -123,8 +123,9 @@ describe Ohai::System, "plugin c" do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
end
|
126
|
+
|
126
127
|
context "on Darwin" do
|
127
|
-
before
|
128
|
+
before do
|
128
129
|
allow(plugin).to receive(:shell_out).with("/usr/bin/xcode-select -p").and_return(mock_shell_out(0, "", ""))
|
129
130
|
allow(plugin).to receive(:collect_os).and_return(:darwin)
|
130
131
|
end
|
@@ -143,7 +144,7 @@ describe Ohai::System, "plugin c" do
|
|
143
144
|
end
|
144
145
|
|
145
146
|
context "on Windows" do
|
146
|
-
before
|
147
|
+
before do
|
147
148
|
allow(plugin).to receive(:collect_os).and_return(:windows)
|
148
149
|
allow(plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
|
149
150
|
allow(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
|
@@ -209,7 +210,7 @@ describe Ohai::System, "plugin c" do
|
|
209
210
|
end
|
210
211
|
|
211
212
|
context "on Linux" do
|
212
|
-
before
|
213
|
+
before do
|
213
214
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
214
215
|
# glibc
|
215
216
|
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC, ""))
|
@@ -23,11 +23,11 @@ begin
|
|
23
23
|
require "chef/version"
|
24
24
|
|
25
25
|
describe Ohai::System, "plugin chef" do
|
26
|
-
before
|
26
|
+
before do
|
27
27
|
@plugin = get_plugin("chef")
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "sets [:chef_packages][:chef][:version] to the current chef version", if: defined?(Chef) do
|
31
31
|
@plugin.run
|
32
32
|
expect(@plugin[:chef_packages][:chef][:version]).to eq(Chef::VERSION)
|
33
33
|
end
|
@@ -19,7 +19,7 @@ require "spec_helper"
|
|
19
19
|
require "ipaddr"
|
20
20
|
|
21
21
|
describe "CloudAttrs object" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("cloud")
|
24
24
|
end
|
25
25
|
|
@@ -73,7 +73,7 @@ describe "CloudAttrs object" do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
describe Ohai::System, "plugin cloud" do
|
76
|
-
before
|
76
|
+
before do
|
77
77
|
@plugin = get_plugin("cloud")
|
78
78
|
end
|
79
79
|
|
@@ -335,7 +335,7 @@ describe Ohai::System, "plugin cloud" do
|
|
335
335
|
expect(@plugin[:cloud][:public_ssh_port]).to be_nil
|
336
336
|
end
|
337
337
|
|
338
|
-
it "
|
338
|
+
it "does not populate cloud public_ssh_port when winrm is used" do
|
339
339
|
@plugin[:azure]["public_winrm_port"] = "5985"
|
340
340
|
@plugin.run
|
341
341
|
expect(@plugin[:cloud][:public_ssh_port]).to be_nil
|
@@ -399,7 +399,7 @@ describe Ohai::System, "plugin cloud" do
|
|
399
399
|
}
|
400
400
|
end
|
401
401
|
|
402
|
-
before
|
402
|
+
before do
|
403
403
|
@plugin.run
|
404
404
|
end
|
405
405
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Darwin cpu plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("cpu")
|
24
24
|
@stdout = <<~CTL
|
25
25
|
hw.ncpu: 8
|
@@ -82,43 +82,43 @@ describe Ohai::System, "Darwin cpu plugin" do
|
|
82
82
|
@plugin.run
|
83
83
|
end
|
84
84
|
|
85
|
-
it "
|
85
|
+
it "sets cpu[:cores] to 4" do
|
86
86
|
expect(@plugin[:cpu][:cores]).to eq(4)
|
87
87
|
end
|
88
88
|
|
89
|
-
it "
|
89
|
+
it "sets cpu[:total] to 8" do
|
90
90
|
expect(@plugin[:cpu][:total]).to eq(8)
|
91
91
|
end
|
92
92
|
|
93
|
-
it "
|
93
|
+
it "sets cpu[:real] to 1" do
|
94
94
|
expect(@plugin[:cpu][:real]).to eq(1)
|
95
95
|
end
|
96
96
|
|
97
|
-
it "
|
97
|
+
it "sets cpu[:mhz] to 2800" do
|
98
98
|
expect(@plugin[:cpu][:mhz]).to eq(2800)
|
99
99
|
end
|
100
100
|
|
101
|
-
it "
|
101
|
+
it "sets cpu[:vendor_id] to GenuineIntel" do
|
102
102
|
expect(@plugin[:cpu][:vendor_id]).to eq("GenuineIntel")
|
103
103
|
end
|
104
104
|
|
105
|
-
it "
|
105
|
+
it "sets cpu[:model_name] to Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz" do
|
106
106
|
expect(@plugin[:cpu][:model_name]).to eq("Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz")
|
107
107
|
end
|
108
108
|
|
109
|
-
it "
|
109
|
+
it "sets cpu[:model] to 70" do
|
110
110
|
expect(@plugin[:cpu][:model]).to eq(70)
|
111
111
|
end
|
112
112
|
|
113
|
-
it "
|
113
|
+
it "sets cpu[:family] to 6" do
|
114
114
|
expect(@plugin[:cpu][:family]).to eq(6)
|
115
115
|
end
|
116
116
|
|
117
|
-
it "
|
117
|
+
it "sets cpu[:stepping] to 1" do
|
118
118
|
expect(@plugin[:cpu][:stepping]).to eq(1)
|
119
119
|
end
|
120
120
|
|
121
|
-
it "
|
121
|
+
it "sets cpu[:flags] to array of flags" do
|
122
122
|
expect(@plugin[:cpu][:flags]).to eq(["fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "clfsh", "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", "pbe", "sse3", "pclmulqdq", "dtes64", "mon", "dscpl", "vmx", "smx", "est", "tm2", "ssse3", "fma", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "movbe", "popcnt", "aes", "pcid", "xsave", "osxsave", "seglim64", "tsctmr", "avx1.0", "rdrand", "f16c"])
|
123
123
|
end
|
124
124
|
end
|
@@ -20,7 +20,8 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Ohai::System, "darwin filesystem plugin" do
|
22
22
|
let(:plugin) { get_plugin("filesystem") }
|
23
|
-
|
23
|
+
|
24
|
+
before do
|
24
25
|
allow(plugin).to receive(:collect_os).and_return(:darwin)
|
25
26
|
|
26
27
|
allow(plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, "", ""))
|
@@ -28,7 +29,7 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
28
29
|
end
|
29
30
|
|
30
31
|
describe "when gathering filesystem usage data from df" do
|
31
|
-
before
|
32
|
+
before do
|
32
33
|
@stdout = <<~DF
|
33
34
|
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
|
34
35
|
/dev/disk0s2 488555536 313696448 174347088 65% 39276054 21793386 64% /
|
@@ -41,12 +42,12 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
41
42
|
allow(plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, @stdout, ""))
|
42
43
|
end
|
43
44
|
|
44
|
-
it "
|
45
|
+
it "runs df -i" do
|
45
46
|
expect(plugin).to receive(:shell_out).ordered.with("df -i").and_return(mock_shell_out(0, @stdout, ""))
|
46
47
|
plugin.run
|
47
48
|
end
|
48
49
|
|
49
|
-
it "
|
50
|
+
it "sets size to value from df -i" do
|
50
51
|
plugin.run
|
51
52
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:kb_size]).to eq("244277768")
|
52
53
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:kb_used]).to eq("156848224")
|
@@ -54,13 +55,13 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
54
55
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:percent_used]).to eq("65%")
|
55
56
|
end
|
56
57
|
|
57
|
-
it "
|
58
|
+
it "sets device and mount to value from df -i" do
|
58
59
|
plugin.run
|
59
60
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:mount]).to eq("/")
|
60
61
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:device]).to eq("/dev/disk0s2")
|
61
62
|
end
|
62
63
|
|
63
|
-
it "
|
64
|
+
it "sets inode info to value from df -i" do
|
64
65
|
plugin.run
|
65
66
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:total_inodes]).to eq("61069440")
|
66
67
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:inodes_used]).to eq("39276054")
|
@@ -69,7 +70,7 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
69
70
|
end
|
70
71
|
|
71
72
|
describe "when gathering mounted filesystem data from mount" do
|
72
|
-
before
|
73
|
+
before do
|
73
74
|
@stdout = <<~MOUNT
|
74
75
|
/dev/disk0s2 on / (hfs, local, journaled)
|
75
76
|
devfs on /dev (devfs, local, nobrowse)
|
@@ -81,12 +82,12 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
81
82
|
allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
|
82
83
|
end
|
83
84
|
|
84
|
-
it "
|
85
|
+
it "runs mount" do
|
85
86
|
expect(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
|
86
87
|
plugin.run
|
87
88
|
end
|
88
89
|
|
89
|
-
it "
|
90
|
+
it "sets values from mount" do
|
90
91
|
plugin.run
|
91
92
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:mount]).to eq("/")
|
92
93
|
expect(plugin[:filesystem]["by_pair"]["/dev/disk0s2,/"][:fs_type]).to eq("hfs")
|
@@ -95,7 +96,7 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
95
96
|
end
|
96
97
|
|
97
98
|
describe "when gathering filesystem data with devices mounted more than once" do
|
98
|
-
before
|
99
|
+
before do
|
99
100
|
@dfstdout = <<~DF
|
100
101
|
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
|
101
102
|
/dev/disk0s2 488555536 313696448 174347088 65% 39276054 21793386 64% /
|
@@ -109,14 +110,14 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
109
110
|
allow(plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, @dfstdout, ""))
|
110
111
|
end
|
111
112
|
|
112
|
-
it "
|
113
|
+
it "provides a devices view with all mountpoints" do
|
113
114
|
plugin.run
|
114
115
|
expect(plugin[:filesystem]["by_device"]["/dev/disk0s2"][:mounts]).to eq(["/", "/another/mountpoint"])
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
118
119
|
describe "when gathering filesystem data with double-mounts" do
|
119
|
-
before
|
120
|
+
before do
|
120
121
|
@dfstdout = <<~DF
|
121
122
|
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
|
122
123
|
/dev/disk0s2 488555536 313696448 174347088 65% 39276054 21793386 64% /
|
@@ -131,7 +132,7 @@ describe Ohai::System, "darwin filesystem plugin" do
|
|
131
132
|
allow(plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, @dfstdout, ""))
|
132
133
|
end
|
133
134
|
|
134
|
-
it "
|
135
|
+
it "provides a mounts view with all devices" do
|
135
136
|
plugin.run
|
136
137
|
expect(plugin[:filesystem]["by_mountpoint"]["/mnt"][:devices]).to eq(["/dev/disk0s3", "/dev/disk0s4"])
|
137
138
|
end
|
@@ -21,7 +21,8 @@ require_relative "hardware_system_profiler_output"
|
|
21
21
|
|
22
22
|
describe Ohai::System, "Darwin hardware plugin", :unix_only do
|
23
23
|
let(:plugin) { get_plugin("darwin/hardware") }
|
24
|
-
|
24
|
+
|
25
|
+
before do
|
25
26
|
allow(plugin).to receive(:collect_os).and_return(:darwin)
|
26
27
|
# Make sure it always runs correct commands and mock the data as it calls them
|
27
28
|
allow(plugin).to receive(:shell_out).with(
|
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Darwin hostname plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("hostname")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:darwin)
|
25
25
|
allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
|
@@ -31,12 +31,12 @@ describe Ohai::System, "Darwin hostname plugin" do
|
|
31
31
|
|
32
32
|
it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "uses #resolve_fqdn to find the fqdn" do
|
35
35
|
@plugin.run
|
36
36
|
expect(@plugin[:fqdn]).to eq("katie.bethell")
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "sets the domain to everything after the first dot of the fqdn" do
|
40
40
|
@plugin.run
|
41
41
|
expect(@plugin[:domain]).to eq("bethell")
|
42
42
|
end
|
@@ -19,13 +19,13 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Darwin kernel plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("kernel")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:darwin)
|
25
25
|
allow(@plugin).to receive(:init_kernel).and_return({})
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "populates kernel[:modules] from `kextstat -k -l`" do
|
29
29
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "0", ""))
|
30
30
|
allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, <<EOF, ""))
|
31
31
|
8 0 0xffffff7f81aed000 0x41000 0x41000 com.apple.kec.corecrypto (1.0) <7 6 5 4 3 1>
|
@@ -42,21 +42,21 @@ EOF
|
|
42
42
|
expect(@plugin[:kernel][:modules]).to eql(modules)
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
45
|
+
it "does not set kernel_machine to x86_64" do
|
46
46
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "0", ""))
|
47
47
|
allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
|
48
48
|
@plugin.run
|
49
49
|
expect(@plugin[:kernel][:machine]).not_to eq("x86_64")
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "sets kernel_machine to x86_64" do
|
53
53
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "1", ""))
|
54
54
|
allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
|
55
55
|
@plugin.run
|
56
56
|
expect(@plugin[:kernel][:machine]).to eq("x86_64")
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "sets the kernel_os to the kernel_name value" do
|
60
60
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "1", ""))
|
61
61
|
allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
|
62
62
|
@plugin.run
|
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Darwin Memory Plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
darwin_memsize = <<~DARWIN_MEMSIZE
|
24
24
|
17179869184
|
25
25
|
DARWIN_MEMSIZE
|
@@ -46,19 +46,19 @@ describe Ohai::System, "Darwin Memory Plugin" do
|
|
46
46
|
@plugin.run
|
47
47
|
end
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "sets memory[:total] to 16384MB" do
|
50
50
|
expect(@plugin[:memory][:total]).to eq("16384MB")
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "sets memory[:active] to 5140MB" do
|
54
54
|
expect(@plugin[:memory][:active]).to eq("5140MB")
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "sets memory[:inactive] to 738MB" do
|
58
58
|
expect(@plugin[:memory][:inactive]).to eq("738MB")
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "sets memory[:free] to 10504MB" do
|
62
62
|
expect(@plugin[:memory][:free]).to eq("10504MB")
|
63
63
|
end
|
64
64
|
end
|
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Darwin Network Plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@darwin_ifconfig = <<~DARWIN_IFCONFIG
|
24
24
|
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
|
25
25
|
options=3<RXCSUM,TXCSUM>
|
@@ -430,7 +430,7 @@ describe Ohai::System, "Darwin Network Plugin" do
|
|
430
430
|
end
|
431
431
|
|
432
432
|
describe "gathering IP layer address info" do
|
433
|
-
before
|
433
|
+
before do
|
434
434
|
allow(@plugin).to receive(:shell_out).with("arp -an").and_return(mock_shell_out(0, @darwin_arp, ""))
|
435
435
|
allow(@plugin).to receive(:shell_out).with("ifconfig -a").and_return(mock_shell_out(0, @darwin_ifconfig, ""))
|
436
436
|
allow(@plugin).to receive(:shell_out).with("netstat -i -d -l -b -n").and_return(mock_shell_out(0, @darwin_netstat, ""))
|
@@ -549,7 +549,7 @@ describe Ohai::System, "Darwin Network Plugin" do
|
|
549
549
|
expect(@plugin["network"][:default_gateway]).to eq("10.20.10.1")
|
550
550
|
end
|
551
551
|
|
552
|
-
it "
|
552
|
+
it "detects network settings" do
|
553
553
|
expect(@plugin["network"]["settings"]["net.local.stream.sendspace"]).to eq("8192")
|
554
554
|
expect(@plugin["network"]["settings"]["net.local.stream.recvspace"]).to eq("8192")
|
555
555
|
expect(@plugin["network"]["settings"]["net.local.stream.tracemdns"]).to eq("0")
|
@@ -19,51 +19,51 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Darwin plugin platform" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("darwin/platform")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:darwin)
|
25
25
|
@stdout = "ProductName: Mac OS X\nProductVersion: 10.5.5\nBuildVersion: 9F33"
|
26
26
|
allow(@plugin).to receive(:shell_out).with("/usr/bin/sw_vers").and_return(mock_shell_out(0, @stdout, ""))
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "runs sw_vers" do
|
30
30
|
expect(@plugin).to receive(:shell_out).with("/usr/bin/sw_vers").and_return(mock_shell_out(0, @stdout, ""))
|
31
31
|
@plugin.run
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "sets platform to ProductName, downcased with _ for \\s" do
|
35
35
|
@plugin.run
|
36
36
|
expect(@plugin[:platform]).to eq("mac_os_x")
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "sets platform_version to ProductVersion" do
|
40
40
|
@plugin.run
|
41
41
|
expect(@plugin[:platform_version]).to eq("10.5.5")
|
42
42
|
end
|
43
43
|
|
44
|
-
it "
|
44
|
+
it "sets platform_build to BuildVersion" do
|
45
45
|
@plugin.run
|
46
46
|
expect(@plugin[:platform_build]).to eq("9F33")
|
47
47
|
end
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "sets platform_family to mac_os_x" do
|
50
50
|
@plugin.run
|
51
51
|
expect(@plugin[:platform_family]).to eq("mac_os_x")
|
52
52
|
end
|
53
53
|
|
54
54
|
describe "on os x server" do
|
55
|
-
before
|
55
|
+
before do
|
56
56
|
@plugin[:os] = "darwin"
|
57
57
|
@stdout = "ProductName: Mac OS X Server\nProductVersion: 10.6.8\nBuildVersion: 10K549"
|
58
58
|
allow(@plugin).to receive(:shell_out).with("/usr/bin/sw_vers").and_return(mock_shell_out(0, @stdout, ""))
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "sets platform to mac_os_x_server" do
|
62
62
|
@plugin.run
|
63
63
|
expect(@plugin[:platform]).to eq("mac_os_x_server")
|
64
64
|
end
|
65
65
|
|
66
|
-
it "
|
66
|
+
it "sets platform_family to mac_os_x" do
|
67
67
|
@plugin.run
|
68
68
|
expect(@plugin[:platform_family]).to eq("mac_os_x")
|
69
69
|
end
|