Sha256: 6cce5dedbe2bb66aa877e18171fa1c1a6daf8fc3321a0d645673bfdab795fe00

Contents?: true

Size: 1.69 KB

Versions: 13

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper_system'

# Here we want to test the the resource commands ability to work with different
# existing ruleset scenarios. This will give the parsing capabilities of the
# code a good work out.
describe 'puppet resource firewall command:' do
  context 'make sure it returns no errors when executed on a clean machine' do
    context puppet_resource('firewall') do
      its(:exit_code) { should be_zero }
      # don't check stdout, some boxes come with rules, that is normal
      its(:stderr) { should be_empty }
    end
  end

  context 'flush iptables and make sure it returns nothing afterwards' do
    before :all do
      iptables_flush_all_tables
    end

    # No rules, means no output thanks. And no errors as well.
    context puppet_resource('firewall') do
      its(:exit_code) { should be_zero }
      its(:stderr) { should be_empty }
      its(:stdout) { should == "\n" }
    end
  end

  context 'accepts rules without comments' do
    before :all do
      iptables_flush_all_tables
      shell('/sbin/iptables -A INPUT -j ACCEPT -p tcp --dport 80')
    end

    context puppet_resource('firewall') do |r|
      its(:exit_code) { should be_zero }
      # don't check stdout, testing preexisting rules, output is normal
      its(:stderr) { should be_empty }
    end
  end

  context 'accepts rules with invalid comments' do
    before :all do
      iptables_flush_all_tables
      shell('/sbin/iptables -A INPUT -j ACCEPT -p tcp --dport 80 -m comment --comment "http"')
    end

    context puppet_resource('firewall') do
      its(:exit_code) { should be_zero }
      # don't check stdout, testing preexisting rules, output is normal
      its(:stderr) { should be_empty }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
freighthop-0.3.3 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.3.2 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.3.1 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.3.0 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.2.1 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.2.0 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.1.0 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.0.6 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.0.5 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.0.4 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.0.3 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.0.2 modules/firewall/spec/system/resource_cmd_spec.rb
freighthop-0.0.1 modules/firewall/spec/system/resource_cmd_spec.rb