-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added acceptance tests for an ssh instance
- Loading branch information
Simon Hoenscheid
committed
Mar 18, 2022
1 parent
85c0089
commit 8b563a5
Showing
3 changed files
with
103 additions
and
0 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,68 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'ssh' do | ||
context 'with defaults' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
'include ssh' | ||
end | ||
|
||
describe package('openssh-server') do | ||
it { is_expected.to be_installed } | ||
end | ||
describe port(22) do | ||
it { is_expected.to be_listening } | ||
end | ||
describe service('sshd') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
end | ||
end | ||
context 'Server with a seperate sftp_server_init instance on Port 8022' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'ssh': | ||
'server_instances' => { | ||
'sftp_server_init' => { | ||
'ensure' => 'present', | ||
'options' => { | ||
'sshd_config' => { | ||
'Port' => 8022, | ||
'Protocol' => 2, | ||
'AddressFamily' => 'any', | ||
'HostKey' => '/etc/ssh/ssh_host_rsa_key', | ||
'SyslogFacility' => 'AUTH', | ||
'LogLevel' => 'INFO', | ||
'PermitRootLogin' => 'no', | ||
}, | ||
'sshd_service_options' => '', | ||
'match_blocks' => {}, | ||
}, | ||
}, | ||
}, | ||
} | ||
PUPPET | ||
end | ||
|
||
it 'works idempotently with no errors' do | ||
apply_manifest(manifest, catch_failures: true) | ||
apply_manifest(manifest, catch_changes: true) | ||
end | ||
|
||
describe package('openssh-server') do | ||
it { is_expected.to be_installed } | ||
end | ||
describe port(8022) do | ||
it { is_expected.to be_listening } | ||
end | ||
describe service('sftp_server_init') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
end | ||
end | ||
end |
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,5 @@ | ||
require 'voxpupuli/acceptance/spec_helper_acceptance' | ||
|
||
configure_beaker | ||
|
||
Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } |