mirror of
https://github.com/inspec/inspec
synced 2024-12-26 21:13:25 +00:00
4270eb8e80
`must_equal nil` will fail in MiniTest 6. Changing those to `must_be_nil` quiets down all the warnings we currently see and preps us for Minitest 6. Signed-off-by: Adam Leff <adam@leff.co>
56 lines
1.8 KiB
Ruby
56 lines
1.8 KiB
Ruby
# encoding: utf-8
|
|
# author: Christoph Hartmann
|
|
# author: Dominik Richter
|
|
|
|
require 'helper'
|
|
require 'inspec/resource'
|
|
|
|
describe 'Inspec::Resources::Bridge' do
|
|
|
|
it 'check linux bridge on ubuntu' do
|
|
resource = MockLoader.new(:ubuntu1404).load_resource('bridge', 'br0')
|
|
_(resource.exists?).must_equal true
|
|
|
|
# check network interfaced attached to bridge
|
|
_(resource.has_interface?('eth0')).must_equal false
|
|
_(resource.has_interface?('eth1')).must_equal true
|
|
_(resource.has_interface?('eth2')).must_equal true
|
|
|
|
# get associated interfaces
|
|
_(resource.interfaces).must_equal %w{eth1 eth2}
|
|
end
|
|
|
|
it 'check linux bridge on centos 7' do
|
|
resource = MockLoader.new(:centos7).load_resource('bridge', 'br0')
|
|
_(resource.exists?).must_equal true
|
|
|
|
# check network interfaced attached to bridge
|
|
_(resource.has_interface?('eth0')).must_equal false
|
|
_(resource.has_interface?('eth1')).must_equal true
|
|
_(resource.has_interface?('eth2')).must_equal true
|
|
|
|
# get associated interfaces
|
|
_(resource.interfaces).must_equal %w{eth1 eth2}
|
|
end
|
|
|
|
it 'check windows bridge' do
|
|
resource = MockLoader.new(:windows).load_resource('bridge', 'Network Bridge')
|
|
_(resource.exists?).must_equal true
|
|
|
|
# get associated interfaces is not supported on windows
|
|
_(resource.interfaces).must_be_nil
|
|
end
|
|
|
|
it 'check bridge on unsupported os' do
|
|
resource = MockLoader.new(:undefined).load_resource('bridge', 'br0')
|
|
_(resource.exists?).must_equal false
|
|
|
|
# check network interfaced attached to bridge
|
|
_(resource.has_interface?('eth0')).must_equal false
|
|
_(resource.has_interface?('eth1')).must_equal false
|
|
_(resource.has_interface?('eth2')).must_equal false
|
|
|
|
# get associated interfaces
|
|
_(resource.interfaces).must_be_nil
|
|
end
|
|
end
|