PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/test/cookbooks/iptables_ng_test/files/default/tests/minitest/lwrp_chain_create_default_test.rb

https://github.com/sewer2/cb-iptables-ng
Ruby | 22 lines | 17 code | 5 blank | 0 comment | 2 complexity | 1f8a1d0964f92e4b4f6412512b8d0221 MD5 | raw file
  1. require File.expand_path('../support/helpers', __FILE__)
  2. describe 'iptables-ng::lwrp_chain_create_default' do
  3. include Helpers::TestHelpers
  4. it 'should set default FORWARD policy to DROP' do
  5. file('/etc/iptables.d/filter/FORWARD/default').must_include('DROP [0:0]')
  6. end
  7. it 'should enable iptables serices' do
  8. service(node['iptables-ng']['service_ipv4']).must_be_enabled if node['iptables-ng']['service_ipv4']
  9. service(node['iptables-ng']['service_ipv6']).must_be_enabled if node['iptables-ng']['service_ipv6']
  10. end
  11. it 'should apply the specified iptables rules' do
  12. ipv4 = shell_out('iptables -L -n')
  13. ipv4.stdout.must_include('Chain FORWARD (policy DROP)')
  14. ipv6 = shell_out('ip6tables -L -n')
  15. ipv6.stdout.must_include('Chain FORWARD (policy DROP)')
  16. end
  17. end