ohai 7.6.0.rc.1 → 8.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +4 -4
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +12 -12
- data/spec/unit/dsl/plugin_spec.rb +40 -40
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +16 -16
- data/spec/unit/mixin/cloudstack_metadata_spec.rb +1 -1
- data/spec/unit/mixin/command_spec.rb +6 -6
- data/spec/unit/mixin/ec2_metadata_spec.rb +8 -8
- data/spec/unit/plugins/aix/cpu_spec.rb +15 -15
- data/spec/unit/plugins/aix/filesystem_spec.rb +15 -15
- data/spec/unit/plugins/aix/hostname_spec.rb +3 -3
- data/spec/unit/plugins/aix/kernel_spec.rb +14 -14
- data/spec/unit/plugins/aix/network_spec.rb +43 -43
- data/spec/unit/plugins/aix/platform_spec.rb +5 -5
- data/spec/unit/plugins/aix/uptime_spec.rb +7 -7
- data/spec/unit/plugins/aix/virtualization_spec.rb +3 -3
- data/spec/unit/plugins/azure_spec.rb +18 -18
- data/spec/unit/plugins/c_spec.rb +52 -52
- data/spec/unit/plugins/chef_spec.rb +1 -1
- data/spec/unit/plugins/cloud_spec.rb +31 -31
- data/spec/unit/plugins/cloud_v2_spec.rb +33 -33
- data/spec/unit/plugins/cloudstack_spec.rb +6 -6
- data/spec/unit/plugins/darwin/cpu_spec.rb +19 -19
- data/spec/unit/plugins/darwin/hostname_spec.rb +6 -6
- data/spec/unit/plugins/darwin/kernel_spec.rb +14 -14
- data/spec/unit/plugins/darwin/memory_spec.rb +7 -7
- data/spec/unit/plugins/darwin/network_spec.rb +358 -358
- data/spec/unit/plugins/darwin/platform_spec.rb +10 -10
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +80 -80
- data/spec/unit/plugins/erlang_spec.rb +7 -7
- data/spec/unit/plugins/eucalyptus_spec.rb +28 -28
- data/spec/unit/plugins/fail_spec.rb +8 -8
- data/spec/unit/plugins/freebsd/cpu_spec.rb +10 -10
- data/spec/unit/plugins/freebsd/hostname_spec.rb +4 -4
- data/spec/unit/plugins/freebsd/kernel_spec.rb +6 -6
- data/spec/unit/plugins/freebsd/os_spec.rb +3 -3
- data/spec/unit/plugins/freebsd/platform_spec.rb +5 -5
- data/spec/unit/plugins/freebsd/virtualization_spec.rb +20 -20
- data/spec/unit/plugins/gce_spec.rb +18 -18
- data/spec/unit/plugins/go_spec.rb +5 -5
- data/spec/unit/plugins/groovy_spec.rb +5 -5
- data/spec/unit/plugins/hostname_spec.rb +24 -24
- data/spec/unit/plugins/init_package_spec.rb +5 -5
- data/spec/unit/plugins/ip_scopes_spec.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +23 -23
- data/spec/unit/plugins/joyent_spec.rb +13 -13
- data/spec/unit/plugins/kernel_spec.rb +20 -20
- data/spec/unit/plugins/linode_spec.rb +18 -18
- data/spec/unit/plugins/linux/cpu_spec.rb +25 -25
- data/spec/unit/plugins/linux/filesystem_spec.rb +61 -60
- data/spec/unit/plugins/linux/hostname_spec.rb +7 -7
- data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
- data/spec/unit/plugins/linux/lsb_spec.rb +23 -23
- data/spec/unit/plugins/linux/mdadm_spec.rb +11 -11
- data/spec/unit/plugins/linux/platform_spec.rb +167 -167
- data/spec/unit/plugins/linux/uptime_spec.rb +6 -6
- data/spec/unit/plugins/linux/virtualization_spec.rb +156 -156
- data/spec/unit/plugins/lua_spec.rb +5 -5
- data/spec/unit/plugins/mono_spec.rb +5 -5
- data/spec/unit/plugins/netbsd/hostname_spec.rb +6 -6
- data/spec/unit/plugins/netbsd/kernel_spec.rb +6 -6
- data/spec/unit/plugins/netbsd/platform_spec.rb +5 -5
- data/spec/unit/plugins/network_spec.rb +116 -116
- data/spec/unit/plugins/nodejs_spec.rb +5 -5
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +5 -5
- data/spec/unit/plugins/openbsd/hostname_spec.rb +6 -6
- data/spec/unit/plugins/openbsd/kernel_spec.rb +6 -6
- data/spec/unit/plugins/openbsd/platform_spec.rb +4 -4
- data/spec/unit/plugins/openstack_spec.rb +8 -8
- data/spec/unit/plugins/os_spec.rb +5 -5
- data/spec/unit/plugins/passwd_spec.rb +13 -13
- data/spec/unit/plugins/perl_spec.rb +8 -8
- data/spec/unit/plugins/php_spec.rb +7 -7
- data/spec/unit/plugins/platform_spec.rb +9 -9
- data/spec/unit/plugins/powershell_spec.rb +10 -10
- data/spec/unit/plugins/rackspace_spec.rb +72 -70
- data/spec/unit/plugins/root_group_spec.rb +14 -14
- data/spec/unit/plugins/ruby_spec.rb +1 -1
- data/spec/unit/plugins/sigar/network_route_spec.rb +17 -17
- data/spec/unit/plugins/solaris2/cpu_spec.rb +18 -18
- data/spec/unit/plugins/solaris2/hostname_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/kernel_spec.rb +8 -8
- data/spec/unit/plugins/solaris2/memory_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/network_spec.rb +13 -13
- data/spec/unit/plugins/solaris2/platform_spec.rb +14 -14
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +24 -24
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +18 -18
- data/spec/unit/runner_spec.rb +26 -26
- data/spec/unit/system_spec.rb +54 -54
- data/spec/unit/util/file_helper_spec.rb +2 -2
- metadata +50 -95
@@ -22,10 +22,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|
22
22
|
describe Ohai::System, "Linux hostname plugin" do
|
23
23
|
before(:each) do
|
24
24
|
@plugin = get_plugin("hostname")
|
25
|
-
@plugin.
|
26
|
-
@plugin.
|
27
|
-
@plugin.
|
28
|
-
@plugin.
|
25
|
+
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
26
|
+
allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
|
27
|
+
allow(@plugin).to receive(:shell_out).with("hostname --fqdn").and_return(mock_shell_out(0, "katie.bethell", ""))
|
28
|
+
allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
|
29
29
|
end
|
30
30
|
|
31
31
|
it_should_check_from("linux::hostname", "hostname", "hostname -s", "katie")
|
@@ -36,16 +36,16 @@ describe Ohai::System, "Linux hostname plugin" do
|
|
36
36
|
|
37
37
|
describe "when domain name is unset" do
|
38
38
|
before(:each) do
|
39
|
-
@plugin.
|
39
|
+
expect(@plugin).to receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should not raise an error" do
|
43
|
-
|
43
|
+
expect { @plugin.run }.not_to raise_error
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should not set fqdn" do
|
47
47
|
@plugin.run
|
48
|
-
@plugin.fqdn.
|
48
|
+
expect(@plugin.fqdn).to eq(nil)
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
@@ -32,11 +32,11 @@ virtio_balloon 13168 0
|
|
32
32
|
floppy 55441 0
|
33
33
|
ENV_LSMOD
|
34
34
|
@plugin = get_plugin("kernel")
|
35
|
-
@plugin.
|
36
|
-
@plugin.
|
37
|
-
@plugin.
|
38
|
-
@plugin.
|
39
|
-
@plugin.
|
35
|
+
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
36
|
+
allow(@plugin).to receive(:init_kernel).and_return({})
|
37
|
+
allow(@plugin).to receive(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux", ""))
|
38
|
+
allow(@plugin).to receive(:shell_out).with("env lsmod").and_return(mock_shell_out(0, @env_lsmod, ""))
|
39
|
+
expect(@plugin).to receive(:shell_out).with("env lsmod").at_least(1).times
|
40
40
|
@plugin.run
|
41
41
|
end
|
42
42
|
|
@@ -24,46 +24,46 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|
24
24
|
describe Ohai::System, "Linux lsb plugin" do
|
25
25
|
before(:each) do
|
26
26
|
@plugin = get_plugin("linux/lsb")
|
27
|
-
@plugin.
|
27
|
+
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "on systems with /etc/lsb-release" do
|
31
31
|
before(:each) do
|
32
32
|
@double_file = double("/etc/lsb-release")
|
33
|
-
@double_file.
|
33
|
+
allow(@double_file).to receive(:each).
|
34
34
|
and_yield("DISTRIB_ID=Ubuntu").
|
35
35
|
and_yield("DISTRIB_RELEASE=8.04").
|
36
36
|
and_yield("DISTRIB_CODENAME=hardy").
|
37
37
|
and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
|
38
|
-
File.
|
39
|
-
File.
|
38
|
+
allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
|
39
|
+
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(true)
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should set lsb[:id]" do
|
43
43
|
@plugin.run
|
44
|
-
@plugin[:lsb][:id].
|
44
|
+
expect(@plugin[:lsb][:id]).to eq("Ubuntu")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should set lsb[:release]" do
|
48
48
|
@plugin.run
|
49
|
-
@plugin[:lsb][:release].
|
49
|
+
expect(@plugin[:lsb][:release]).to eq("8.04")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should set lsb[:codename]" do
|
53
53
|
@plugin.run
|
54
|
-
@plugin[:lsb][:codename].
|
54
|
+
expect(@plugin[:lsb][:codename]).to eq("hardy")
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should set lsb[:description]" do
|
58
58
|
@plugin.run
|
59
|
-
@plugin[:lsb][:description].
|
59
|
+
expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe "on systems with /usr/bin/lsb_release" do
|
64
64
|
before(:each) do
|
65
|
-
File.
|
66
|
-
File.
|
65
|
+
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(false)
|
66
|
+
allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(true)
|
67
67
|
|
68
68
|
@stdin = double("STDIN", { :close => true })
|
69
69
|
@pid = 10
|
@@ -82,27 +82,27 @@ Description: CentOS release 5.4 (Final)
|
|
82
82
|
Release: 5.4
|
83
83
|
Codename: Final
|
84
84
|
LSB_RELEASE
|
85
|
-
@plugin.
|
85
|
+
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should set lsb[:id]" do
|
89
89
|
@plugin.run
|
90
|
-
@plugin[:lsb][:id].
|
90
|
+
expect(@plugin[:lsb][:id]).to eq("CentOS")
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should set lsb[:release]" do
|
94
94
|
@plugin.run
|
95
|
-
@plugin[:lsb][:release].
|
95
|
+
expect(@plugin[:lsb][:release]).to eq("5.4")
|
96
96
|
end
|
97
97
|
|
98
98
|
it "should set lsb[:codename]" do
|
99
99
|
@plugin.run
|
100
|
-
@plugin[:lsb][:codename].
|
100
|
+
expect(@plugin[:lsb][:codename]).to eq("Final")
|
101
101
|
end
|
102
102
|
|
103
103
|
it "should set lsb[:description]" do
|
104
104
|
@plugin.run
|
105
|
-
@plugin[:lsb][:description].
|
105
|
+
expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
@@ -115,34 +115,34 @@ Description: Fedora release 14 (Laughlin)
|
|
115
115
|
Release: 14
|
116
116
|
Codename: Laughlin
|
117
117
|
LSB_RELEASE
|
118
|
-
@plugin.
|
118
|
+
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should set lsb[:id]" do
|
122
122
|
@plugin.run
|
123
|
-
@plugin[:lsb][:id].
|
123
|
+
expect(@plugin[:lsb][:id]).to eq("Fedora")
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should set lsb[:release]" do
|
127
127
|
@plugin.run
|
128
|
-
@plugin[:lsb][:release].
|
128
|
+
expect(@plugin[:lsb][:release]).to eq("14")
|
129
129
|
end
|
130
130
|
|
131
131
|
it "should set lsb[:codename]" do
|
132
132
|
@plugin.run
|
133
|
-
@plugin[:lsb][:codename].
|
133
|
+
expect(@plugin[:lsb][:codename]).to eq("Laughlin")
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should set lsb[:description]" do
|
137
137
|
@plugin.run
|
138
|
-
@plugin[:lsb][:description].
|
138
|
+
expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
|
144
|
-
File.
|
145
|
-
File.
|
146
|
-
@plugin.attribute?(:lsb).
|
144
|
+
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(false)
|
145
|
+
allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(false)
|
146
|
+
expect(@plugin.attribute?(:lsb)).to be(false)
|
147
147
|
end
|
148
148
|
end
|
@@ -54,48 +54,48 @@ Working Devices : 6
|
|
54
54
|
5 8 112 5 active sync /dev/sdh
|
55
55
|
MD
|
56
56
|
@plugin = get_plugin("linux/mdadm")
|
57
|
-
@plugin.
|
57
|
+
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
58
58
|
@double_file = double("/proc/mdstat")
|
59
|
-
@double_file.
|
59
|
+
allow(@double_file).to receive(:each).
|
60
60
|
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]").
|
61
61
|
and_yield("md0 : active raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]").
|
62
62
|
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
63
|
-
File.
|
64
|
-
File.
|
65
|
-
@plugin.
|
63
|
+
allow(File).to receive(:open).with("/proc/mdstat").and_return(@double_file)
|
64
|
+
allow(File).to receive(:exist?).with("/proc/mdstat").and_return(true)
|
65
|
+
allow(@plugin).to receive(:shell_out).with("mdadm --detail /dev/md0").and_return(mock_shell_out(0, @md0, ""))
|
66
66
|
end
|
67
67
|
|
68
68
|
describe "gathering Mdadm information via /proc/mdstat and mdadm" do
|
69
69
|
|
70
70
|
it "should not raise an error" do
|
71
|
-
|
71
|
+
expect { @plugin.run }.not_to raise_error
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should detect raid level" do
|
75
75
|
@plugin.run
|
76
|
-
@plugin[:mdadm][:md0][:level].
|
76
|
+
expect(@plugin[:mdadm][:md0][:level]).to eq(10)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should detect raid state" do
|
80
80
|
@plugin.run
|
81
|
-
@plugin[:mdadm][:md0][:state].
|
81
|
+
expect(@plugin[:mdadm][:md0][:state]).to eq("clean")
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should detect raid size" do
|
85
85
|
@plugin.run
|
86
|
-
@plugin[:mdadm][:md0][:size].
|
86
|
+
expect(@plugin[:mdadm][:md0][:size]).to eq(2794.16)
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should detect raid metadata level" do
|
90
90
|
@plugin.run
|
91
|
-
@plugin[:mdadm][:md0][:version].
|
91
|
+
expect(@plugin[:mdadm][:md0][:version]).to eq(1.2)
|
92
92
|
end
|
93
93
|
|
94
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
|
98
|
-
@plugin[:mdadm][:md0][:device_counts][item].
|
98
|
+
expect(@plugin[:mdadm][:md0][:device_counts][item]).to eq(expected_value)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -23,20 +23,20 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|
23
23
|
describe Ohai::System, "Linux plugin platform" do
|
24
24
|
before(:each) do
|
25
25
|
@plugin = get_plugin("linux/platform")
|
26
|
-
@plugin.
|
26
|
+
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
27
27
|
@plugin[:lsb] = Mash.new
|
28
|
-
File.
|
29
|
-
File.
|
30
|
-
File.
|
31
|
-
File.
|
32
|
-
File.
|
33
|
-
File.
|
34
|
-
File.
|
35
|
-
File.
|
36
|
-
File.
|
37
|
-
File.
|
38
|
-
File.
|
39
|
-
File.
|
28
|
+
allow(File).to receive(:exists?).with("/etc/debian_version").and_return(false)
|
29
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(false)
|
30
|
+
allow(File).to receive(:exists?).with("/etc/gentoo-release").and_return(false)
|
31
|
+
allow(File).to receive(:exists?).with("/etc/exherbo-release").and_return(false)
|
32
|
+
allow(File).to receive(:exists?).with("/etc/SuSE-release").and_return(false)
|
33
|
+
allow(File).to receive(:exists?).with("/etc/arch-release").and_return(false)
|
34
|
+
allow(File).to receive(:exists?).with("/etc/system-release").and_return(false)
|
35
|
+
allow(File).to receive(:exists?).with("/etc/slackware-version").and_return(false)
|
36
|
+
allow(File).to receive(:exists?).with("/etc/enterprise-release").and_return(false)
|
37
|
+
allow(File).to receive(:exists?).with("/etc/oracle-release").and_return(false)
|
38
|
+
allow(File).to receive(:exists?).with("/etc/parallels-release").and_return(false)
|
39
|
+
allow(File).to receive(:exists?).with("/usr/bin/raspi-config").and_return(false)
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "on lsb compliant distributions" do
|
@@ -47,83 +47,83 @@ describe Ohai::System, "Linux plugin platform" do
|
|
47
47
|
|
48
48
|
it "should set platform to lowercased lsb[:id]" do
|
49
49
|
@plugin.run
|
50
|
-
@plugin[:platform].
|
50
|
+
expect(@plugin[:platform]).to eq("ubuntu")
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should set platform_version to lsb[:release]" do
|
54
54
|
@plugin.run
|
55
|
-
@plugin[:platform_version].
|
55
|
+
expect(@plugin[:platform_version]).to eq("8.04")
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should set platform to ubuntu and platform_family to debian [:lsb][:id] contains Ubuntu" do
|
59
59
|
@plugin[:lsb][:id] = "Ubuntu"
|
60
60
|
@plugin.run
|
61
|
-
@plugin[:platform].
|
62
|
-
@plugin[:platform_family].
|
61
|
+
expect(@plugin[:platform]).to eq("ubuntu")
|
62
|
+
expect(@plugin[:platform_family]).to eq("debian")
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should set platform to linuxmint and platform_family to debian [:lsb][:id] contains LinuxMint" do
|
66
66
|
@plugin[:lsb][:id] = "LinuxMint"
|
67
67
|
@plugin.run
|
68
|
-
@plugin[:platform].
|
69
|
-
@plugin[:platform_family].
|
68
|
+
expect(@plugin[:platform]).to eq("linuxmint")
|
69
|
+
expect(@plugin[:platform_family]).to eq("debian")
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should set platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
|
73
73
|
@plugin[:lsb][:id] = "Debian"
|
74
74
|
@plugin.run
|
75
|
-
@plugin[:platform].
|
76
|
-
@plugin[:platform_family].
|
75
|
+
expect(@plugin[:platform]).to eq("debian")
|
76
|
+
expect(@plugin[:platform_family]).to eq("debian")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should set platform to redhat and platform_family to rhel when [:lsb][:id] contains Redhat" do
|
80
80
|
@plugin[:lsb][:id] = "RedHatEnterpriseServer"
|
81
81
|
@plugin[:lsb][:release] = "5.7"
|
82
82
|
@plugin.run
|
83
|
-
@plugin[:platform].
|
84
|
-
@plugin[:platform_family].
|
83
|
+
expect(@plugin[:platform]).to eq("redhat")
|
84
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should set platform to amazon and platform_family to rhel when [:lsb][:id] contains Amazon" do
|
88
88
|
@plugin[:lsb][:id] = "AmazonAMI"
|
89
89
|
@plugin[:lsb][:release] = "2011.09"
|
90
90
|
@plugin.run
|
91
|
-
@plugin[:platform].
|
92
|
-
@plugin[:platform_family].
|
91
|
+
expect(@plugin[:platform]).to eq("amazon")
|
92
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should set platform to scientific when [:lsb][:id] contains ScientificSL" do
|
96
96
|
@plugin[:lsb][:id] = "ScientificSL"
|
97
97
|
@plugin[:lsb][:release] = "5.7"
|
98
98
|
@plugin.run
|
99
|
-
@plugin[:platform].
|
99
|
+
expect(@plugin[:platform]).to eq("scientific")
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should set platform to ibm_powerkvm and platform_family to rhel when [:lsb][:id] contains IBM_PowerKVM" do
|
103
103
|
@plugin[:lsb][:id] = "IBM_PowerKVM"
|
104
104
|
@plugin[:lsb][:release] = "2.1"
|
105
105
|
@plugin.run
|
106
|
-
@plugin[:platform].
|
107
|
-
@plugin[:platform_family].
|
106
|
+
expect(@plugin[:platform]).to eq("ibm_powerkvm")
|
107
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
describe "on debian" do
|
112
112
|
before(:each) do
|
113
113
|
@plugin.lsb = nil
|
114
|
-
File.
|
114
|
+
expect(File).to receive(:exists?).with("/etc/debian_version").and_return(true)
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should read the version from /etc/debian_version" do
|
118
|
-
File.
|
118
|
+
expect(File).to receive(:read).with("/etc/debian_version").and_return("5.0")
|
119
119
|
@plugin.run
|
120
|
-
@plugin[:platform_version].
|
120
|
+
expect(@plugin[:platform_version]).to eq("5.0")
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should correctly strip any newlines" do
|
124
|
-
File.
|
124
|
+
expect(File).to receive(:read).with("/etc/debian_version").and_return("5.0\n")
|
125
125
|
@plugin.run
|
126
|
-
@plugin[:platform_version].
|
126
|
+
expect(@plugin[:platform_version]).to eq("5.0")
|
127
127
|
end
|
128
128
|
|
129
129
|
# Ubuntu has /etc/debian_version as well
|
@@ -131,43 +131,43 @@ describe Ohai::System, "Linux plugin platform" do
|
|
131
131
|
@plugin[:lsb][:id] = "Ubuntu"
|
132
132
|
@plugin[:lsb][:release] = "8.04"
|
133
133
|
@plugin.run
|
134
|
-
@plugin[:platform].
|
134
|
+
expect(@plugin[:platform]).to eq("ubuntu")
|
135
135
|
end
|
136
136
|
|
137
137
|
# Raspbian is a debian clone
|
138
138
|
it "should detect Raspbian as itself with debian as the family" do
|
139
|
-
File.
|
140
|
-
File.
|
139
|
+
expect(File).to receive(:exists?).with("/usr/bin/raspi-config").and_return(true)
|
140
|
+
expect(File).to receive(:read).with("/etc/debian_version").and_return("wheezy/sid")
|
141
141
|
@plugin.run
|
142
|
-
@plugin[:platform].
|
143
|
-
@plugin[:platform_family].
|
142
|
+
expect(@plugin[:platform]).to eq("raspbian")
|
143
|
+
expect(@plugin[:platform_family]).to eq("debian")
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
describe "on slackware" do
|
148
148
|
before(:each) do
|
149
149
|
@plugin.lsb = nil
|
150
|
-
File.
|
150
|
+
expect(File).to receive(:exists?).with("/etc/slackware-version").and_return(true)
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should set platform and platform_family to slackware" do
|
154
|
-
File.
|
154
|
+
expect(File).to receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
|
155
155
|
@plugin.run
|
156
|
-
@plugin[:platform].
|
157
|
-
@plugin[:platform_family].
|
156
|
+
expect(@plugin[:platform]).to eq("slackware")
|
157
|
+
expect(@plugin[:platform_family]).to eq("slackware")
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
161
|
describe "on arch" do
|
162
162
|
before(:each) do
|
163
163
|
@plugin.lsb = nil
|
164
|
-
File.
|
164
|
+
expect(File).to receive(:exists?).with("/etc/arch-release").and_return(true)
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should set platform to arch and platform_family to arch" do
|
168
168
|
@plugin.run
|
169
|
-
@plugin[:platform].
|
170
|
-
@plugin[:platform_family].
|
169
|
+
expect(@plugin[:platform]).to eq("arch")
|
170
|
+
expect(@plugin[:platform_family]).to eq("arch")
|
171
171
|
end
|
172
172
|
|
173
173
|
end
|
@@ -175,27 +175,27 @@ describe Ohai::System, "Linux plugin platform" do
|
|
175
175
|
describe "on gentoo" do
|
176
176
|
before(:each) do
|
177
177
|
@plugin.lsb = nil
|
178
|
-
File.
|
178
|
+
expect(File).to receive(:exists?).with("/etc/gentoo-release").and_return(true)
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should set platform and platform_family to gentoo" do
|
182
|
-
File.
|
182
|
+
expect(File).to receive(:read).with("/etc/gentoo-release").and_return("Gentoo Base System release 1.20.1.1")
|
183
183
|
@plugin.run
|
184
|
-
@plugin[:platform].
|
185
|
-
@plugin[:platform_family].
|
184
|
+
expect(@plugin[:platform]).to eq("gentoo")
|
185
|
+
expect(@plugin[:platform_family]).to eq("gentoo")
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
189
|
describe "on exherbo" do
|
190
190
|
before(:each) do
|
191
191
|
@plugin.lsb = nil
|
192
|
-
File.
|
192
|
+
expect(File).to receive(:exists?).with("/etc/exherbo-release").and_return(true)
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should set platform and platform_family to exherbo" do
|
196
196
|
@plugin.run
|
197
|
-
@plugin[:platform].
|
198
|
-
@plugin[:platform_family].
|
197
|
+
expect(@plugin[:platform]).to eq("exherbo")
|
198
|
+
expect(@plugin[:platform_family]).to eq("exherbo")
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
@@ -205,96 +205,96 @@ describe Ohai::System, "Linux plugin platform" do
|
|
205
205
|
@plugin[:lsb][:id] = "RedHatEnterpriseServer"
|
206
206
|
@plugin[:lsb][:release] = "6.1"
|
207
207
|
@plugin.run
|
208
|
-
@plugin[:platform].
|
209
|
-
@plugin[:platform_version].
|
210
|
-
@plugin[:platform_family].
|
208
|
+
expect(@plugin[:platform]).to eq("redhat")
|
209
|
+
expect(@plugin[:platform_version]).to eq("6.1")
|
210
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
211
211
|
end
|
212
212
|
|
213
213
|
it "should set the platform to centos and platform_family to rhel" do
|
214
214
|
@plugin[:lsb][:id] = "CentOS"
|
215
215
|
@plugin[:lsb][:release] = "5.4"
|
216
216
|
@plugin.run
|
217
|
-
@plugin[:platform].
|
218
|
-
@plugin[:platform_version].
|
219
|
-
@plugin[:platform_family].
|
217
|
+
expect(@plugin[:platform]).to eq("centos")
|
218
|
+
expect(@plugin[:platform_version]).to eq("5.4")
|
219
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
220
220
|
end
|
221
221
|
|
222
222
|
it "should set the platform_family to rhel if the LSB name is oracle-ish" do
|
223
223
|
@plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
|
224
224
|
@plugin.run
|
225
|
-
@plugin[:platform_family].
|
225
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
226
226
|
end
|
227
227
|
|
228
228
|
it "should set the platform_family to rhel if the LSB name is amazon-ish" do
|
229
229
|
@plugin[:lsb][:id] = "Amazon"
|
230
230
|
@plugin.run
|
231
|
-
@plugin[:platform_family].
|
231
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should set the platform_family to fedora if the LSB name is fedora-ish" do
|
235
235
|
@plugin[:lsb][:id] = "Fedora"
|
236
236
|
@plugin.run
|
237
|
-
@plugin[:platform_family].
|
237
|
+
expect(@plugin[:platform_family]).to eq("fedora")
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should set the platform_family to redhat if the LSB name is scientific-ish" do
|
241
241
|
@plugin[:lsb][:id] = "Scientific"
|
242
242
|
@plugin.run
|
243
|
-
@plugin[:platform_family].
|
243
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should set the platform_family to redhat if the LSB name is ibm-ish" do
|
247
247
|
@plugin[:lsb][:id] = "IBM_PowerKVM"
|
248
248
|
@plugin.run
|
249
|
-
@plugin[:platform_family].
|
249
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
253
|
describe "without lsb_release results" do
|
254
254
|
before(:each) do
|
255
255
|
@plugin.lsb = nil
|
256
|
-
File.
|
256
|
+
expect(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
257
257
|
end
|
258
258
|
|
259
259
|
it "should read the platform as centos and version as 5.3" do
|
260
|
-
File.
|
260
|
+
expect(File).to receive(:read).with("/etc/redhat-release").and_return("CentOS release 5.3")
|
261
261
|
@plugin.run
|
262
|
-
@plugin[:platform].
|
262
|
+
expect(@plugin[:platform]).to eq("centos")
|
263
263
|
end
|
264
264
|
|
265
265
|
it "may be that someone munged Red Hat to be RedHat" do
|
266
|
-
File.
|
266
|
+
expect(File).to receive(:read).with("/etc/redhat-release").and_return("RedHat release 5.3")
|
267
267
|
@plugin.run
|
268
|
-
@plugin[:platform].
|
269
|
-
@plugin[:platform_version].
|
268
|
+
expect(@plugin[:platform]).to eq("redhat")
|
269
|
+
expect(@plugin[:platform_version]).to eq("5.3")
|
270
270
|
end
|
271
271
|
|
272
272
|
it "should read the platform as redhat and version as 5.3" do
|
273
|
-
File.
|
273
|
+
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat release 5.3")
|
274
274
|
@plugin.run
|
275
|
-
@plugin[:platform].
|
276
|
-
@plugin[:platform_version].
|
275
|
+
expect(@plugin[:platform]).to eq("redhat")
|
276
|
+
expect(@plugin[:platform_version]).to eq("5.3")
|
277
277
|
end
|
278
278
|
|
279
279
|
it "should read the platform as fedora and version as 13 (rawhide)" do
|
280
|
-
File.
|
280
|
+
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
|
281
281
|
@plugin.run
|
282
|
-
@plugin[:platform].
|
283
|
-
@plugin[:platform_version].
|
282
|
+
expect(@plugin[:platform]).to eq("fedora")
|
283
|
+
expect(@plugin[:platform_version]).to eq("13 (rawhide)")
|
284
284
|
end
|
285
285
|
|
286
286
|
it "should read the platform as fedora and version as 10" do
|
287
|
-
File.
|
287
|
+
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 10")
|
288
288
|
@plugin.run
|
289
|
-
@plugin[:platform].
|
290
|
-
@plugin[:platform_version].
|
289
|
+
expect(@plugin[:platform]).to eq("fedora")
|
290
|
+
expect(@plugin[:platform_version]).to eq("10")
|
291
291
|
end
|
292
292
|
|
293
293
|
it "should read the platform as fedora and version as 13 using to_i" do
|
294
|
-
File.
|
294
|
+
expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
|
295
295
|
@plugin.run
|
296
|
-
@plugin[:platform].
|
297
|
-
@plugin[:platform_version].to_i.
|
296
|
+
expect(@plugin[:platform]).to eq("fedora")
|
297
|
+
expect(@plugin[:platform_version].to_i).to eq(13)
|
298
298
|
end
|
299
299
|
|
300
300
|
end
|
@@ -305,14 +305,14 @@ describe Ohai::System, "Linux plugin platform" do
|
|
305
305
|
it "should read the platform as parallels and version as 6.0.5" do
|
306
306
|
@plugin[:lsb][:id] = "CloudLinuxServer"
|
307
307
|
@plugin[:lsb][:release] = "6.5"
|
308
|
-
File.
|
309
|
-
File.
|
310
|
-
File.
|
311
|
-
File.
|
308
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
309
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
|
310
|
+
expect(File).to receive(:exists?).with("/etc/parallels-release").and_return(true)
|
311
|
+
expect(File).to receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
|
312
312
|
@plugin.run
|
313
|
-
@plugin[:platform].
|
314
|
-
@plugin[:platform_version].
|
315
|
-
@plugin[:platform_family].
|
313
|
+
expect(@plugin[:platform]).to eq("parallels")
|
314
|
+
expect(@plugin[:platform_version]).to eq("6.0.5")
|
315
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
316
316
|
end
|
317
317
|
end
|
318
318
|
|
@@ -322,14 +322,14 @@ describe Ohai::System, "Linux plugin platform" do
|
|
322
322
|
end
|
323
323
|
|
324
324
|
it "should read the platform as parallels and version as 6.0.5" do
|
325
|
-
File.
|
326
|
-
File.
|
327
|
-
File.
|
328
|
-
File.
|
325
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
326
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
|
327
|
+
expect(File).to receive(:exists?).with("/etc/parallels-release").and_return(true)
|
328
|
+
expect(File).to receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
|
329
329
|
@plugin.run
|
330
|
-
@plugin[:platform].
|
331
|
-
@plugin[:platform_version].
|
332
|
-
@plugin[:platform_family].
|
330
|
+
expect(@plugin[:platform]).to eq("parallels")
|
331
|
+
expect(@plugin[:platform_version]).to eq("6.0.5")
|
332
|
+
expect(@plugin[:platform_family]).to eq("rhel")
|
333
333
|
end
|
334
334
|
end
|
335
335
|
end
|
@@ -339,25 +339,25 @@ describe Ohai::System, "Linux plugin platform" do
|
|
339
339
|
it "should read the platform as oracle and version as 5.7" do
|
340
340
|
@plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
|
341
341
|
@plugin[:lsb][:release] = "5.7"
|
342
|
-
File.
|
343
|
-
File.
|
344
|
-
File.
|
345
|
-
File.
|
342
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
343
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
|
344
|
+
expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
|
345
|
+
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
|
346
346
|
@plugin.run
|
347
|
-
@plugin[:platform].
|
348
|
-
@plugin[:platform_version].
|
347
|
+
expect(@plugin[:platform]).to eq("oracle")
|
348
|
+
expect(@plugin[:platform_version]).to eq("5.7")
|
349
349
|
end
|
350
350
|
|
351
351
|
it "should read the platform as oracle and version as 6.1" do
|
352
352
|
@plugin[:lsb][:id] = "OracleServer"
|
353
353
|
@plugin[:lsb][:release] = "6.1"
|
354
|
-
File.
|
355
|
-
File.
|
356
|
-
File.
|
357
|
-
File.
|
354
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
355
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
|
356
|
+
expect(File).to receive(:exists?).with("/etc/oracle-release").and_return(true)
|
357
|
+
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
|
358
358
|
@plugin.run
|
359
|
-
@plugin[:platform].
|
360
|
-
@plugin[:platform_version].
|
359
|
+
expect(@plugin[:platform]).to eq("oracle")
|
360
|
+
expect(@plugin[:platform_version]).to eq("6.1")
|
361
361
|
end
|
362
362
|
end
|
363
363
|
|
@@ -367,60 +367,60 @@ describe Ohai::System, "Linux plugin platform" do
|
|
367
367
|
end
|
368
368
|
|
369
369
|
it "should read the platform as oracle and version as 5" do
|
370
|
-
File.
|
371
|
-
File.
|
372
|
-
File.
|
373
|
-
File.
|
370
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
371
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
|
372
|
+
expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
|
373
|
+
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
|
374
374
|
@plugin.run
|
375
|
-
@plugin[:platform].
|
376
|
-
@plugin[:platform_version].
|
375
|
+
expect(@plugin[:platform]).to eq("oracle")
|
376
|
+
expect(@plugin[:platform_version]).to eq("5")
|
377
377
|
end
|
378
378
|
|
379
379
|
it "should read the platform as oracle and version as 5.1" do
|
380
|
-
File.
|
381
|
-
File.
|
382
|
-
File.
|
383
|
-
File.
|
380
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
381
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
|
382
|
+
expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
|
383
|
+
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
|
384
384
|
@plugin.run
|
385
|
-
@plugin[:platform].
|
386
|
-
@plugin[:platform_version].
|
385
|
+
expect(@plugin[:platform]).to eq("oracle")
|
386
|
+
expect(@plugin[:platform_version]).to eq("5.1")
|
387
387
|
end
|
388
388
|
|
389
389
|
it "should read the platform as oracle and version as 5.7" do
|
390
|
-
File.
|
391
|
-
File.
|
392
|
-
File.
|
393
|
-
File.
|
390
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
391
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
|
392
|
+
expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
|
393
|
+
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
|
394
394
|
@plugin.run
|
395
|
-
@plugin[:platform].
|
396
|
-
@plugin[:platform_version].
|
395
|
+
expect(@plugin[:platform]).to eq("oracle")
|
396
|
+
expect(@plugin[:platform_version]).to eq("5.7")
|
397
397
|
end
|
398
398
|
|
399
399
|
it "should read the platform as oracle and version as 6.0" do
|
400
|
-
File.
|
401
|
-
File.
|
402
|
-
File.
|
403
|
-
File.
|
400
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
401
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
|
402
|
+
expect(File).to receive(:exists?).with("/etc/oracle-release").and_return(true)
|
403
|
+
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.0")
|
404
404
|
@plugin.run
|
405
|
-
@plugin[:platform].
|
406
|
-
@plugin[:platform_version].
|
405
|
+
expect(@plugin[:platform]).to eq("oracle")
|
406
|
+
expect(@plugin[:platform_version]).to eq("6.0")
|
407
407
|
end
|
408
408
|
|
409
409
|
it "should read the platform as oracle and version as 6.1" do
|
410
|
-
File.
|
411
|
-
File.
|
412
|
-
File.
|
413
|
-
File.
|
410
|
+
allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
|
411
|
+
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
|
412
|
+
expect(File).to receive(:exists?).with("/etc/oracle-release").and_return(true)
|
413
|
+
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
|
414
414
|
@plugin.run
|
415
|
-
@plugin[:platform].
|
416
|
-
@plugin[:platform_version].
|
415
|
+
expect(@plugin[:platform]).to eq("oracle")
|
416
|
+
expect(@plugin[:platform_version]).to eq("6.1")
|
417
417
|
end
|
418
418
|
end
|
419
419
|
end
|
420
420
|
|
421
421
|
describe "on suse" do
|
422
422
|
before(:each) do
|
423
|
-
File.
|
423
|
+
expect(File).to receive(:exists?).with("/etc/SuSE-release").and_return(true)
|
424
424
|
end
|
425
425
|
|
426
426
|
describe "with lsb_release results" do
|
@@ -430,10 +430,10 @@ describe Ohai::System, "Linux plugin platform" do
|
|
430
430
|
|
431
431
|
it "should read the platform as opensuse on openSUSE" do
|
432
432
|
@plugin[:lsb][:release] = "12.1"
|
433
|
-
File.
|
433
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
|
434
434
|
@plugin.run
|
435
|
-
@plugin[:platform].
|
436
|
-
@plugin[:platform_family].
|
435
|
+
expect(@plugin[:platform]).to eq("opensuse")
|
436
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
437
437
|
end
|
438
438
|
end
|
439
439
|
|
@@ -443,57 +443,57 @@ describe Ohai::System, "Linux plugin platform" do
|
|
443
443
|
end
|
444
444
|
|
445
445
|
it "should set platform and platform_family to suse and bogus verion to 10.0" do
|
446
|
-
File.
|
446
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
|
447
447
|
@plugin.run
|
448
|
-
@plugin[:platform].
|
449
|
-
@plugin[:platform_family].
|
448
|
+
expect(@plugin[:platform]).to eq("suse")
|
449
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
450
450
|
end
|
451
451
|
|
452
452
|
it "should read the version as 10.1 for bogus SLES 10" do
|
453
|
-
File.
|
453
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
|
454
454
|
@plugin.run
|
455
|
-
@plugin[:platform].
|
456
|
-
@plugin[:platform_version].
|
457
|
-
@plugin[:platform_family].
|
455
|
+
expect(@plugin[:platform]).to eq("suse")
|
456
|
+
expect(@plugin[:platform_version]).to eq("10.1")
|
457
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
458
458
|
end
|
459
459
|
|
460
460
|
it "should read the version as 11.2" do
|
461
|
-
File.
|
461
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
|
462
462
|
@plugin.run
|
463
|
-
@plugin[:platform].
|
464
|
-
@plugin[:platform_version].
|
465
|
-
@plugin[:platform_family].
|
463
|
+
expect(@plugin[:platform]).to eq("suse")
|
464
|
+
expect(@plugin[:platform_version]).to eq("11.2")
|
465
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
466
466
|
end
|
467
467
|
|
468
468
|
it "[OHAI-272] should read the version as 11.3" do
|
469
|
-
File.
|
469
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
|
470
470
|
@plugin.run
|
471
|
-
@plugin[:platform].
|
472
|
-
@plugin[:platform_version].
|
473
|
-
@plugin[:platform_family].
|
471
|
+
expect(@plugin[:platform]).to eq("opensuse")
|
472
|
+
expect(@plugin[:platform_version]).to eq("11.3")
|
473
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
474
474
|
end
|
475
475
|
|
476
476
|
it "[OHAI-272] should read the version as 9.1" do
|
477
|
-
File.
|
477
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
|
478
478
|
@plugin.run
|
479
|
-
@plugin[:platform].
|
480
|
-
@plugin[:platform_version].
|
481
|
-
@plugin[:platform_family].
|
479
|
+
expect(@plugin[:platform]).to eq("suse")
|
480
|
+
expect(@plugin[:platform_version]).to eq("9.1")
|
481
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
482
482
|
end
|
483
483
|
|
484
484
|
it "[OHAI-272] should read the version as 11.4" do
|
485
|
-
File.
|
485
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
|
486
486
|
@plugin.run
|
487
|
-
@plugin[:platform].
|
488
|
-
@plugin[:platform_version].
|
489
|
-
@plugin[:platform_family].
|
487
|
+
expect(@plugin[:platform]).to eq("opensuse")
|
488
|
+
expect(@plugin[:platform_version]).to eq("11.4")
|
489
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
490
490
|
end
|
491
491
|
|
492
492
|
it "should read the platform as opensuse on openSUSE" do
|
493
|
-
File.
|
493
|
+
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
|
494
494
|
@plugin.run
|
495
|
-
@plugin[:platform].
|
496
|
-
@plugin[:platform_family].
|
495
|
+
expect(@plugin[:platform]).to eq("opensuse")
|
496
|
+
expect(@plugin[:platform_family]).to eq("suse")
|
497
497
|
end
|
498
498
|
end
|
499
499
|
end
|