2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/bond"
|
2015-09-03 15:33:19 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::Bond" do
|
2015-09-03 15:33:19 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "check linux bond on ubuntu" do
|
2021-09-30 08:56:43 +00:00
|
|
|
resource = MockLoader.new(:ubuntu).load_resource("bond", "bond0")
|
2015-10-12 11:21:50 +00:00
|
|
|
# bond must be available
|
2022-06-02 08:06:58 +00:00
|
|
|
_(resource.resource_id).must_equal "/proc/net/bonding/bond0"
|
2019-09-30 22:31:55 +00:00
|
|
|
_(resource.exist?).must_equal true
|
2017-12-22 14:02:40 +00:00
|
|
|
# get bonding mode
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.mode).must_equal "IEEE 802.3ad Dynamic link aggregation"
|
2015-10-12 11:21:50 +00:00
|
|
|
# eth0 is part of bond
|
2019-06-11 22:24:35 +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
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.content).wont_equal ""
|
2015-09-03 15:33:19 +00:00
|
|
|
end
|
|
|
|
end
|