Skip to content

Commit

Permalink
Regression test for conditions with regex chars
Browse files Browse the repository at this point in the history
  • Loading branch information
traylenator committed Aug 6, 2024
1 parent bd5ad45 commit b5ad38b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/unit/puppet/provider/sshd_config_match/augeas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,38 @@
end
end

context 'with condition containing regex chars' do
let(:tmptarget) { aug_fixture('empty') }
let(:target) { tmptarget.path }

it 'creates simple new entry' do
apply!(Puppet::Type.type(:sshd_config_match).new(
name: 'Host *',
target: target,
ensure: :present,
provider: 'augeas'
))

aug_open(target, 'Sshd.lns') do |aug|
expect(aug.get('Match/Condition/Host')).to eq('*')
end
end

it 'creates new comment before entry' do
apply!(Puppet::Type.type(:sshd_config_match).new(
name: 'Host *',
target: target,
ensure: :present,
comment: 'manage host *',
provider: 'augeas'
))

aug_open(target, 'Sshd.lns') do |aug|
expect(aug.get('Match[Condition/Host]/Settings/#comment')).to eq('Host *: manage host *')
end
end
end

context 'with full file' do
let(:tmptarget) { aug_fixture('full') }
let(:target) { tmptarget.path }
Expand Down

0 comments on commit b5ad38b

Please sign in to comment.