rubyipmi 0.9.2 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +3 -3
  3. data/README.md +36 -23
  4. data/RELEASE_NOTES.md +48 -0
  5. data/Rakefile +15 -42
  6. data/VERSION +1 -1
  7. data/lib/rubyipmi/commands/basecommand.rb +17 -23
  8. data/lib/rubyipmi/commands/mixins/power_mixin.rb +50 -0
  9. data/lib/rubyipmi/commands/mixins/sensors_mixin.rb +54 -0
  10. data/lib/rubyipmi/freeipmi/commands/basecommand.rb +26 -35
  11. data/lib/rubyipmi/freeipmi/commands/bmc.rb +4 -7
  12. data/lib/rubyipmi/freeipmi/commands/bmcconfig.rb +7 -17
  13. data/lib/rubyipmi/freeipmi/commands/bmcdevice.rb +2 -9
  14. data/lib/rubyipmi/freeipmi/commands/bmcinfo.rb +4 -10
  15. data/lib/rubyipmi/freeipmi/commands/chassis.rb +27 -45
  16. data/lib/rubyipmi/freeipmi/commands/chassisconfig.rb +23 -38
  17. data/lib/rubyipmi/freeipmi/commands/fru.rb +23 -42
  18. data/lib/rubyipmi/freeipmi/commands/lan.rb +4 -6
  19. data/lib/rubyipmi/freeipmi/commands/power.rb +8 -51
  20. data/lib/rubyipmi/freeipmi/commands/sensors.rb +10 -67
  21. data/lib/rubyipmi/freeipmi/connection.rb +14 -17
  22. data/lib/rubyipmi/freeipmi/errorcodes.rb +11 -17
  23. data/lib/rubyipmi/ipmitool/commands/basecommand.rb +12 -16
  24. data/lib/rubyipmi/ipmitool/commands/bmc.rb +13 -22
  25. data/lib/rubyipmi/ipmitool/commands/chassis.rb +26 -44
  26. data/lib/rubyipmi/ipmitool/commands/chassisconfig.rb +11 -21
  27. data/lib/rubyipmi/ipmitool/commands/fru.rb +35 -48
  28. data/lib/rubyipmi/ipmitool/commands/lan.rb +25 -28
  29. data/lib/rubyipmi/ipmitool/commands/power.rb +7 -58
  30. data/lib/rubyipmi/ipmitool/commands/sensors.rb +10 -68
  31. data/lib/rubyipmi/ipmitool/connection.rb +10 -19
  32. data/lib/rubyipmi/ipmitool/errorcodes.rb +11 -45
  33. data/lib/rubyipmi/observablehash.rb +1 -2
  34. data/lib/rubyipmi/version.rb +5 -0
  35. data/lib/rubyipmi.rb +31 -28
  36. data/rubyipmi.gemspec +17 -128
  37. metadata +13 -101
  38. data/spec/Vagrantfile +0 -45
  39. data/spec/fixtures/freeipmi/bmc_config.txt +0 -317
  40. data/spec/fixtures/freeipmi/bmc_config_lan_conf.txt +0 -19
  41. data/spec/fixtures/freeipmi/bmc_info.txt +0 -32
  42. data/spec/fixtures/freeipmi/errors.txt +0 -3
  43. data/spec/fixtures/freeipmi/fru.txt +0 -13
  44. data/spec/fixtures/freeipmi/sensors.txt +0 -29
  45. data/spec/fixtures/ipmitool/bmc_info.txt +0 -20
  46. data/spec/fixtures/ipmitool/errors.txt +0 -10
  47. data/spec/fixtures/ipmitool/fru.txt +0 -96
  48. data/spec/fixtures/ipmitool/lan.txt +0 -17
  49. data/spec/fixtures/ipmitool/sensors.txt +0 -105
  50. data/spec/integration/bmc_spec.rb +0 -48
  51. data/spec/integration/chassis_config_spec.rb +0 -38
  52. data/spec/integration/chassis_spec.rb +0 -26
  53. data/spec/integration/connection_spec.rb +0 -45
  54. data/spec/integration/fru_spec.rb +0 -38
  55. data/spec/integration/lan_spec.rb +0 -50
  56. data/spec/integration/power_spec.rb +0 -40
  57. data/spec/integration/rubyipmi_spec.rb +0 -114
  58. data/spec/integration/sensor_spec.rb +0 -43
  59. data/spec/manifests/default.pp +0 -50
  60. data/spec/puppetmodules/archive/LICENSE-2.0.txt +0 -202
  61. data/spec/puppetmodules/archive/Modulefile +0 -8
  62. data/spec/puppetmodules/archive/README.md +0 -40
  63. data/spec/puppetmodules/archive/manifests/download.pp +0 -157
  64. data/spec/puppetmodules/archive/manifests/extract.pp +0 -81
  65. data/spec/puppetmodules/archive/manifests/init.pp +0 -70
  66. data/spec/puppetmodules/archive/manifests/tar-gz.pp +0 -7
  67. data/spec/puppetmodules/archive/manifests/zip.pp +0 -7
  68. data/spec/puppetmodules/archive/metadata.json +0 -26
  69. data/spec/spec_helper.rb +0 -47
  70. data/spec/unit/freeipmi/bmc-info_spec.rb +0 -38
  71. data/spec/unit/freeipmi/bmc_spec.rb +0 -43
  72. data/spec/unit/freeipmi/connection_spec.rb +0 -120
  73. data/spec/unit/freeipmi/errorcodes_spec.rb +0 -28
  74. data/spec/unit/freeipmi/fru_spec.rb +0 -76
  75. data/spec/unit/freeipmi/lan_spec.rb +0 -0
  76. data/spec/unit/freeipmi/sensors_spec.rb +0 -85
  77. data/spec/unit/ipmitool/bmc_spec.rb +0 -77
  78. data/spec/unit/ipmitool/connection_spec.rb +0 -121
  79. data/spec/unit/ipmitool/errorcodes_spec.rb +0 -35
  80. data/spec/unit/ipmitool/fru_spec.rb +0 -77
  81. data/spec/unit/ipmitool/lan_spec.rb +0 -94
  82. data/spec/unit/ipmitool/sensors_spec.rb +0 -96
  83. data/spec/unit/rubyipmi_spec.rb +0 -32
  84. data/spec/vagrant +0 -27
  85. data/spec/vagrant.pub +0 -1
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe "Bmc" do
5
- before :all do
6
- @path = '/usr/local/bin'
7
- end
8
-
9
- before :each do
10
- allow_message_expectations_on_nil
11
- provider = "freeipmi"
12
- user = "ipmiuser"
13
- pass = "impipass"
14
- host = "ipmihost"
15
- allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return("#{@path}/ipmipower")
16
-
17
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
18
- @bmcinfo = @conn.bmc.information
19
- data = nil
20
- File.open("spec/fixtures/#{provider}/bmc_info.txt",'r') do |file|
21
- data = file.read
22
- end
23
- allow(@bmcinfo).to receive(:locate_command).with('bmc-info').and_return("#{@path}/bmc-info")
24
- allow(@bmcinfo).to receive(:`).and_return(data)
25
- allow($?).to receive(:success?).and_return(true)
26
- end
27
-
28
- it "cmd should be bmc-info with correct number of arguments" do
29
- @bmcinfo.retrieve
30
- verify_freeipmi_command(@bmcinfo, 2, "#{@path}/bmc-info")
31
- end
32
-
33
- it "cmd should be bmc-info with correct number of arguments" do
34
- @bmcinfo.guid
35
- verify_freeipmi_command(@bmcinfo, 3, "#{@path}/bmc-info")
36
- end
37
-
38
- end
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe "Bmc" do
5
- before :all do
6
- @path = '/usr/local/bin'
7
- end
8
-
9
- before :each do
10
- allow_message_expectations_on_nil
11
- provider = "freeipmi"
12
- user = "ipmiuser"
13
- pass = "impipass"
14
- host = "ipmihost"
15
- allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return("#{@path}/ipmipower")
16
-
17
- @conn = Rubyipmi.connect(user, pass, host, provider,{:debug => true})
18
- @bmc = @conn.bmc
19
- data = nil
20
- File.open("spec/fixtures/#{provider}/bmc_info.txt",'r') do |file|
21
- data = file.read
22
- end
23
- allow(@bmc).to receive(:guid).and_return("guid")
24
- allow(@bmc).to receive(:info).and_return("info")
25
- end
26
-
27
- it "bmc should not be nil" do
28
- expect(@bmc).not_to be nil
29
- end
30
-
31
- it "lan should not be nil" do
32
- expect(@bmc.lan).not_to be_nil
33
- end
34
-
35
- it "guid should not be nil" do
36
- expect(@bmc.guid).not_to be_nil
37
- end
38
-
39
- it "info should not be nill" do
40
- expect(@bmc.info).not_to be_nil
41
- end
42
-
43
- end
@@ -1,120 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Bmc" do
4
-
5
- before :all do
6
- @path = '/usr/local/bin'
7
- @provider = "freeipmi"
8
- @user = "ipmiuser"
9
- @pass = "impipass"
10
- @host = "ipmihost"
11
- end
12
-
13
- before :each do
14
-
15
-
16
- allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return("#{@path}/ipmipower")
17
-
18
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true})
19
-
20
-
21
- end
22
-
23
- it "connection should not be nil" do
24
- expect(@conn).not_to be_nil
25
- end
26
-
27
- it "fru should not be nil" do
28
- expect(@conn.fru).not_to be_nil
29
- end
30
-
31
- it "provider should not be nil" do
32
- expect(@conn.provider).not_to be_nil
33
- end
34
-
35
- it "provider should be freeipmi" do
36
- expect(@conn.provider).to eq("freeipmi")
37
- end
38
-
39
- it "bmc should not be nil" do
40
- expect(@conn.bmc).not_to be_nil
41
- end
42
-
43
- it "sensors should not be nil" do
44
- expect(@conn.sensors).not_to be_nil
45
-
46
- end
47
-
48
- it "chassis should not be nill" do
49
- expect(@conn.chassis).not_to be_nil
50
-
51
- end
52
-
53
- it 'object should have driver set to auto if not specified' do
54
- expect(@conn.options.has_key?('driver-type')).to eq false
55
- end
56
-
57
- it 'object should have driver set to auto if not specified' do
58
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
59
- expect(@conn.options.has_key?('driver-type')).to eq false
60
- end
61
-
62
- it 'object should have priv type set to ADMINISTRATOR if not specified' do
63
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
64
- expect(@conn.options.has_key?('privilege-level')).to eq false
65
- end
66
-
67
- it 'object should have priv type set to USER ' do
68
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:privilege => 'USER', :debug => true, :driver => 'auto'})
69
- expect(@conn.options.fetch('privilege-level')).to eq('USER')
70
- end
71
-
72
- it 'should raise exception if invalid privilege type' do
73
- expect{Rubyipmi.connect(@user, @pass, @host, @provider,{:privilege => 'BLAH',:debug => true, :driver => 'auto'})}.to raise_error(RuntimeError)
74
- end
75
-
76
- it 'should raise exception if invalid driver type' do
77
- expect{Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'foo'})}.to raise_error(RuntimeError)
78
- end
79
-
80
- it 'object should have driver set to lan_2_0' do
81
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'lan20'})
82
- expect(@conn.options['driver-type']).to eq('LAN_2_0')
83
- end
84
-
85
- it 'object should have driver set to lan' do
86
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'lan15'})
87
- expect(@conn.options['driver-type']).to eq('LAN')
88
- end
89
-
90
- it 'object should have driver set to openipmi' do
91
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'open'})
92
- expect(@conn.options['driver-type']).to eq('OPENIPMI')
93
- end
94
-
95
- describe 'test' do
96
- it 'should retrun boolean on test connection when result is not a hash' do
97
- conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
98
- bmc = double()
99
- allow(bmc).to receive(:info).and_return('')
100
- allow(conn).to receive(:bmc).and_return(bmc)
101
- expect(conn.connection_works?).to eq false
102
- end
103
-
104
- it 'should retrun boolean on test connection when result is a hash' do
105
- conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
106
- bmc = double()
107
- allow(bmc).to receive(:info).and_return({:test => true})
108
- allow(conn).to receive(:bmc).and_return(bmc)
109
- expect(conn.connection_works?).to eq true
110
- end
111
-
112
- it 'should retrun boolean on test connection when nil' do
113
- conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
114
- bmc = double()
115
- allow(bmc).to receive(:info).and_return(nil)
116
- allow(conn).to receive(:bmc).and_return(bmc)
117
- expect(conn.connection_works?).to eq false
118
- end
119
- end
120
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
- #require 'rubyipmi/Freeipmi/errorcodes'
3
-
4
- describe "Errorcodes" do
5
- it 'should return the length of fix hash' do
6
- expect(Rubyipmi::Freeipmi::ErrorCodes.length).to be >= 1
7
- end
8
-
9
- it 'should return a hash of codes' do
10
- expect(Rubyipmi::Freeipmi::ErrorCodes.code).to be_an_instance_of Hash
11
-
12
- end
13
-
14
- it 'should return a fix if code is found' do
15
- code = 'authentication type unavailable for attempted privilege level'
16
- expect(Rubyipmi::Freeipmi::ErrorCodes.search(code)).to eq({"driver-type" => "LAN_2_0"})
17
- end
18
-
19
- it 'should throw and error if no fix is found' do
20
- code = 'Crap Shoot'
21
- expect {Rubyipmi::Freeipmi::ErrorCodes.search(code)}.to raise_error
22
- end
23
-
24
- it 'should throw and error when a bad code is given' do
25
- code = nil
26
- expect {Rubyipmi::Freeipmi::ErrorCodes.search(code)}.to raise_error
27
- end
28
- end
@@ -1,76 +0,0 @@
1
- require 'spec_helper'
2
- describe :Fru do
3
-
4
- before :all do
5
- @path = '/usr/local/bin'
6
- end
7
-
8
- before :each do
9
-
10
- allow_message_expectations_on_nil
11
- data = nil
12
- provider = "freeipmi"
13
- user = "ipmiuser"
14
- pass = "impipass"
15
- host = "ipmihost"
16
- allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return("#{@path}/ipmipower")
17
-
18
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
19
- @fru = @conn.fru
20
- File.open("spec/fixtures/#{provider}/fru.txt",'r') do |file|
21
- data = file.read
22
- end
23
-
24
- allow(@fru).to receive(:locate_command).with('ipmi-fru').and_return("#{@path}/ipmi-fru")
25
- allow(@fru).to receive(:`).and_return(data)
26
- allow($?).to receive(:success?).and_return(true)
27
- end
28
-
29
- it "cmd should be ipmi-fru with correct number of arguments" do
30
- @fru.list
31
- verify_freeipmi_command(@fru, 2, "#{@path}/ipmi-fru")
32
- end
33
-
34
- it 'should list data' do
35
- expect(@fru.names.count).to eq(1)
36
- end
37
-
38
- it 'should return a list of unparsed frus' do
39
- expect(@fru.getfrus).not_to be_nil
40
- end
41
-
42
-
43
- it "should return a list of parsed frus" do
44
- expect(@fru.list.count).to eq(1)
45
- end
46
-
47
- it 'should return a manufacturer' do
48
- expect(@fru.board_manufacturer).to eq('HP')
49
- end
50
-
51
- it 'should return a product' do
52
- expect(@fru.board_product_name).to eq('ProLiant DL380 G5')
53
- end
54
-
55
- it 'should return a chassis serial' do
56
- expect(@fru.chassis_serial_number).to eq('2UX64201U2')
57
- end
58
-
59
- it 'should return a board serial' do
60
- expect(@fru.board_serial_number).to eq('2UX64201U2')
61
- end
62
-
63
- it 'should return a list of fru names' do
64
- expect(@fru.names.count).to eq(1)
65
- end
66
-
67
- it 'should return a fru using method missing' do
68
- @fru.names.each do |name|
69
- fru = @fru.send(name)
70
- expect(fru).to be_an_instance_of(Rubyipmi::Freeipmi::FruData)
71
- expect(fru[:name]).to eq(name)
72
-
73
- end
74
- end
75
-
76
- end
File without changes
@@ -1,85 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe :Sensors do
5
- before :all do
6
- @path = '/usr/local/bin'
7
- end
8
-
9
- before :each do
10
- allow_message_expectations_on_nil
11
- data = nil
12
- provider = "freeipmi"
13
- user = "ipmiuser"
14
- pass = "impipass"
15
- host = "ipmihost"
16
- # this stub allows us to mock the command that would be used to verify provider installation
17
- allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return("#{@path}/ipmipower")
18
-
19
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
20
- @sensors = @conn.sensors
21
- File.open("spec/fixtures/#{provider}/sensors.txt",'r') do |file|
22
- data = file.read
23
- end
24
- # this stub allows us to mock the command that is used with this test case
25
- allow(@sensors).to receive(:locate_command).with('ipmi-sensors').and_return('/usr/local/bin/ipmi-sensors')
26
-
27
- # these stubs allow us to run the command and return the fixtures
28
- allow(@sensors).to receive(:`).and_return(data)
29
- allow($?).to receive(:success?).and_return(true)
30
-
31
- end
32
-
33
- it "cmd should be ipmi-sensors with six arguments" do
34
- @sensors.list
35
- verify_freeipmi_command(@sensors, 5, "#{@path}/ipmi-sensors")
36
- end
37
-
38
- it "can return a list of sensors" do
39
- expect(@sensors.list).not_to be_nil
40
- end
41
-
42
- it "should return a count of sensors" do
43
- expect(@sensors.count).to eq(29)
44
- end
45
-
46
- it "should return a list of fan names" do
47
- expect(@sensors.fanlist.count).to eq(13)
48
- end
49
-
50
- it 'should return a list of temp names' do
51
- expect(@sensors.templist.count).to eq(7)
52
- end
53
-
54
- it 'should return a list of sensor names as an array' do
55
- expect(@sensors.names).to be_an_instance_of(Array)
56
- expect(@sensors.names.count).to eq(29)
57
- end
58
-
59
- it 'should return an empty list if no data exists' do
60
- allow(@sensors).to receive(:getsensors).and_return(nil)
61
- expect(@sensors.names.count).to eq(0)
62
- end
63
-
64
- it 'should return a sensor using method missing' do
65
- @sensors.names.each do |name|
66
- sensor = @sensors.send(name)
67
- expect(sensor).to be_an_instance_of(Rubyipmi::Freeipmi::Sensor)
68
- expect(sensor[:name]).to eq(name)
69
- end
70
- end
71
-
72
- #it 'fix should be added to options after error occurs' do
73
- # error = nil
74
- # File.open("spec/fixtures/freeipmi/errors.txt",'r') do |file|
75
- # error = file.read
76
- # end
77
- # @sensors.stub(:`).and_return(error)
78
- # $?.stub(:success?).and_return(false)
79
- # @sensors.refresh
80
- # after = @sensors.options.fetch('driver-type', false).should_not be_false
81
- #end
82
-
83
-
84
- end
85
-
@@ -1,77 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe "Bmc" do
5
-
6
- before :all do
7
- @path = '/usr/local/bin'
8
- end
9
-
10
- before :each do
11
- allow_message_expectations_on_nil
12
- provider = "ipmitool"
13
- user = "ipmiuser"
14
- pass = "impipass"
15
- host = "ipmihost"
16
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
17
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
18
- @bmc = @conn.bmc
19
- data = nil
20
- File.open("spec/fixtures/#{provider}/bmc_info.txt",'r') do |file|
21
- data = file.read
22
- end
23
-
24
- allow(@bmc).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
25
- allow(@bmc).to receive(:`).and_return(data)
26
- allow($?).to receive(:success?).and_return(true)
27
-
28
- allow(@bmc).to receive(:guid).and_return("guid")
29
-
30
- end
31
-
32
- it "bmc should not be nil" do
33
- expect(@bmc).not_to be nil
34
- end
35
-
36
- it "lan should not be nil" do
37
- expect(@bmc.lan).not_to be_nil
38
- end
39
-
40
- it "guid should not be nil" do
41
- expect(@bmc.guid).not_to be_nil
42
- end
43
-
44
- it "info should not be nil" do
45
- expect(@bmc.info).not_to be_nil
46
- end
47
-
48
- it "info should parse as expected" do
49
- expect(@bmc.info).to eq(RETRIEVE)
50
- end
51
-
52
- end
53
-
54
- RETRIEVE = {
55
- 'Device ID' => '17',
56
- 'Device Revision' => '1',
57
- 'Firmware Revision' => '2.9',
58
- 'IPMI Version' => '2.0',
59
- 'Manufacturer ID' => '11',
60
- 'Manufacturer Name' => 'Hewlett-Packard',
61
- 'Product ID' => '8192 (0x2000)',
62
- 'Product Name' => 'Unknown (0x2000)',
63
- 'Device Available' => 'yes',
64
- 'Provides Device SDRs' => 'yes',
65
- 'Additional Device Support' => [
66
- 'Sensor Device',
67
- 'SDR Repository Device',
68
- 'SEL Device',
69
- 'FRU Inventory Device'
70
- ],
71
- 'Aux Firmware Rev Info' => [
72
- '0x00',
73
- '0x00',
74
- '0x00',
75
- '0x30'
76
- ]
77
- }
@@ -1,121 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe :Connection do
4
-
5
- before :all do
6
- @path = '/usr/local/bin'
7
- @provider = "ipmitool"
8
- @user = "ipmiuser"
9
- @pass = "impipass"
10
- @host = "ipmihost"
11
- end
12
-
13
- before :each do
14
-
15
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
16
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true})
17
-
18
- end
19
-
20
- it "connection should not be nil" do
21
- expect(@conn).not_to be_nil
22
- end
23
-
24
- it "fru should not be nil" do
25
- expect(@conn.fru).not_to be_nil
26
- end
27
-
28
- it "provider should not be nil" do
29
- expect(@conn.provider).not_to be_nil
30
- end
31
-
32
- it "provider should be ipmitool" do
33
- expect(@conn.provider).to eq("ipmitool")
34
- end
35
-
36
- it "bmc should not be nil" do
37
- expect(@conn.bmc).not_to be_nil
38
- end
39
-
40
- it "sensors should not be nil" do
41
- expect(@conn.sensors).not_to be_nil
42
-
43
- end
44
-
45
- it "chassis should not be nill" do
46
- expect(@conn.chassis).not_to be_nil
47
- end
48
-
49
- it "provider should return ipmitool" do
50
- expect(@conn.provider).to eq("ipmitool")
51
- end
52
-
53
- it 'object should have driver set to auto if not specified' do
54
- expect(@conn.options.has_key?('driver-type')).to eq false
55
- end
56
-
57
- it 'object should have driver set to auto if not specified' do
58
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
59
- expect(@conn.options.has_key?('I')).to eq false
60
- end
61
-
62
- it 'should raise exception if invalid driver type' do
63
- expect{Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'foo'})}.to raise_error(RuntimeError)
64
- end
65
-
66
- it 'object should have priv type set to ADMINISTRATOR if not specified' do
67
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
68
- expect(@conn.options.has_key?('L')).to eq false
69
- end
70
-
71
- it 'object should have priv type set to USER ' do
72
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:privilege => 'USER', :debug => true, :driver => 'auto'})
73
- expect(@conn.options.fetch('L')).to eq('USER')
74
- end
75
-
76
- it 'should raise exception if invalid privilege type' do
77
- expect{Rubyipmi.connect(@user, @pass, @host, @provider,{:privilege => 'BLAH',:debug => true, :driver => 'auto'})}.to raise_error(RuntimeError)
78
- end
79
-
80
- it 'object should have driver set to lanplus' do
81
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'lan20'})
82
- expect(@conn.options['I']).to eq('lanplus')
83
- end
84
-
85
- it 'object should have driver set to lanplus' do
86
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'lan15'})
87
- expect(@conn.options['I']).to eq('lan')
88
- end
89
-
90
- it 'object should have driver set to open' do
91
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'open'})
92
- expect(@conn.options['I']).to eq('open')
93
- end
94
- describe 'test' do
95
- it 'should retrun boolean on test connection when result is not a hash' do
96
- conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
97
- bmc = double()
98
- allow(bmc).to receive(:info).and_return('')
99
- allow(conn).to receive(:bmc).and_return(bmc)
100
- expect(conn.connection_works?).to eq false
101
- end
102
-
103
- it 'should retrun boolean on test connection when result is a hash' do
104
- conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
105
- bmc = double()
106
- allow(bmc).to receive(:info).and_return({:test => true})
107
- allow(conn).to receive(:bmc).and_return(bmc)
108
- expect(conn.connection_works?).to eq true
109
- end
110
-
111
- it 'should retrun boolean on test connection when nil' do
112
- conn = Rubyipmi.connect(@user, @pass, @host, @provider,{:debug => true, :driver => 'auto'})
113
- bmc = double()
114
- allow(bmc).to receive(:info).and_return(nil)
115
- allow(conn).to receive(:bmc).and_return(bmc)
116
- expect(conn.connection_works?).to eq false
117
- end
118
- end
119
-
120
-
121
- end
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'rubyipmi/ipmitool/errorcodes'
4
-
5
- describe "Errorcodes" do
6
-
7
-
8
-
9
- it 'should return the length of fix hash' do
10
- expect(Rubyipmi::Ipmitool::ErrorCodes.length).to be > 1
11
- end
12
-
13
- it 'should return a hash of codes' do
14
- expect(Rubyipmi::Ipmitool::ErrorCodes.code).to be_an_instance_of Hash
15
-
16
- end
17
-
18
- it 'should return a fix if code is found' do
19
- code = 'Authentication type NONE not supported'
20
- expect(Rubyipmi::Ipmitool::ErrorCodes.search(code)).to eq({"I"=>"lanplus"})
21
- end
22
-
23
- it 'should throw and error if no fix is found' do
24
- code = 'Crap Shoot'
25
- expect {Rubyipmi::Ipmitool::ErrorCodes.search(code)}.to raise_error
26
- end
27
-
28
- it 'should throw and error when a bad code is given' do
29
- code = nil
30
- expect {Rubyipmi::Ipmitool::ErrorCodes.search(code)}.to raise_error
31
- end
32
-
33
-
34
-
35
- end