Sha256: 580b8f19c9b16f00f7644ae5417211f728e7b45a7bcd1ca262c4f33d530ec0c7

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "rubyipmi" do
  before :each do
    @user ||= ENV["ipmiuser"] || "admin"
    @pass ||= ENV["ipmipass"] || "password"
    @host ||= ENV["ipmihost"] || "10.0.1.16"
    @provider ||= ENV["ipmiprovider"] || "ipmitool"
    @conn = Rubyipmi.connect(@user, @pass, @host, @provider)

    end
  it "creates a connection object" do
    conn = Rubyipmi.connect(@user, @pass, @host, @provider)
    conn.should_not be_nil
  end

  it "should test if a provider is present" do
    value = Rubyipmi.is_provider_installed?("ipmitool")
    value2 = Rubyipmi.is_provider_installed?("freeipmi")
    (value|value2).should_not be false

  end

    it "should create a connection object if freeipmi is present" do
      begin
        conn = Rubyipmi.connect(@user, @pass, @host, "freeipmi")
        conn.kind_of?(Rubyipmi::Freeipmi::Connection).should be_true
      rescue Exception => e
        e.message.match(/freeipmi\ is\ not\ installed/).should be_true
        puts "#{e.message}"
      end
    end

    it "should create a connection object if ipmitool is present" do
      begin
        conn = Rubyipmi.connect(@user, @pass, @host, "ipmitool")
      rescue Exception => e
        e.message.match(/ipmitool\ is\ not\ installed/).should be_true
        puts "#{e.message}"
        return true
      end
      conn.kind_of?(Rubyipmi::Ipmitool::Connection).should be_true
    end

  it "should not create a connection object if a provider is not present" do
    begin
      conn = Rubyipmi.connect(@user, @pass, @host, "bogus")
    rescue Exception => e
        e.message.match(/Invalid/).should be_true
    end
  end

  it "check to find any available installed providers" do
    Rubyipmi.providers_installed?.length.should be > 0
  end



end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyipmi-0.8.1 spec/integration/rubyipmi_spec.rb
rubyipmi-0.7.0 spec/integration/rubyipmi_spec.rb