inspec/test/unit/resources/bond_test.rb

24 lines
765 B
Ruby
Raw Normal View History

require "helper"
require "inspec/resource"
require "inspec/resources/bond"
2015-09-03 15:33:19 +00:00
describe "Inspec::Resources::Bond" do
2015-09-03 15:33:19 +00:00
it "check linux bond on ubuntu" do
resource = MockLoader.new(:ubuntu).load_resource("bond", "bond0")
2015-10-12 11:21:50 +00:00
# bond must be available
_(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
_(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