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
@@ -27,7 +27,7 @@ describe Ohai::Mixin::CloudstackMetadata do
27
27
 
28
28
  context "#best_api_version" do
29
29
  it "returns the string latest" do
30
- mixin.best_api_version.should == "latest"
30
+ expect(mixin.best_api_version).to eq("latest")
31
31
  end
32
32
  end
33
33
  end
@@ -25,14 +25,14 @@ describe Ohai::Mixin::Command, "popen4" do
25
25
  it "should default all commands to be run in the POSIX standard C locale" do
26
26
  Ohai::Mixin::Command.popen4("echo $LC_ALL") do |pid, stdin, stdout, stderr|
27
27
  stdin.close
28
- stdout.read.strip.should == "C"
28
+ expect(stdout.read.strip).to eq("C")
29
29
  end
30
30
  end
31
31
 
32
32
  it "should respect locale when specified explicitly" do
33
33
  Ohai::Mixin::Command.popen4("echo $LC_ALL", :environment => {"LC_ALL" => "es"}) do |pid, stdin, stdout, stderr|
34
34
  stdin.close
35
- stdout.read.strip.should == "es"
35
+ expect(stdout.read.strip).to eq("es")
36
36
  end
37
37
  end
38
38
 
@@ -53,14 +53,14 @@ describe Ohai::Mixin::Command, "popen4" do
53
53
  it "should force encode the string to UTF-8" do
54
54
  extend Ohai::Mixin::Command
55
55
  snowy = run_command(:command => ("echo '" + ('☃' * 8096) + "'"))[1]
56
- snowy.encoding.should == Encoding::UTF_8
56
+ expect(snowy.encoding).to eq(Encoding::UTF_8)
57
57
  end
58
58
  end
59
59
 
60
60
  it "should force encode the string to UTF-8" do
61
61
  extend Ohai::Mixin::Command
62
62
  snowy = run_command(:command => ("echo '" + ('☃' * 8096) + "'"))[1]
63
- snowy.encoding.should == Encoding::UTF_8
63
+ expect(snowy.encoding).to eq(Encoding::UTF_8)
64
64
  end
65
65
  end
66
66
 
@@ -77,13 +77,13 @@ describe Ohai::Mixin::Command, "popen4" do
77
77
  created_procs += 1
78
78
  end
79
79
  end
80
- created_procs.should == 100
80
+ expect(created_procs).to eq(100)
81
81
  reaped_procs = 0
82
82
  begin
83
83
  loop { Process.wait(-1); reaped_procs += 1 }
84
84
  rescue Errno::ECHILD
85
85
  end
86
- reaped_procs.should == 0
86
+ expect(reaped_procs).to eq(0)
87
87
  end
88
88
 
89
89
  end
@@ -23,8 +23,8 @@ describe Ohai::Mixin::Ec2Metadata do
23
23
  let(:mixin) {
24
24
  metadata_object = Object.new.extend(Ohai::Mixin::Ec2Metadata)
25
25
  http_client = double("Net::HTTP client")
26
- http_client.stub(:get).and_return(response)
27
- metadata_object.stub(:http_client).and_return(http_client)
26
+ allow(http_client).to receive(:get).and_return(response)
27
+ allow(metadata_object).to receive(:http_client).and_return(http_client)
28
28
  metadata_object
29
29
  }
30
30
 
@@ -33,7 +33,7 @@ describe Ohai::Mixin::Ec2Metadata do
33
33
  let(:response) { double("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "200") }
34
34
 
35
35
  it "returns the most recent version" do
36
- mixin.best_api_version.should == "2012-01-12"
36
+ expect(mixin.best_api_version).to eq("2012-01-12")
37
37
  end
38
38
  end
39
39
 
@@ -41,7 +41,7 @@ describe Ohai::Mixin::Ec2Metadata do
41
41
  let(:response) { double("Net::HTTP Response", :body => "1.0\n2009-04-04\n2007-03-01\n2011-05-01\n2008-09-01\nUnsupported", :code => "200") }
42
42
 
43
43
  it "returns the most recent version (using string sort)" do
44
- mixin.best_api_version.should == "2011-05-01"
44
+ expect(mixin.best_api_version).to eq("2011-05-01")
45
45
  end
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ describe Ohai::Mixin::Ec2Metadata do
49
49
  let(:response) { double("Net::HTTP Response", :body => "2020-01-01\nUnsupported", :code => "200") }
50
50
 
51
51
  it "raises an error" do
52
- lambda { mixin.best_api_version}.should raise_error
52
+ expect { mixin.best_api_version}.to raise_error
53
53
  end
54
54
  end
55
55
 
@@ -58,7 +58,7 @@ describe Ohai::Mixin::Ec2Metadata do
58
58
  let(:response) { double("Net::HTTP Response", :code => "404") }
59
59
 
60
60
  it "returns 'latest' as the version" do
61
- mixin.best_api_version.should == 'latest'
61
+ expect(mixin.best_api_version).to eq('latest')
62
62
  end
63
63
  end
64
64
 
@@ -66,7 +66,7 @@ describe Ohai::Mixin::Ec2Metadata do
66
66
  let(:response) { double("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "418") }
67
67
 
68
68
  it "raises an error" do
69
- lambda { mixin.best_api_version}.should raise_error
69
+ expect { mixin.best_api_version}.to raise_error
70
70
  end
71
71
  end
72
72
  end
@@ -76,7 +76,7 @@ describe Ohai::Mixin::Ec2Metadata do
76
76
  let(:response) { double("Net::HTTP Response", :body => "", :code => "418") }
77
77
 
78
78
  it "raises an error" do
79
- lambda { mixin.metadata_get('', '2012-01-12') }.should raise_error(RuntimeError)
79
+ expect { mixin.metadata_get('', '2012-01-12') }.to raise_error(RuntimeError)
80
80
  end
81
81
  end
82
82
  end
@@ -32,49 +32,49 @@ state enable Processor state False
32
32
  type PowerPC_POWER5 Processor type False
33
33
  LSATTR_EL
34
34
  @plugin = get_plugin("aix/cpu")
35
- @plugin.stub(:collect_os).and_return(:aix)
35
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
36
36
 
37
- @plugin.stub(:shell_out).with("lsdev -Cc processor").and_return(mock_shell_out(0, @lsdev_Cc_processor, nil))
38
- @plugin.stub(:shell_out).with("lsattr -El proc0").and_return(mock_shell_out(0, @lsattr_El_proc0, nil))
37
+ allow(@plugin).to receive(:shell_out).with("lsdev -Cc processor").and_return(mock_shell_out(0, @lsdev_Cc_processor, nil))
38
+ allow(@plugin).to receive(:shell_out).with("lsattr -El proc0").and_return(mock_shell_out(0, @lsattr_El_proc0, nil))
39
39
  @plugin.run
40
40
  end
41
41
 
42
42
 
43
43
  it "sets the vendor id to IBM" do
44
- @plugin[:cpu][:vendor_id].should == "IBM"
44
+ expect(@plugin[:cpu][:vendor_id]).to eq("IBM")
45
45
  end
46
46
 
47
47
  it "sets the available attribute" do
48
- @plugin[:cpu][:available].should == 1
48
+ expect(@plugin[:cpu][:available]).to eq(1)
49
49
  end
50
50
 
51
51
  it "sets the total number of devices" do
52
- @plugin[:cpu][:total].should == 2
52
+ expect(@plugin[:cpu][:total]).to eq(2)
53
53
  end
54
54
 
55
55
  it "detects the model" do
56
- @plugin[:cpu][:model].should == "PowerPC_POWER5"
56
+ expect(@plugin[:cpu][:model]).to eq("PowerPC_POWER5")
57
57
  end
58
58
 
59
59
  it "detects the mhz" do
60
- @plugin[:cpu][:mhz].should == 1615570
60
+ expect(@plugin[:cpu][:mhz]).to eq(1615570)
61
61
  end
62
62
 
63
63
  it "detects the status of the device" do
64
- @plugin[:cpu][:proc0][:status].should == "Available"
64
+ expect(@plugin[:cpu][:proc0][:status]).to eq("Available")
65
65
  end
66
66
 
67
67
  it "detects the location of the device" do
68
- @plugin[:cpu][:proc0][:location].should == "00-00"
68
+ expect(@plugin[:cpu][:proc0][:location]).to eq("00-00")
69
69
  end
70
70
 
71
71
  context "lsattr -El device_name" do
72
72
  it "detects all the attributes of the device" do
73
- @plugin[:cpu][:proc0][:frequency].should == "1654344000"
74
- @plugin[:cpu][:proc0][:smt_enabled].should == "true"
75
- @plugin[:cpu][:proc0][:smt_threads].should == "2"
76
- @plugin[:cpu][:proc0][:state].should == "enable"
77
- @plugin[:cpu][:proc0][:type].should == "PowerPC_POWER5"
73
+ expect(@plugin[:cpu][:proc0][:frequency]).to eq("1654344000")
74
+ expect(@plugin[:cpu][:proc0][:smt_enabled]).to eq("true")
75
+ expect(@plugin[:cpu][:proc0][:smt_threads]).to eq("2")
76
+ expect(@plugin[:cpu][:proc0][:state]).to eq("enable")
77
+ expect(@plugin[:cpu][:proc0][:type]).to eq("PowerPC_POWER5")
78
78
  end
79
79
  end
80
80
  end
@@ -46,10 +46,10 @@ DF_P
46
46
  MOUNT
47
47
 
48
48
  @plugin = get_plugin("aix/filesystem")
49
- @plugin.stub(:collect_os).and_return(:aix)
49
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
50
50
  @plugin[:filesystem] = Mash.new
51
- @plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, @df_P, nil))
52
- @plugin.stub(:shell_out).with("mount").and_return(mock_shell_out(0, @mount, nil))
51
+ allow(@plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @df_P, nil))
52
+ allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @mount, nil))
53
53
 
54
54
  @plugin.run
55
55
  end
@@ -57,56 +57,56 @@ MOUNT
57
57
  describe "df -P" do
58
58
 
59
59
  it "returns the filesystem block size" do
60
- @plugin[:filesystem]["/dev/hd4"]['kb_size'].should == "786432"
60
+ expect(@plugin[:filesystem]["/dev/hd4"]['kb_size']).to eq("786432")
61
61
  end
62
62
 
63
63
  it "returns the filesystem used space in kb" do
64
- @plugin[:filesystem]["/dev/hd4"]['kb_used'].should == "495632"
64
+ expect(@plugin[:filesystem]["/dev/hd4"]['kb_used']).to eq("495632")
65
65
  end
66
66
 
67
67
  it "returns the filesystem available space in kb" do
68
- @plugin[:filesystem]["/dev/hd4"]['kb_available'].should == "290800"
68
+ expect(@plugin[:filesystem]["/dev/hd4"]['kb_available']).to eq("290800")
69
69
  end
70
70
 
71
71
  it "returns the filesystem capacity in percentage" do
72
- @plugin[:filesystem]["/dev/hd4"]['percent_used'].should == "64%"
72
+ expect(@plugin[:filesystem]["/dev/hd4"]['percent_used']).to eq("64%")
73
73
  end
74
74
 
75
75
  it "returns the filesystem mounted location" do
76
- @plugin[:filesystem]["/dev/hd4"]['mount'].should == "/"
76
+ expect(@plugin[:filesystem]["/dev/hd4"]['mount']).to eq("/")
77
77
  end
78
78
  end
79
79
 
80
80
  describe "mount" do
81
81
 
82
82
  it "returns the filesystem mount location" do
83
- @plugin[:filesystem]["/dev/hd4"]['mount'].should == "/"
83
+ expect(@plugin[:filesystem]["/dev/hd4"]['mount']).to eq("/")
84
84
  end
85
85
 
86
86
  it "returns the filesystem type" do
87
- @plugin[:filesystem]["/dev/hd4"]['fs_type'].should == "jfs2"
87
+ expect(@plugin[:filesystem]["/dev/hd4"]['fs_type']).to eq("jfs2")
88
88
  end
89
89
 
90
90
  it "returns the filesystem mount options" do
91
- @plugin[:filesystem]["/dev/hd4"]['mount_options'].should == "rw,log=/dev/hd8"
91
+ expect(@plugin[:filesystem]["/dev/hd4"]['mount_options']).to eq("rw,log=/dev/hd8")
92
92
  end
93
93
 
94
94
  # For entries like 192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
95
95
  context "having node values" do
96
96
  before do
97
- @plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, "192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys", nil))
97
+ allow(@plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys", nil))
98
98
  end
99
99
 
100
100
  it "returns the filesystem mount location" do
101
- @plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount'].should == "/stage/middleware"
101
+ expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount']).to eq("/stage/middleware")
102
102
  end
103
103
 
104
104
  it "returns the filesystem type" do
105
- @plugin[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type'].should == "nfs3"
105
+ expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type']).to eq("nfs3")
106
106
  end
107
107
 
108
108
  it "returns the filesystem mount options" do
109
- @plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options'].should == "ro,bg,hard,intr,sec=sys"
109
+ expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options']).to eq("ro,bg,hard,intr,sec=sys")
110
110
  end
111
111
  end
112
112
  end
@@ -20,13 +20,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
20
20
  describe Ohai::System, "Aix hostname plugin" do
21
21
  before(:each) do
22
22
  @plugin = get_plugin("hostname")
23
- @plugin.stub(:collect_os).and_return(:aix)
24
- @plugin.stub(:from_cmd).with("hostname").and_return("aix_admin")
23
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
24
+ allow(@plugin).to receive(:from_cmd).with("hostname").and_return("aix_admin")
25
25
  @plugin.run
26
26
  end
27
27
 
28
28
  it "should set the machinename" do
29
- @plugin[:machinename].should eql("aix_admin")
29
+ expect(@plugin[:machinename]).to eql("aix_admin")
30
30
  end
31
31
  end
32
32
 
@@ -20,36 +20,36 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
20
20
  describe Ohai::System, "AIX kernel plugin" do
21
21
  before(:each) do
22
22
  @plugin = get_plugin("aix/kernel")
23
- @plugin.stub(:collect_os).and_return(:aix)
24
- @plugin.stub(:shell_out).with("uname -s").and_return(mock_shell_out(0, "AIX", nil))
25
- @plugin.stub(:shell_out).with("uname -r").and_return(mock_shell_out(0, "1", nil))
26
- @plugin.stub(:shell_out).with("uname -v").and_return(mock_shell_out(0, "6", nil))
27
- @plugin.stub(:shell_out).with("uname -p").and_return(mock_shell_out(0, "powerpc", nil))
28
- @plugin.stub(:shell_out).with("genkex -d").and_return(mock_shell_out(0, " Text address Size Data address Size File\nf1000000c0338000 77000 f1000000c0390000 1ec8c /usr/lib/drivers/cluster\n 6390000 20000 63a0000 ba8 /usr/lib/drivers/if_en", nil))
23
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
24
+ allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "AIX", nil))
25
+ allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "1", nil))
26
+ allow(@plugin).to receive(:shell_out).with("uname -v").and_return(mock_shell_out(0, "6", nil))
27
+ allow(@plugin).to receive(:shell_out).with("uname -p").and_return(mock_shell_out(0, "powerpc", nil))
28
+ allow(@plugin).to receive(:shell_out).with("genkex -d").and_return(mock_shell_out(0, " Text address Size Data address Size File\nf1000000c0338000 77000 f1000000c0390000 1ec8c /usr/lib/drivers/cluster\n 6390000 20000 63a0000 ba8 /usr/lib/drivers/if_en", nil))
29
29
  @plugin.run
30
30
  end
31
31
 
32
32
  it "uname -s detects the name" do
33
- @plugin[:kernel][:name].should == "aix"
33
+ expect(@plugin[:kernel][:name]).to eq("aix")
34
34
  end
35
35
 
36
36
  it "uname -r detects the release" do
37
- @plugin[:kernel][:release].should == "1"
37
+ expect(@plugin[:kernel][:release]).to eq("1")
38
38
  end
39
39
 
40
40
  it "uname -v detects the version" do
41
- @plugin[:kernel][:version].should == "6"
41
+ expect(@plugin[:kernel][:version]).to eq("6")
42
42
  end
43
43
 
44
44
  it "uname -p detects the machine" do
45
- @plugin[:kernel][:machine].should == "powerpc"
45
+ expect(@plugin[:kernel][:machine]).to eq("powerpc")
46
46
  end
47
47
 
48
48
  it "detects the modules" do
49
- @plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["text"].should == { "address" => "f1000000c0338000", "size" => "77000" }
50
- @plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["data"].should == { "address" => "f1000000c0390000", "size" => "1ec8c" }
51
- @plugin[:kernel][:modules]["/usr/lib/drivers/if_en"]["text"].should == { "address" => "6390000", "size" => "20000"}
52
- @plugin[:kernel][:modules]["/usr/lib/drivers/if_en"]["data"].should == { "address" => "63a0000", "size" => "ba8"}
49
+ expect(@plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["text"]).to eq({ "address" => "f1000000c0338000", "size" => "77000" })
50
+ expect(@plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["data"]).to eq({ "address" => "f1000000c0390000", "size" => "1ec8c" })
51
+ expect(@plugin[:kernel][:modules]["/usr/lib/drivers/if_en"]["text"]).to eq({ "address" => "6390000", "size" => "20000"})
52
+ expect(@plugin[:kernel][:modules]["/usr/lib/drivers/if_en"]["data"]).to eq({ "address" => "63a0000", "size" => "ba8"})
53
53
 
54
54
  end
55
55
  end
@@ -64,15 +64,15 @@ There are 6 entries in the arp table.
64
64
  ARP_AN
65
65
 
66
66
  @plugin = get_plugin("aix/network")
67
- @plugin.stub(:collect_os).and_return(:aix)
67
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
68
68
  @plugin[:network] = Mash.new
69
- @plugin.stub(:shell_out).with("netstat -rn |grep default").and_return(mock_shell_out(0, @netstat_rn_grep_default, nil))
70
- @plugin.stub(:shell_out).with("lsdev -Cc if").and_return(mock_shell_out(0, @lsdev_Cc_if, nil))
71
- @plugin.stub(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, @ifconfig_en0, nil))
72
- @plugin.stub(:shell_out).with("entstat -d en0 | grep \"Hardware Address\"").and_return(mock_shell_out(0, "Hardware Address: be:42:80:00:b0:05", nil))
73
- @plugin.stub(:shell_out).with("netstat -nrf inet").and_return(mock_shell_out(0, @netstat_nrf_inet, nil))
74
- @plugin.stub(:shell_out).with("netstat -nrf inet6").and_return(mock_shell_out(0, "::1%1 ::1%1 UH 1 109392 en0 - -", nil))
75
- @plugin.stub(:shell_out).with("arp -an").and_return(mock_shell_out(0, @aix_arp_an, nil))
69
+ allow(@plugin).to receive(:shell_out).with("netstat -rn |grep default").and_return(mock_shell_out(0, @netstat_rn_grep_default, nil))
70
+ allow(@plugin).to receive(:shell_out).with("lsdev -Cc if").and_return(mock_shell_out(0, @lsdev_Cc_if, nil))
71
+ allow(@plugin).to receive(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, @ifconfig_en0, nil))
72
+ allow(@plugin).to receive(:shell_out).with("entstat -d en0 | grep \"Hardware Address\"").and_return(mock_shell_out(0, "Hardware Address: be:42:80:00:b0:05", nil))
73
+ allow(@plugin).to receive(:shell_out).with("netstat -nrf inet").and_return(mock_shell_out(0, @netstat_nrf_inet, nil))
74
+ allow(@plugin).to receive(:shell_out).with("netstat -nrf inet6").and_return(mock_shell_out(0, "::1%1 ::1%1 UH 1 109392 en0 - -", nil))
75
+ allow(@plugin).to receive(:shell_out).with("arp -an").and_return(mock_shell_out(0, @aix_arp_an, nil))
76
76
  end
77
77
 
78
78
  describe "run" do
@@ -81,15 +81,15 @@ ARP_AN
81
81
  end
82
82
 
83
83
  it "detects network information" do
84
- @plugin['network'].should_not be_nil
84
+ expect(@plugin['network']).not_to be_nil
85
85
  end
86
86
 
87
87
  it "detects the interfaces" do
88
- @plugin['network']['interfaces'].keys.sort.should == ["en0"]
88
+ expect(@plugin['network']['interfaces'].keys.sort).to eq(["en0"])
89
89
  end
90
90
 
91
91
  it "detects the ip addresses of the interfaces" do
92
- @plugin['network']['interfaces']['en0']['addresses'].keys.should include('172.29.174.58')
92
+ expect(@plugin['network']['interfaces']['en0']['addresses'].keys).to include('172.29.174.58')
93
93
  end
94
94
  end
95
95
 
@@ -99,34 +99,34 @@ ARP_AN
99
99
  end
100
100
 
101
101
  it "returns the default gateway of the system's network" do
102
- @plugin[:network][:default_gateway].should == '172.31.8.1'
102
+ expect(@plugin[:network][:default_gateway]).to eq('172.31.8.1')
103
103
  end
104
104
 
105
105
  it "returns the default interface of the system's network" do
106
- @plugin[:network][:default_interface].should == 'en0'
106
+ expect(@plugin[:network][:default_interface]).to eq('en0')
107
107
  end
108
108
  end
109
109
 
110
110
  describe "lsdev -Cc if" do
111
111
  it "detects the state of the interfaces in the system" do
112
112
  @plugin.run
113
- @plugin['network']['interfaces']['en0'][:state].should == "up"
113
+ expect(@plugin['network']['interfaces']['en0'][:state]).to eq("up")
114
114
  end
115
115
 
116
116
  it "detects the description of the interfaces in the system" do
117
117
  @plugin.run
118
- @plugin['network']['interfaces']['en0'][:description].should == "Standard Ethernet Network Interface"
118
+ expect(@plugin['network']['interfaces']['en0'][:description]).to eq("Standard Ethernet Network Interface")
119
119
  end
120
120
 
121
121
  describe "ifconfig interface" do
122
122
  it "detects the CHAIN network flag" do
123
123
  @plugin.run
124
- @plugin['network']['interfaces']['en0'][:flags].should include('CHAIN')
124
+ expect(@plugin['network']['interfaces']['en0'][:flags]).to include('CHAIN')
125
125
  end
126
126
 
127
127
  it "detects the metric network flag" do
128
128
  @plugin.run
129
- @plugin['network']['interfaces']['en0'][:metric].should == '1'
129
+ expect(@plugin['network']['interfaces']['en0'][:metric]).to eq('1')
130
130
  end
131
131
 
132
132
  context "inet entries" do
@@ -136,54 +136,54 @@ ARP_AN
136
136
  end
137
137
 
138
138
  it "detects the family" do
139
- @inet_entry[:family].should == 'inet'
139
+ expect(@inet_entry[:family]).to eq('inet')
140
140
  end
141
141
 
142
142
  it "detects the netmask" do
143
- @inet_entry[:netmask].should == '255.255.192.0'
143
+ expect(@inet_entry[:netmask]).to eq('255.255.192.0')
144
144
  end
145
145
 
146
146
  it "detects the broadcast" do
147
- @inet_entry[:broadcast].should == '172.29.191.255'
147
+ expect(@inet_entry[:broadcast]).to eq('172.29.191.255')
148
148
  end
149
149
 
150
150
  it "detects all key-values" do
151
- @plugin['network']['interfaces']['en0'][:tcp_sendspace].should == "262144"
152
- @plugin['network']['interfaces']['en0'][:tcp_recvspace].should == "262144"
153
- @plugin['network']['interfaces']['en0'][:rfc1323].should == "1"
151
+ expect(@plugin['network']['interfaces']['en0'][:tcp_sendspace]).to eq("262144")
152
+ expect(@plugin['network']['interfaces']['en0'][:tcp_recvspace]).to eq("262144")
153
+ expect(@plugin['network']['interfaces']['en0'][:rfc1323]).to eq("1")
154
154
  end
155
155
 
156
156
  # For an output with no netmask like inet 172.29.174.59 broadcast 172.29.191.255
157
157
  context "with no netmask in the output" do
158
158
  before do
159
- @plugin.stub(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet 172.29.174.59 broadcast 172.29.191.255", nil))
159
+ allow(@plugin).to receive(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet 172.29.174.59 broadcast 172.29.191.255", nil))
160
160
  end
161
161
 
162
162
  it "detects the default prefixlen" do
163
163
  @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
164
- @inet_entry[:prefixlen].should == '32'
164
+ expect(@inet_entry[:prefixlen]).to eq('32')
165
165
  end
166
166
 
167
167
  it "detects the default netmask" do
168
168
  @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
169
- @inet_entry[:netmask].should == '255.255.255.255'
169
+ expect(@inet_entry[:netmask]).to eq('255.255.255.255')
170
170
  end
171
171
  end
172
172
  end
173
173
 
174
174
  context "inet6 entries" do
175
175
  before do
176
- @plugin.stub(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet6 ::1%1/0", nil))
176
+ allow(@plugin).to receive(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet6 ::1%1/0", nil))
177
177
  @plugin.run
178
178
  @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["::1"]
179
179
  end
180
180
 
181
181
  it "detects the prefixlen" do
182
- @inet_entry[:prefixlen].should == '0'
182
+ expect(@inet_entry[:prefixlen]).to eq('0')
183
183
  end
184
184
 
185
185
  it "detects the family" do
186
- @inet_entry[:family].should == 'inet6'
186
+ expect(@inet_entry[:family]).to eq('inet6')
187
187
  end
188
188
  end
189
189
  end
@@ -194,7 +194,7 @@ ARP_AN
194
194
  @inet_interface_addresses = @plugin['network']['interfaces']['en0'][:addresses]["BE:42:80:00:B0:05"]
195
195
  end
196
196
  it "detects the family" do
197
- @inet_interface_addresses[:family].should == 'lladdr'
197
+ expect(@inet_interface_addresses[:family]).to eq('lladdr')
198
198
  end
199
199
  end
200
200
  end
@@ -206,39 +206,39 @@ ARP_AN
206
206
 
207
207
  context "inet" do
208
208
  it "detects the route destinations" do
209
- @plugin['network']['interfaces']['en0'][:routes][0][:destination].should == "default"
210
- @plugin['network']['interfaces']['en0'][:routes][1][:destination].should == "172.29.128.0"
209
+ expect(@plugin['network']['interfaces']['en0'][:routes][0][:destination]).to eq("default")
210
+ expect(@plugin['network']['interfaces']['en0'][:routes][1][:destination]).to eq("172.29.128.0")
211
211
  end
212
212
 
213
213
  it "detects the route family" do
214
- @plugin['network']['interfaces']['en0'][:routes][0][:family].should == "inet"
214
+ expect(@plugin['network']['interfaces']['en0'][:routes][0][:family]).to eq("inet")
215
215
  end
216
216
 
217
217
  it "detects the route gateway" do
218
- @plugin['network']['interfaces']['en0'][:routes][0][:via].should == "172.29.128.13"
218
+ expect(@plugin['network']['interfaces']['en0'][:routes][0][:via]).to eq("172.29.128.13")
219
219
  end
220
220
 
221
221
  it "detects the route flags" do
222
- @plugin['network']['interfaces']['en0'][:routes][0][:flags].should == "UG"
222
+ expect(@plugin['network']['interfaces']['en0'][:routes][0][:flags]).to eq("UG")
223
223
  end
224
224
  end
225
225
 
226
226
  context "inet6" do
227
227
 
228
228
  it "detects the route destinations" do
229
- @plugin['network']['interfaces']['en0'][:routes][4][:destination].should == "::1%1"
229
+ expect(@plugin['network']['interfaces']['en0'][:routes][4][:destination]).to eq("::1%1")
230
230
  end
231
231
 
232
232
  it "detects the route family" do
233
- @plugin['network']['interfaces']['en0'][:routes][4][:family].should == "inet6"
233
+ expect(@plugin['network']['interfaces']['en0'][:routes][4][:family]).to eq("inet6")
234
234
  end
235
235
 
236
236
  it "detects the route gateway" do
237
- @plugin['network']['interfaces']['en0'][:routes][4][:via].should == "::1%1"
237
+ expect(@plugin['network']['interfaces']['en0'][:routes][4][:via]).to eq("::1%1")
238
238
  end
239
239
 
240
240
  it "detects the route flags" do
241
- @plugin['network']['interfaces']['en0'][:routes][4][:flags].should == "UH"
241
+ expect(@plugin['network']['interfaces']['en0'][:routes][4][:flags]).to eq("UH")
242
242
  end
243
243
  end
244
244
  end
@@ -248,15 +248,15 @@ ARP_AN
248
248
  @plugin.run
249
249
  end
250
250
  it "supresses the hostname entries" do
251
- @plugin['network']['arp'][0][:remote_host].should == "?"
251
+ expect(@plugin['network']['arp'][0][:remote_host]).to eq("?")
252
252
  end
253
253
 
254
254
  it "detects the remote ip entry" do
255
- @plugin['network']['arp'][0][:remote_ip].should == "172.29.131.16"
255
+ expect(@plugin['network']['arp'][0][:remote_ip]).to eq("172.29.131.16")
256
256
  end
257
257
 
258
258
  it "detects the remote mac entry" do
259
- @plugin['network']['arp'][0][:remote_mac].should == "6e:87:70:0:40:3"
259
+ expect(@plugin['network']['arp'][0][:remote_mac]).to eq("6e:87:70:0:40:3")
260
260
  end
261
261
  end
262
262
 
@@ -265,7 +265,7 @@ ARP_AN
265
265
  @plugin.run
266
266
  end
267
267
  it "converts a netmask from hexadecimal form to decimal form" do
268
- @plugin.hex_to_dec_netmask('0xffff0000').should == "255.255.0.0"
268
+ expect(@plugin.hex_to_dec_netmask('0xffff0000')).to eq("255.255.0.0")
269
269
  end
270
270
  end
271
271
  end