-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'spec_helper' | ||
|
||
describe 'nftables::rules::out::puppet' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
let(:params) do | ||
{puppetserver: '1.2.3.4'} | ||
end | ||
|
||
context 'default options' do | ||
it { is_expected.to compile } | ||
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip daddr 1.2.3.4 tcp dport 8140 accept') } | ||
end | ||
context 'with different port' do | ||
let(:params) do | ||
super().merge({ puppetserver_port: 8141 }) | ||
end | ||
it { is_expected.to compile } | ||
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip daddr 1.2.3.4 tcp dport 8141 accept') } | ||
end | ||
context 'with ipv6 address' do | ||
let(:params) do | ||
{ puppetserver: 'fe80::1' } | ||
end | ||
it { is_expected.to compile } | ||
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip6 daddr fe80::1 tcp dport 8140 accept') } | ||
end | ||
context 'with ipv6 & ipv4 address' do | ||
let(:params) do | ||
{ puppetserver: ['fe80::1','1.2.3.4'] } | ||
end | ||
it { is_expected.to compile } | ||
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip6 daddr fe80::1 tcp dport 8140 accept') } | ||
it { is_expected.to contain_nftables__rule('default_out-puppet-1').with_content('ip daddr 1.2.3.4 tcp dport 8140 accept') } | ||
end | ||
end | ||
end | ||
end |