Skip to content

Commit

Permalink
Rewrite ssh expectations to allow easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Apr 30, 2020
1 parent 38e2526 commit 92b6eaa
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,22 @@ class { 'fail2ban': }
apply_manifest(pp, catch_failures: true)
end

context 'is expected to modify sshd port' do
describe file(config_file_path) do
its(:content) { is_expected.to match %r{^port\s+\=\s+ssh,2200$} }
it 'is expected to modify sshd port' do
shell("grep \"\\[sshd\\]\" -A 10 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2200$}
end
end

context 'is expected to modify dropbear port' do
describe file(config_file_path) do
its(:content) { is_expected.to match %r{^port\s+\=\s+ssh,2201$} }
it 'is expected to modify dropbear port' do
shell("grep \"\\[dropbear\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2201$}
end
end

context 'is expected to modify selinux-ssh port' do
unless os[:family] == 'debian' and os[:release] == 8
describe file(config_file_path) do
its(:content) { is_expected.to match %r{^port\s+\=\s+ssh,2202$} }
it 'is expected to modify selinux-ssh port' do
unless fact('os.family') == 'Debian' && fact('os.release.major') == '8'
shell("grep \"\\[selinux-ssh\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2202$}
end
end
end
Expand Down

0 comments on commit 92b6eaa

Please sign in to comment.