Sha256: b266c5091a0a53e03d30c1fbedc639e1ee6a1345c7f3641f55da97ae534d9f46

Contents?: true

Size: 1.4 KB

Versions: 7

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper_acceptance'

# Some tests for the standard recommended usage
describe 'standard usage tests:' do
  it 'applies twice' do
    pp = <<-EOS
      class my_fw::pre {
        Firewall {
          require => undef,
        }

        # Default firewall rules
        firewall { '000 accept all icmp':
          proto   => 'icmp',
          action  => 'accept',
        }->
        firewall { '001 accept all to lo interface':
          proto   => 'all',
          iniface => 'lo',
          action  => 'accept',
        }->
        firewall { '002 accept related established rules':
          proto   => 'all',
          ctstate => ['RELATED', 'ESTABLISHED'],
          action  => 'accept',
        }
      }
      class my_fw::post {
        firewall { '999 drop all':
          proto   => 'all',
          action  => 'drop',
          before  => undef,
        }
      }
      resources { "firewall":
        purge => true
      }
      Firewall {
        before  => Class['my_fw::post'],
        require => Class['my_fw::pre'],
      }
      class { ['my_fw::pre', 'my_fw::post']: }
      class { 'firewall': }
      firewall { '500 open up port 22':
        action => 'accept',
        proto => 'tcp',
        dport => 22,
      }
    EOS

    # Run it twice and test for idempotency
    apply_manifest(pp, :catch_failures => true)
    expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
freighthop-0.6.1 modules/firewall/spec/acceptance/standard_usage_spec.rb
freighthop-0.6.0 modules/firewall/spec/acceptance/standard_usage_spec.rb
freighthop-0.5.2 modules/firewall/spec/acceptance/standard_usage_spec.rb
freighthop-0.5.1 modules/firewall/spec/acceptance/standard_usage_spec.rb
freighthop-0.5.0 modules/firewall/spec/acceptance/standard_usage_spec.rb
freighthop-0.4.1 modules/firewall/spec/acceptance/standard_usage_spec.rb
freighthop-0.4.0 modules/firewall/spec/acceptance/standard_usage_spec.rb