root / spec / classes / rules / out / puppet_spec.rb @ 53aa1fa8
Historique | Voir | Annoter | Télécharger (1,51 ko)
1 |
# frozen_string_literal: true
|
---|---|
2 |
|
3 |
require 'spec_helper'
|
4 |
|
5 |
describe 'nftables::rules::out::puppet' do |
6 |
on_supported_os.each do |os, os_facts|
|
7 |
context "on #{os}" do |
8 |
let(:facts) { os_facts }
|
9 |
let(:params) do |
10 |
{ puppetserver: '1.2.3.4' } |
11 |
end
|
12 |
|
13 |
context 'default options' do |
14 |
it { is_expected.to compile } |
15 |
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip daddr 1.2.3.4 tcp dport 8140 accept') } |
16 |
end
|
17 |
|
18 |
context 'with different port' do |
19 |
let(:params) do |
20 |
super().merge({ puppetserver_port: 8141 }) |
21 |
end
|
22 |
|
23 |
it { is_expected.to compile } |
24 |
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip daddr 1.2.3.4 tcp dport 8141 accept') } |
25 |
end
|
26 |
|
27 |
context 'with ipv6 address' do |
28 |
let(:params) do |
29 |
{ puppetserver: 'fe80::1' } |
30 |
end
|
31 |
|
32 |
it { is_expected.to compile } |
33 |
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip6 daddr fe80::1 tcp dport 8140 accept') } |
34 |
end
|
35 |
|
36 |
context 'with ipv6 & ipv4 address' do |
37 |
let(:params) do |
38 |
{ puppetserver: ['fe80::1', '1.2.3.4'] } |
39 |
end
|
40 |
|
41 |
it { is_expected.to compile } |
42 |
it { is_expected.to contain_nftables__rule('default_out-puppet-0').with_content('ip6 daddr fe80::1 tcp dport 8140 accept') } |
43 |
it { is_expected.to contain_nftables__rule('default_out-puppet-1').with_content('ip daddr 1.2.3.4 tcp dport 8140 accept') } |
44 |
end
|
45 |
end
|
46 |
end
|
47 |
end
|