Sha256: 24cd17f3ecaa061476023fc512dfdd2ed57974207c653d4b1ea3ffdc6ab5f276

Contents?: true

Size: 1.67 KB

Versions: 57

Compression:

Stored size: 1.67 KB

Contents

# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter

require 'helper'
require 'inspec/resource'

describe 'Inspec::Resources::Interface' do

  # ubuntu 14.04
  it 'verify interface on ubuntu' do
    resource = MockLoader.new(:ubuntu1404).load_resource('interface', 'eth0')
    _(resource.exists?).must_equal true
    _(resource.up?).must_equal true
    _(resource.speed).must_equal 10000
  end

  it 'verify invalid interface on ubuntu' do
    resource = MockLoader.new(:ubuntu1404).load_resource('interface', 'eth1')
    _(resource.exists?).must_equal false
    _(resource.up?).must_equal false
    _(resource.speed).must_equal nil
  end

  it 'verify interface on windows' do
    resource = MockLoader.new(:windows).load_resource('interface', 'ethernet0')
    _(resource.exists?).must_equal true
    _(resource.up?).must_equal false
    _(resource.speed).must_equal 0
  end

  it 'verify interface on windows' do
    resource = MockLoader.new(:windows).load_resource('interface', 'vEthernet (Intel(R) PRO 1000 MT Network Connection - Virtual Switch)')
    _(resource.exists?).must_equal true
    _(resource.up?).must_equal true
    _(resource.speed).must_equal 10000000
  end

  it 'verify invalid interface on windows' do
    resource = MockLoader.new(:windows).load_resource('interface', 'eth1')
    _(resource.exists?).must_equal false
    _(resource.up?).must_equal false
    _(resource.speed).must_equal nil
  end

  # undefined
  it 'verify interface on unsupported os' do
    resource = MockLoader.new(:undefined).load_resource('interface', 'eth0')
    _(resource.exists?).must_equal false
    _(resource.up?).must_equal false
    _(resource.speed).must_equal nil
  end

end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
inspec-0.30.0 test/unit/resources/interface_test.rb
inspec-0.29.0 test/unit/resources/interface_test.rb
inspec-0.28.1 test/unit/resources/interface_test.rb
inspec-0.28.0 test/unit/resources/interface_test.rb
inspec-0.27.1 test/unit/resources/interface_test.rb
inspec-0.27.0 test/unit/resources/interface_test.rb
inspec-0.26.0 test/unit/resources/interface_test.rb
inspec-0.25.0 test/unit/resources/interface_test.rb
inspec-0.24.0 test/unit/resources/interface_test.rb
inspec-0.23 test/unit/resources/interface_test.rb
inspec-0.22.1 test/unit/resources/interface_test.rb
inspec-0.22.0 test/unit/resources/interface_test.rb
inspec-0.21.6 test/unit/resources/interface_test.rb
inspec-0.21.5 test/unit/resources/interface_test.rb
inspec-0.21.4 test/unit/resources/interface_test.rb
inspec-0.21.3 test/unit/resources/interface_test.rb
inspec-0.21.2 test/unit/resources/interface_test.rb
inspec-0.21.1 test/unit/resources/interface_test.rb
inspec-0.21.0 test/unit/resources/interface_test.rb
inspec-0.20.1 test/unit/resources/interface_test.rb