inspec/test/unit/resources/bond_test.rb

26 lines
790 B
Ruby
Raw Normal View History

2015-10-06 16:55:44 +00:00
# author: Christoph Hartmann
# author: Dominik Richter
2015-09-03 15:33:19 +00:00
require 'helper'
2015-10-26 03:04:18 +00:00
require 'inspec/resource'
2015-09-03 15:33:19 +00:00
2015-10-26 03:04:18 +00:00
describe 'Inspec::Resources::Bond' do
2015-09-03 15:33:19 +00:00
2015-10-12 11:21:50 +00:00
it 'check linux bond on ubuntu' do
resource = MockLoader.new(:ubuntu1404).load_resource('bond', 'bond0')
# bond must be available
2015-09-22 16:33:05 +00:00
resource.exist?.must_equal true
# get bonding mode
_(resource.mode).must_equal 'IEEE 802.3ad Dynamic link aggregation'
2015-10-12 11:21:50 +00:00
# eth0 is part of bond
2015-09-22 16:33:05 +00:00
_(resource.has_interface?('eth0')).must_equal true
_(resource.has_interface?('eth1')).must_equal false
_(resource.has_interface?('eth2')).must_equal true
2015-10-12 11:21:50 +00:00
# get all interfaces
2015-09-22 16:33:05 +00:00
_(resource.interfaces).must_equal %w{eth0 eth2}
2015-10-12 11:21:50 +00:00
# get proc content
2015-09-22 16:33:05 +00:00
_(resource.content).wont_equal nil
_(resource.content).wont_equal ''
2015-09-03 15:33:19 +00:00
end
end