Projet

Général

Profil

Révision c82b960a

IDc82b960ad4293947acbff27429bad5639d3a4692
Parent 20eaf3c2
Enfant 6c2f0f10

Ajouté par Steve Traylen il y a plus de 3 ans

rubocop:auto_correct results

Voir les différences:

spec/classes/masquerade_spec.rb
1
# frozen_string_literal: true
2

  
1 3
require 'spec_helper'
2 4

  
3 5
describe 'nftables' do
......
35 37
        it { is_expected.to compile }
36 38

  
37 39
        it {
38
          is_expected.to contain_concat('nftables-ip-nat-chain-POSTROUTING').with(
39
            path:           '/etc/nftables/puppet-preflight/ip-nat-chain-POSTROUTING.nft',
40
            owner:          'root',
41
            group:          'root',
42
            mode:           '0640',
40
          expect(subject).to contain_concat('nftables-ip-nat-chain-POSTROUTING').with(
41
            path: '/etc/nftables/puppet-preflight/ip-nat-chain-POSTROUTING.nft',
42
            owner: 'root',
43
            group: 'root',
44
            mode: '0640',
43 45
            ensure_newline: true
44 46
          )
45 47
        }
48

  
46 49
        it {
47
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with(
48
            target:  'nftables-ip-nat-chain-POSTROUTING',
50
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with(
51
            target: 'nftables-ip-nat-chain-POSTROUTING',
49 52
            content: %r{^chain POSTROUTING \{$},
50
            order:   '00'
53
            order: '00'
51 54
          )
52 55
        }
56

  
53 57
        it {
54
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with(
55
            target:  'nftables-ip-nat-chain-POSTROUTING',
58
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with(
59
            target: 'nftables-ip-nat-chain-POSTROUTING',
56 60
            content: %r{^  type nat hook postrouting priority 100$},
57
            order:   '01-nftables-ip-nat-chain-POSTROUTING-rule-type-b'
61
            order: '01-nftables-ip-nat-chain-POSTROUTING-rule-type-b'
58 62
          )
59 63
        }
64

  
60 65
        it {
61
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with(
62
            target:  'nftables-ip-nat-chain-POSTROUTING',
66
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with(
67
            target: 'nftables-ip-nat-chain-POSTROUTING',
63 68
            content: %r{^  policy accept$},
64
            order:   '02-nftables-ip-nat-chain-POSTROUTING-rule-policy-b'
69
            order: '02-nftables-ip-nat-chain-POSTROUTING-rule-policy-b'
65 70
          )
66 71
        }
72

  
67 73
        it {
68
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth0').with(
69
            target:  'nftables-ip-nat-chain-POSTROUTING',
74
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth0').with(
75
            target: 'nftables-ip-nat-chain-POSTROUTING',
70 76
            content: %r{^  oifname eth0 masquerade$},
71
            order:   '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth0-b'
77
            order: '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth0-b'
72 78
          )
73 79
        }
80

  
74 81
        it {
75
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth1_vpn').with(
76
            target:  'nftables-ip-nat-chain-POSTROUTING',
77
            content: %r{^  oifname eth1 ip saddr 192\.0\.2\.0\/24 masquerade$},
78
            order:   '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth1_vpn-b'
82
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth1_vpn').with(
83
            target: 'nftables-ip-nat-chain-POSTROUTING',
84
            content: %r{^  oifname eth1 ip saddr 192\.0\.2\.0/24 masquerade$},
85
            order: '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_eth1_vpn-b'
79 86
          )
80 87
        }
88

  
81 89
        it {
82
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh').with(
83
            target:  'nftables-ip-nat-chain-POSTROUTING',
84
            content: %r{^  ip saddr 192\.0\.2\.0\/24 ip daddr 198.51.100.2 tcp dport 22 masquerade$},
85
            order:   '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh-b'
90
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh').with(
91
            target: 'nftables-ip-nat-chain-POSTROUTING',
92
            content: %r{^  ip saddr 192\.0\.2\.0/24 ip daddr 198.51.100.2 tcp dport 22 masquerade$},
93
            order: '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh-b'
86 94
          )
87 95
        }
96

  
88 97
        it {
89
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh_gitlab').with(
90
            target:  'nftables-ip-nat-chain-POSTROUTING',
91
            content: %r{^  ip saddr 192\.0\.2\.0\/24 ip daddr 198.51.100.2 tcp dport 22 masquerade$},
92
            order:   '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh_gitlab-b'
98
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh_gitlab').with(
99
            target: 'nftables-ip-nat-chain-POSTROUTING',
100
            content: %r{^  ip saddr 192\.0\.2\.0/24 ip daddr 198.51.100.2 tcp dport 22 masquerade$},
101
            order: '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_ssh_gitlab-b'
93 102
          )
94 103
        }
104

  
95 105
        it {
96
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_wireguard').with(
97
            target:  'nftables-ip-nat-chain-POSTROUTING',
106
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade_wireguard').with(
107
            target: 'nftables-ip-nat-chain-POSTROUTING',
98 108
            content: %r{^  udp dport 51820 masquerade$},
99
            order:   '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_wireguard-b'
109
            order: '70-nftables-ip-nat-chain-POSTROUTING-rule-masquerade_wireguard-b'
100 110
          )
101 111
        }
112

  
102 113
        it {
103
          is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with(
104
            target:  'nftables-ip-nat-chain-POSTROUTING',
114
          expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with(
115
            target: 'nftables-ip-nat-chain-POSTROUTING',
105 116
            content: %r{^\}$},
106
            order:   '99'
117
            order: '99'
107 118
          )
108 119
        }
109 120
      end

Formats disponibles : Unified diff