PageRenderTime 54ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/sewer2/cb-iptables-ng
Ruby | 22 lines | 17 code | 5 blank | 0 comment | 2 complexity | f00ba3e2556081b96daccddf10b8c0b9 MD5 | raw file
  1. require File.expand_path('../support/helpers', __FILE__)
  2. describe 'iptables-ng::lwrp_chaincreate_custom' do
  3. include Helpers::TestHelpers
  4. it 'should set default mangle FORARD policy to DROP' do
  5. file('/etc/iptables.d/mangle/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 -t mangle -L -n')
  13. ipv4.stdout.must_include('Chain FORWARD (policy DROP)')
  14. ipv6 = shell_out('ip6tables -t mangle -L -n')
  15. ipv6.stdout.must_include('Chain FORWARD (policy DROP)')
  16. end
  17. end