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.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ohai/version.rb +1 -1
  3. data/spec/functional/plugins/powershell_spec.rb +4 -4
  4. data/spec/functional/plugins/root_group_spec.rb +1 -1
  5. data/spec/ohai_spec.rb +1 -1
  6. data/spec/spec_helper.rb +12 -12
  7. data/spec/unit/dsl/plugin_spec.rb +40 -40
  8. data/spec/unit/hints_spec.rb +3 -3
  9. data/spec/unit/loader_spec.rb +16 -16
  10. data/spec/unit/mixin/cloudstack_metadata_spec.rb +1 -1
  11. data/spec/unit/mixin/command_spec.rb +6 -6
  12. data/spec/unit/mixin/ec2_metadata_spec.rb +8 -8
  13. data/spec/unit/plugins/aix/cpu_spec.rb +15 -15
  14. data/spec/unit/plugins/aix/filesystem_spec.rb +15 -15
  15. data/spec/unit/plugins/aix/hostname_spec.rb +3 -3
  16. data/spec/unit/plugins/aix/kernel_spec.rb +14 -14
  17. data/spec/unit/plugins/aix/network_spec.rb +43 -43
  18. data/spec/unit/plugins/aix/platform_spec.rb +5 -5
  19. data/spec/unit/plugins/aix/uptime_spec.rb +7 -7
  20. data/spec/unit/plugins/aix/virtualization_spec.rb +3 -3
  21. data/spec/unit/plugins/azure_spec.rb +18 -18
  22. data/spec/unit/plugins/c_spec.rb +52 -52
  23. data/spec/unit/plugins/chef_spec.rb +1 -1
  24. data/spec/unit/plugins/cloud_spec.rb +31 -31
  25. data/spec/unit/plugins/cloud_v2_spec.rb +33 -33
  26. data/spec/unit/plugins/cloudstack_spec.rb +6 -6
  27. data/spec/unit/plugins/darwin/cpu_spec.rb +19 -19
  28. data/spec/unit/plugins/darwin/hostname_spec.rb +6 -6
  29. data/spec/unit/plugins/darwin/kernel_spec.rb +14 -14
  30. data/spec/unit/plugins/darwin/memory_spec.rb +7 -7
  31. data/spec/unit/plugins/darwin/network_spec.rb +358 -358
  32. data/spec/unit/plugins/darwin/platform_spec.rb +10 -10
  33. data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
  34. data/spec/unit/plugins/dmi_spec.rb +3 -3
  35. data/spec/unit/plugins/ec2_spec.rb +80 -80
  36. data/spec/unit/plugins/erlang_spec.rb +7 -7
  37. data/spec/unit/plugins/eucalyptus_spec.rb +28 -28
  38. data/spec/unit/plugins/fail_spec.rb +8 -8
  39. data/spec/unit/plugins/freebsd/cpu_spec.rb +10 -10
  40. data/spec/unit/plugins/freebsd/hostname_spec.rb +4 -4
  41. data/spec/unit/plugins/freebsd/kernel_spec.rb +6 -6
  42. data/spec/unit/plugins/freebsd/os_spec.rb +3 -3
  43. data/spec/unit/plugins/freebsd/platform_spec.rb +5 -5
  44. data/spec/unit/plugins/freebsd/virtualization_spec.rb +20 -20
  45. data/spec/unit/plugins/gce_spec.rb +18 -18
  46. data/spec/unit/plugins/go_spec.rb +5 -5
  47. data/spec/unit/plugins/groovy_spec.rb +5 -5
  48. data/spec/unit/plugins/hostname_spec.rb +24 -24
  49. data/spec/unit/plugins/init_package_spec.rb +5 -5
  50. data/spec/unit/plugins/ip_scopes_spec.rb +1 -1
  51. data/spec/unit/plugins/java_spec.rb +23 -23
  52. data/spec/unit/plugins/joyent_spec.rb +13 -13
  53. data/spec/unit/plugins/kernel_spec.rb +20 -20
  54. data/spec/unit/plugins/linode_spec.rb +18 -18
  55. data/spec/unit/plugins/linux/cpu_spec.rb +25 -25
  56. data/spec/unit/plugins/linux/filesystem_spec.rb +61 -60
  57. data/spec/unit/plugins/linux/hostname_spec.rb +7 -7
  58. data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
  59. data/spec/unit/plugins/linux/lsb_spec.rb +23 -23
  60. data/spec/unit/plugins/linux/mdadm_spec.rb +11 -11
  61. data/spec/unit/plugins/linux/platform_spec.rb +167 -167
  62. data/spec/unit/plugins/linux/uptime_spec.rb +6 -6
  63. data/spec/unit/plugins/linux/virtualization_spec.rb +156 -156
  64. data/spec/unit/plugins/lua_spec.rb +5 -5
  65. data/spec/unit/plugins/mono_spec.rb +5 -5
  66. data/spec/unit/plugins/netbsd/hostname_spec.rb +6 -6
  67. data/spec/unit/plugins/netbsd/kernel_spec.rb +6 -6
  68. data/spec/unit/plugins/netbsd/platform_spec.rb +5 -5
  69. data/spec/unit/plugins/network_spec.rb +116 -116
  70. data/spec/unit/plugins/nodejs_spec.rb +5 -5
  71. data/spec/unit/plugins/ohai_spec.rb +1 -1
  72. data/spec/unit/plugins/ohai_time_spec.rb +5 -5
  73. data/spec/unit/plugins/openbsd/hostname_spec.rb +6 -6
  74. data/spec/unit/plugins/openbsd/kernel_spec.rb +6 -6
  75. data/spec/unit/plugins/openbsd/platform_spec.rb +4 -4
  76. data/spec/unit/plugins/openstack_spec.rb +8 -8
  77. data/spec/unit/plugins/os_spec.rb +5 -5
  78. data/spec/unit/plugins/passwd_spec.rb +13 -13
  79. data/spec/unit/plugins/perl_spec.rb +8 -8
  80. data/spec/unit/plugins/php_spec.rb +7 -7
  81. data/spec/unit/plugins/platform_spec.rb +9 -9
  82. data/spec/unit/plugins/powershell_spec.rb +10 -10
  83. data/spec/unit/plugins/rackspace_spec.rb +72 -70
  84. data/spec/unit/plugins/root_group_spec.rb +14 -14
  85. data/spec/unit/plugins/ruby_spec.rb +1 -1
  86. data/spec/unit/plugins/sigar/network_route_spec.rb +17 -17
  87. data/spec/unit/plugins/solaris2/cpu_spec.rb +18 -18
  88. data/spec/unit/plugins/solaris2/hostname_spec.rb +4 -4
  89. data/spec/unit/plugins/solaris2/kernel_spec.rb +8 -8
  90. data/spec/unit/plugins/solaris2/memory_spec.rb +3 -3
  91. data/spec/unit/plugins/solaris2/network_spec.rb +13 -13
  92. data/spec/unit/plugins/solaris2/platform_spec.rb +14 -14
  93. data/spec/unit/plugins/solaris2/virtualization_spec.rb +24 -24
  94. data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
  95. data/spec/unit/plugins/ssh_host_keys_spec.rb +18 -18
  96. data/spec/unit/runner_spec.rb +26 -26
  97. data/spec/unit/system_spec.rb +54 -54
  98. data/spec/unit/util/file_helper_spec.rb +2 -2
  99. metadata +50 -95
@@ -47,27 +47,27 @@ describe "CloudAttrs object" do
47
47
  @cloud_attr_obj.public_hostname = "myhost.somewhere.com"
48
48
  @cloud_attr_obj.local_hostname = "my-localhost"
49
49
  @cloud_attr_obj.provider = "my_awesome_cloud"
50
- @cloud_attr_obj.cloud_mash.should == cloud_node
50
+ expect(@cloud_attr_obj.cloud_mash).to eq(cloud_node)
51
51
  end
52
52
 
53
53
  it "throws exception with a bad ipv4 address" do
54
54
  @cloud_attr_obj = ::CloudAttrs.new()
55
- lambda { @cloud_attr_obj.add_ipv6_addr("somebogusstring", :public) }.should raise_error
55
+ expect { @cloud_attr_obj.add_ipv6_addr("somebogusstring", :public) }.to raise_error
56
56
  end
57
57
 
58
58
  it "throws exception with a bad ipv6 address" do
59
59
  @cloud_attr_obj = ::CloudAttrs.new()
60
- lambda { @cloud_attr_obj.add_ipv6_addr("FEED:B0B:DEAD:BEEF", :public) }.should raise_error
60
+ expect { @cloud_attr_obj.add_ipv6_addr("FEED:B0B:DEAD:BEEF", :public) }.to raise_error
61
61
  end
62
62
 
63
63
  it "throws exception with ipv6 address passed to ipv4" do
64
64
  @cloud_attr_obj = ::CloudAttrs.new()
65
- lambda { @cloud_attr_obj.add_ipv4_addr("3ffe:506:2::1", :public) }.should raise_error
65
+ expect { @cloud_attr_obj.add_ipv4_addr("3ffe:506:2::1", :public) }.to raise_error
66
66
  end
67
67
 
68
68
  it "throws exception with ipv4 address passed to ipv6" do
69
69
  @cloud_attr_obj = ::CloudAttrs.new()
70
- lambda { @cloud_attr_obj.add_ipv6_addr("1.2.3.4", :public) }.should raise_error
70
+ expect { @cloud_attr_obj.add_ipv6_addr("1.2.3.4", :public) }.to raise_error
71
71
  end
72
72
 
73
73
 
@@ -87,7 +87,7 @@ describe Ohai::System, "plugin cloud" do
87
87
  @plugin[:azure] = nil
88
88
  @plugin[:gce] = nil
89
89
  @plugin.run
90
- @plugin[:cloud_v2].should be_nil
90
+ expect(@plugin[:cloud_v2]).to be_nil
91
91
  end
92
92
  end
93
93
 
@@ -99,18 +99,18 @@ describe Ohai::System, "plugin cloud" do
99
99
  it "populates cloud public ip" do
100
100
  @plugin[:ec2]['public_ipv4'] = "174.129.150.8"
101
101
  @plugin.run
102
- @plugin[:cloud_v2][:public_ipv4_addrs][0].should == @plugin[:ec2]['public_ipv4']
102
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:ec2]['public_ipv4'])
103
103
  end
104
104
 
105
105
  it "populates cloud private ip" do
106
106
  @plugin[:ec2]['local_ipv4'] = "10.252.42.149"
107
107
  @plugin.run
108
- @plugin[:cloud_v2][:local_ipv4_addrs][0].should == @plugin[:ec2]['local_ipv4']
108
+ expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:ec2]['local_ipv4'])
109
109
  end
110
110
 
111
111
  it "populates cloud provider" do
112
112
  @plugin.run
113
- @plugin[:cloud_v2][:provider].should == "ec2"
113
+ expect(@plugin[:cloud_v2][:provider]).to eq("ec2")
114
114
  end
115
115
  end
116
116
 
@@ -129,17 +129,17 @@ describe Ohai::System, "plugin cloud" do
129
129
 
130
130
  it "populates cloud public ip" do
131
131
  @plugin.run
132
- @plugin[:cloud_v2][:public_ipv4_addrs][0].should == "8.35.198.173"
132
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq("8.35.198.173")
133
133
  end
134
134
 
135
135
  it "populates cloud private ip" do
136
136
  @plugin.run
137
- @plugin[:cloud_v2][:local_ipv4_addrs][0].should == "10.240.0.102"
137
+ expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq("10.240.0.102")
138
138
  end
139
139
 
140
140
  it "populates cloud provider" do
141
141
  @plugin.run
142
- @plugin[:cloud_v2][:provider].should == "gce"
142
+ expect(@plugin[:cloud_v2][:provider]).to eq("gce")
143
143
  end
144
144
  end
145
145
 
@@ -151,42 +151,42 @@ describe Ohai::System, "plugin cloud" do
151
151
  it "populates cloud public ip" do
152
152
  @plugin[:rackspace][:public_ipv4] = "174.129.150.8"
153
153
  @plugin.run
154
- @plugin[:cloud_v2][:public_ipv4].should == @plugin[:rackspace][:public_ipv4]
154
+ expect(@plugin[:cloud_v2][:public_ipv4]).to eq(@plugin[:rackspace][:public_ipv4])
155
155
  end
156
156
 
157
157
  it "populates cloud public ipv6" do
158
158
  @plugin[:rackspace][:public_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
159
159
  @plugin.run
160
- @plugin[:cloud_v2][:public_ipv6].should == @plugin[:rackspace][:public_ipv6]
160
+ expect(@plugin[:cloud_v2][:public_ipv6]).to eq(@plugin[:rackspace][:public_ipv6])
161
161
  end
162
162
 
163
163
  it "populates cloud private ip" do
164
164
  @plugin[:rackspace][:local_ipv4] = "10.252.42.149"
165
165
  @plugin.run
166
- @plugin[:cloud_v2][:local_ipv4].should == @plugin[:rackspace][:local_ipv4]
166
+ expect(@plugin[:cloud_v2][:local_ipv4]).to eq(@plugin[:rackspace][:local_ipv4])
167
167
  end
168
168
 
169
169
  it "populates cloud private ipv6" do
170
170
  @plugin[:rackspace][:local_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
171
171
  @plugin.run
172
- @plugin[:cloud_v2][:local_ipv6].should == @plugin[:rackspace][:local_ipv6]
172
+ expect(@plugin[:cloud_v2][:local_ipv6]).to eq(@plugin[:rackspace][:local_ipv6])
173
173
  end
174
174
 
175
175
  it "populates first cloud public ip" do
176
176
  @plugin[:rackspace][:public_ipv4] = "174.129.150.8"
177
177
  @plugin.run
178
- @plugin[:cloud_v2][:public_ipv4_addrs].first.should == @plugin[:rackspace][:public_ipv4]
178
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs].first).to eq(@plugin[:rackspace][:public_ipv4])
179
179
  end
180
180
 
181
181
  it "populates first cloud public ip" do
182
182
  @plugin[:rackspace][:local_ipv4] = "174.129.150.8"
183
183
  @plugin.run
184
- @plugin[:cloud_v2][:local_ipv4_addrs].first.should == @plugin[:rackspace][:local_ipv4]
184
+ expect(@plugin[:cloud_v2][:local_ipv4_addrs].first).to eq(@plugin[:rackspace][:local_ipv4])
185
185
  end
186
186
 
187
187
  it "populates cloud provider" do
188
188
  @plugin.run
189
- @plugin[:cloud_v2][:provider].should == "rackspace"
189
+ expect(@plugin[:cloud_v2][:provider]).to eq("rackspace")
190
190
  end
191
191
  end
192
192
 
@@ -198,24 +198,24 @@ describe Ohai::System, "plugin cloud" do
198
198
  it "populates cloud public ip" do
199
199
  @plugin[:linode]['public_ip'] = "174.129.150.8"
200
200
  @plugin.run
201
- @plugin[:cloud_v2][:public_ipv4_addrs][0].should == @plugin[:linode][:public_ip]
201
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:linode][:public_ip])
202
202
  end
203
203
 
204
204
  it "populates cloud private ip" do
205
205
  @plugin[:linode]['private_ip'] = "10.252.42.149"
206
206
  @plugin.run
207
- @plugin[:cloud_v2][:local_ipv4_addrs][0].should == @plugin[:linode][:private_ip]
207
+ expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:linode][:private_ip])
208
208
  end
209
209
 
210
210
  it "populates first cloud public ip" do
211
211
  @plugin[:linode]['public_ip'] = "174.129.150.8"
212
212
  @plugin.run
213
- @plugin[:cloud_v2][:public_ipv4_addrs].first.should == @plugin[:linode][:public_ip]
213
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs].first).to eq(@plugin[:linode][:public_ip])
214
214
  end
215
215
 
216
216
  it "populates cloud provider" do
217
217
  @plugin.run
218
- @plugin[:cloud_v2][:provider].should == "linode"
218
+ expect(@plugin[:cloud_v2][:provider]).to eq("linode")
219
219
  end
220
220
  end
221
221
 
@@ -227,18 +227,18 @@ describe Ohai::System, "plugin cloud" do
227
227
  it "populates cloud public ip" do
228
228
  @plugin[:eucalyptus]['public_ipv4'] = "174.129.150.8"
229
229
  @plugin.run
230
- @plugin[:cloud_v2][:public_ipv4_addrs][0].should == @plugin[:eucalyptus]['public_ipv4']
230
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:eucalyptus]['public_ipv4'])
231
231
  end
232
232
 
233
233
  it "populates cloud private ip" do
234
234
  @plugin[:eucalyptus]['local_ipv4'] = "10.252.42.149"
235
235
  @plugin.run
236
- @plugin[:cloud_v2][:local_ipv4_addrs][0].should == @plugin[:eucalyptus]['local_ipv4']
236
+ expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:eucalyptus]['local_ipv4'])
237
237
  end
238
238
 
239
239
  it "populates cloud provider" do
240
240
  @plugin.run
241
- @plugin[:cloud_v2][:provider].should == "eucalyptus"
241
+ expect(@plugin[:cloud_v2][:provider]).to eq("eucalyptus")
242
242
  end
243
243
  end
244
244
 
@@ -250,42 +250,42 @@ describe Ohai::System, "plugin cloud" do
250
250
  it "populates cloud public ip" do
251
251
  @plugin[:azure]['public_ip'] = "174.129.150.8"
252
252
  @plugin.run
253
- @plugin[:cloud_v2][:public_ipv4_addrs][0].should == @plugin[:azure]['public_ip']
253
+ expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:azure]['public_ip'])
254
254
  end
255
255
 
256
256
  it "doesn't populates cloud vm_name" do
257
257
  @plugin[:azure]['vm_name'] = "linux-vm"
258
258
  @plugin.run
259
- @plugin[:cloud_v2][:vm_name].should_not == @plugin[:azure]['vm_name']
259
+ expect(@plugin[:cloud_v2][:vm_name]).not_to eq(@plugin[:azure]['vm_name'])
260
260
  end
261
261
 
262
262
  it "populates cloud public_hostname" do
263
263
  @plugin[:azure]['public_fqdn'] = "linux-vm-svc.cloudapp.net"
264
264
  @plugin.run
265
- @plugin[:cloud_v2][:public_hostname].should == @plugin[:azure]['public_fqdn']
265
+ expect(@plugin[:cloud_v2][:public_hostname]).to eq(@plugin[:azure]['public_fqdn'])
266
266
  end
267
267
 
268
268
  it "doesn't populate cloud public_ssh_port" do
269
269
  @plugin[:azure]['public_ssh_port'] = "22"
270
270
  @plugin.run
271
- @plugin[:cloud_v2][:public_ssh_port].should be_nil
271
+ expect(@plugin[:cloud_v2][:public_ssh_port]).to be_nil
272
272
  end
273
273
 
274
274
  it "should not populate cloud public_ssh_port when winrm is used" do
275
275
  @plugin[:azure]['public_winrm_port'] = "5985"
276
276
  @plugin.run
277
- @plugin[:cloud_v2][:public_ssh_port].should be_nil
277
+ expect(@plugin[:cloud_v2][:public_ssh_port]).to be_nil
278
278
  end
279
279
 
280
280
  it "populates cloud public_winrm_port" do
281
281
  @plugin[:azure]['public_winrm_port'] = "5985"
282
282
  @plugin.run
283
- @plugin[:cloud_v2][:public_winrm_port].should be_nil
283
+ expect(@plugin[:cloud_v2][:public_winrm_port]).to be_nil
284
284
  end
285
285
 
286
286
  it "populates cloud provider" do
287
287
  @plugin.run
288
- @plugin[:cloud_v2][:provider].should == "azure"
288
+ expect(@plugin[:cloud_v2][:provider]).to eq("azure")
289
289
  end
290
290
  end
291
291
 
@@ -28,7 +28,7 @@ describe "Cloudstack Plugin" do
28
28
 
29
29
  let(:cloudstack_plugin) do
30
30
  plugin = get_plugin("cloudstack", ohai_system)
31
- plugin.stub(:hint?).with("cloudstack").and_return(cloudstack_hint)
31
+ allow(plugin).to receive(:hint?).with("cloudstack").and_return(cloudstack_hint)
32
32
  plugin
33
33
  end
34
34
 
@@ -51,7 +51,7 @@ describe "Cloudstack Plugin" do
51
51
  context "and the metadata service is not available" do
52
52
 
53
53
  before do
54
- cloudstack_plugin.should_receive(:can_metadata_connect?).
54
+ expect(cloudstack_plugin).to receive(:can_metadata_connect?).
55
55
  with(Ohai::Mixin::CloudstackMetadata::CLOUDSTACK_METADATA_ADDR,80).
56
56
  and_return(false)
57
57
  end
@@ -97,21 +97,21 @@ EOM
97
97
  let(:http_client) { double("Net::HTTP", :read_timeout= => nil) }
98
98
 
99
99
  def expect_get(url, response_body)
100
- http_client.should_receive(:get).
100
+ expect(http_client).to receive(:get).
101
101
  with(url).
102
102
  and_return(double("HTTP Response", :code => "200", :body => response_body))
103
103
  end
104
104
 
105
105
  before do
106
- cloudstack_plugin.should_receive(:can_metadata_connect?).
106
+ expect(cloudstack_plugin).to receive(:can_metadata_connect?).
107
107
  with(Ohai::Mixin::CloudstackMetadata::CLOUDSTACK_METADATA_ADDR,80).
108
108
  and_return(true)
109
109
 
110
- Net::HTTP.stub(:start).
110
+ allow(Net::HTTP).to receive(:start).
111
111
  with(Ohai::Mixin::CloudstackMetadata::CLOUDSTACK_METADATA_ADDR).
112
112
  and_return(http_client)
113
113
 
114
- cloudstack_plugin.stub(:best_api_version).and_return(metadata_version)
114
+ allow(cloudstack_plugin).to receive(:best_api_version).and_return(metadata_version)
115
115
 
116
116
  expect_get("/#{metadata_version}/meta-data/", metadata_root)
117
117
 
@@ -22,52 +22,52 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "Darwin cpu plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("darwin/cpu")
25
- @plugin.stub(:collect_os).and_return(:darwin)
26
- @plugin.stub(:shell_out).with("sysctl -n hw.physicalcpu").and_return(mock_shell_out(0, "4", ""))
27
- @plugin.stub(:shell_out).with("sysctl -n hw.logicalcpu").and_return(mock_shell_out(0, "8", ""))
28
- @plugin.stub(:shell_out).with("sysctl -n hw.cpufrequency").and_return(mock_shell_out(0, "2300000000", ""))
29
- @plugin.stub(:shell_out).with("sysctl -n machdep.cpu.vendor").and_return(mock_shell_out(0, "GenuineIntel\n", ""))
30
- @plugin.stub(:shell_out).with("sysctl -n machdep.cpu.brand_string").and_return(mock_shell_out(0, "Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz\n", ""))
31
- @plugin.stub(:shell_out).with("sysctl -n machdep.cpu.model").and_return(mock_shell_out(0, "58", ""))
32
- @plugin.stub(:shell_out).with("sysctl -n machdep.cpu.family").and_return(mock_shell_out(0, "6", ""))
33
- @plugin.stub(:shell_out).with("sysctl -n machdep.cpu.stepping").and_return(mock_shell_out(0, "9", ""))
34
- @plugin.stub(:shell_out).with("sysctl -n machdep.cpu.features").and_return(mock_shell_out(0, "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 EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C", ""))
25
+ allow(@plugin).to receive(:collect_os).and_return(:darwin)
26
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.physicalcpu").and_return(mock_shell_out(0, "4", ""))
27
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.logicalcpu").and_return(mock_shell_out(0, "8", ""))
28
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.cpufrequency").and_return(mock_shell_out(0, "2300000000", ""))
29
+ allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.vendor").and_return(mock_shell_out(0, "GenuineIntel\n", ""))
30
+ allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.brand_string").and_return(mock_shell_out(0, "Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz\n", ""))
31
+ allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.model").and_return(mock_shell_out(0, "58", ""))
32
+ allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.family").and_return(mock_shell_out(0, "6", ""))
33
+ allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.stepping").and_return(mock_shell_out(0, "9", ""))
34
+ allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.features").and_return(mock_shell_out(0, "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 EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C", ""))
35
35
  @plugin.run
36
36
  end
37
37
 
38
38
  it "should set cpu[:total] to 8" do
39
- @plugin[:cpu][:total].should == 8
39
+ expect(@plugin[:cpu][:total]).to eq(8)
40
40
  end
41
41
 
42
42
  it "should set cpu[:real] to 4" do
43
- @plugin[:cpu][:real].should == 4
43
+ expect(@plugin[:cpu][:real]).to eq(4)
44
44
  end
45
45
 
46
46
  it "should set cpu[:mhz] to 2300" do
47
- @plugin[:cpu][:mhz].should == 2300
47
+ expect(@plugin[:cpu][:mhz]).to eq(2300)
48
48
  end
49
49
 
50
50
  it "should set cpu[:vendor_id] to GenuineIntel" do
51
- @plugin[:cpu][:vendor_id].should == "GenuineIntel"
51
+ expect(@plugin[:cpu][:vendor_id]).to eq("GenuineIntel")
52
52
  end
53
53
 
54
54
  it "should set cpu[:model_name] to Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz" do
55
- @plugin[:cpu][:model_name].should == "Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz"
55
+ expect(@plugin[:cpu][:model_name]).to eq("Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz")
56
56
  end
57
57
 
58
58
  it "should set cpu[:model] to 58" do
59
- @plugin[:cpu][:model].should == 58
59
+ expect(@plugin[:cpu][:model]).to eq(58)
60
60
  end
61
61
 
62
62
  it "should set cpu[:family] to 6" do
63
- @plugin[:cpu][:family].should == 6
63
+ expect(@plugin[:cpu][:family]).to eq(6)
64
64
  end
65
65
 
66
66
  it "should set cpu[:stepping] to 9" do
67
- @plugin[:cpu][:stepping].should == 9
67
+ expect(@plugin[:cpu][:stepping]).to eq(9)
68
68
  end
69
69
 
70
70
  it "should set cpu[:flags] to array of flags" do
71
- @plugin[:cpu][:flags].should == ["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", "est", "tm2", "ssse3", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "popcnt", "aes", "pcid", "xsave", "osxsave", "tsctmr", "avx1.0", "rdrand", "f16c"]
71
+ 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", "est", "tm2", "ssse3", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "popcnt", "aes", "pcid", "xsave", "osxsave", "tsctmr", "avx1.0", "rdrand", "f16c"])
72
72
  end
73
73
  end
@@ -22,10 +22,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "Darwin hostname plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("hostname")
25
- @plugin.stub(:collect_os).and_return(:darwin)
26
- @plugin.stub(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
27
- @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
28
- @plugin.stub(:resolve_fqdn).and_return("katie.bethell")
25
+ allow(@plugin).to receive(:collect_os).and_return(:darwin)
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").and_return(mock_shell_out(0, "katie.local", ""))
28
+ allow(@plugin).to receive(:resolve_fqdn).and_return("katie.bethell")
29
29
  end
30
30
 
31
31
  it_should_check_from("darwin::hostname", "hostname", "hostname -s", "katie")
@@ -34,12 +34,12 @@ describe Ohai::System, "Darwin hostname plugin" do
34
34
 
35
35
  it "should use #resolve_fqdn to find the fqdn" do
36
36
  @plugin.run
37
- @plugin[:fqdn].should == "katie.bethell"
37
+ expect(@plugin[:fqdn]).to eq("katie.bethell")
38
38
  end
39
39
 
40
40
  it "should set the domain to everything after the first dot of the fqdn" do
41
41
  @plugin.run
42
- @plugin[:domain].should == "bethell"
42
+ expect(@plugin[:domain]).to eq("bethell")
43
43
  end
44
44
  end
45
45
 
@@ -22,13 +22,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "Darwin kernel plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("kernel")
25
- @plugin.stub(:collect_os).and_return(:darwin)
26
- @plugin.stub(:init_kernel).and_return({})
25
+ allow(@plugin).to receive(:collect_os).and_return(:darwin)
26
+ allow(@plugin).to receive(:init_kernel).and_return({})
27
27
  end
28
28
 
29
29
  it "should populate kernel[:modules] from `kextstat -k -l`" do
30
- @plugin.stub(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "0", ""))
31
- @plugin.stub(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, <<EOF, ""))
30
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "0", ""))
31
+ allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, <<EOF, ""))
32
32
  8 0 0xffffff7f81aed000 0x41000 0x41000 com.apple.kec.corecrypto (1.0) <7 6 5 4 3 1>
33
33
  9 22 0xffffff7f807f3000 0x9000 0x9000 com.apple.iokit.IOACPIFamily (1.4) <7 6 4 3>
34
34
  10 30 0xffffff7f80875000 0x29000 0x29000 com.apple.iokit.IOPCIFamily (2.8) <7 6 5 4 3>
@@ -43,27 +43,27 @@ EOF
43
43
  {"version"=>"2.8", "size"=>167936, "index"=>"10", "refcount"=>"30"}}
44
44
 
45
45
  @plugin.run
46
- @plugin[:kernel][:modules].should eql(modules)
46
+ expect(@plugin[:kernel][:modules]).to eql(modules)
47
47
  end
48
48
 
49
49
  it "should not set kernel_machine to x86_64" do
50
- @plugin.stub(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "0", ""))
51
- @plugin.stub(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
50
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "0", ""))
51
+ allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
52
52
  @plugin.run
53
- @plugin[:kernel][:machine].should_not == 'x86_64'
53
+ expect(@plugin[:kernel][:machine]).not_to eq('x86_64')
54
54
  end
55
55
 
56
56
  it "should set kernel_machine to x86_64" do
57
- @plugin.stub(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "1", ""))
58
- @plugin.stub(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
57
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "1", ""))
58
+ allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
59
59
  @plugin.run
60
- @plugin[:kernel][:machine].should == 'x86_64'
60
+ expect(@plugin[:kernel][:machine]).to eq('x86_64')
61
61
  end
62
62
 
63
63
  it "should set the kernel_os to the kernel_name value" do
64
- @plugin.stub(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "1", ""))
65
- @plugin.stub(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
64
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.optional.x86_64").and_return(mock_shell_out(0, "1", ""))
65
+ allow(@plugin).to receive(:shell_out).with("kextstat -k -l").and_return(mock_shell_out(0, "", ""))
66
66
  @plugin.run
67
- @plugin[:kernel][:os].should == @plugin[:kernel][:name]
67
+ expect(@plugin[:kernel][:os]).to eq(@plugin[:kernel][:name])
68
68
  end
69
69
  end
@@ -40,25 +40,25 @@ Object cache: 12 hits of 139872 lookups (0% hit rate)
40
40
  DARWIN_VM_STAT
41
41
 
42
42
  @plugin = get_plugin("darwin/memory")
43
- @plugin.stub(:collect_os).and_return(:darwin)
44
- @plugin.stub(:shell_out).with("sysctl -n hw.memsize").and_return(mock_shell_out(0, darwin_memsize, ""))
45
- @plugin.stub(:shell_out).with("vm_stat").and_return(mock_shell_out(0, darwin_vm_stat, ""))
43
+ allow(@plugin).to receive(:collect_os).and_return(:darwin)
44
+ allow(@plugin).to receive(:shell_out).with("sysctl -n hw.memsize").and_return(mock_shell_out(0, darwin_memsize, ""))
45
+ allow(@plugin).to receive(:shell_out).with("vm_stat").and_return(mock_shell_out(0, darwin_vm_stat, ""))
46
46
  @plugin.run
47
47
  end
48
48
 
49
49
  it "should set memory[:total] to 16384MB" do
50
- @plugin[:memory][:total].should == '16384MB'
50
+ expect(@plugin[:memory][:total]).to eq('16384MB')
51
51
  end
52
52
 
53
53
  it "should set memory[:active] to 5140MB" do
54
- @plugin[:memory][:active].should == '5140MB'
54
+ expect(@plugin[:memory][:active]).to eq('5140MB')
55
55
  end
56
56
 
57
57
  it "should set memory[:inactive] to 738MB" do
58
- @plugin[:memory][:inactive].should == '738MB'
58
+ expect(@plugin[:memory][:inactive]).to eq('738MB')
59
59
  end
60
60
 
61
61
  it "should set memory[:free] to 10504MB" do
62
- @plugin[:memory][:free].should == '10504MB'
62
+ expect(@plugin[:memory][:free]).to eq('10504MB')
63
63
  end
64
64
  end