aboutsummaryrefslogtreecommitdiffstats
path: root/spec/classes/tripleo_profile_base_sshd_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/classes/tripleo_profile_base_sshd_spec.rb')
-rw-r--r--spec/classes/tripleo_profile_base_sshd_spec.rb52
1 files changed, 49 insertions, 3 deletions
diff --git a/spec/classes/tripleo_profile_base_sshd_spec.rb b/spec/classes/tripleo_profile_base_sshd_spec.rb
index 58b271f..6333e6b 100644
--- a/spec/classes/tripleo_profile_base_sshd_spec.rb
+++ b/spec/classes/tripleo_profile_base_sshd_spec.rb
@@ -26,7 +26,9 @@ describe 'tripleo::profile::base::sshd' do
it do
is_expected.to contain_class('ssh::server').with({
'storeconfigs_enabled' => false,
- 'options' => {}
+ 'options' => {
+ 'Port' => [22]
+ }
})
is_expected.to_not contain_file('/etc/issue')
is_expected.to_not contain_file('/etc/issue.net')
@@ -39,7 +41,9 @@ describe 'tripleo::profile::base::sshd' do
it do
is_expected.to contain_class('ssh::server').with({
'storeconfigs_enabled' => false,
- 'options' => {}
+ 'options' => {
+ 'Port' => [22]
+ }
})
is_expected.to_not contain_file('/etc/issue')
is_expected.to_not contain_file('/etc/issue.net')
@@ -47,13 +51,50 @@ describe 'tripleo::profile::base::sshd' do
end
end
+ context 'with port configured' do
+ let(:params) {{ :port => 123 }}
+ it do
+ is_expected.to contain_class('ssh::server').with({
+ 'storeconfigs_enabled' => false,
+ 'options' => {
+ 'Port' => [123]
+ }
+ })
+ end
+ end
+
+ context 'with port configured and port option' do
+ let(:params) {{ :port => 123, :options => {'Port' => 456} }}
+ it do
+ is_expected.to contain_class('ssh::server').with({
+ 'storeconfigs_enabled' => false,
+ 'options' => {
+ 'Port' => [456, 123]
+ }
+ })
+ end
+ end
+
+ context 'with port configured and same port option' do
+ let(:params) {{ :port => 123, :options => {'Port' => 123} }}
+ it do
+ is_expected.to contain_class('ssh::server').with({
+ 'storeconfigs_enabled' => false,
+ 'options' => {
+ 'Port' => [123]
+ }
+ })
+ end
+ end
+
context 'with issue and issue.net configured' do
let(:params) {{ :bannertext => 'foo' }}
it do
is_expected.to contain_class('ssh::server').with({
'storeconfigs_enabled' => false,
'options' => {
- 'Banner' => '/etc/issue.net'
+ 'Banner' => '/etc/issue.net',
+ 'Port' => [22]
}
})
is_expected.to contain_file('/etc/issue').with({
@@ -78,6 +119,7 @@ describe 'tripleo::profile::base::sshd' do
is_expected.to contain_class('ssh::server').with({
'storeconfigs_enabled' => false,
'options' => {
+ 'Port' => [22],
'PrintMotd' => 'yes'
}
})
@@ -98,6 +140,7 @@ describe 'tripleo::profile::base::sshd' do
is_expected.to contain_class('ssh::server').with({
'storeconfigs_enabled' => false,
'options' => {
+ 'Port' => [22],
'X11Forwarding' => 'no'
}
})
@@ -117,6 +160,7 @@ describe 'tripleo::profile::base::sshd' do
'storeconfigs_enabled' => false,
'options' => {
'Banner' => '/etc/issue.net',
+ 'Port' => [22],
'PrintMotd' => 'yes'
}
})
@@ -146,6 +190,7 @@ describe 'tripleo::profile::base::sshd' do
:bannertext => 'foo',
:motd => 'foo',
:options => {
+ 'Port' => [22],
'PrintMotd' => 'no', # this should be overridden
'X11Forwarding' => 'no'
}
@@ -155,6 +200,7 @@ describe 'tripleo::profile::base::sshd' do
'storeconfigs_enabled' => false,
'options' => {
'Banner' => '/etc/issue.net',
+ 'Port' => [22],
'PrintMotd' => 'yes',
'X11Forwarding' => 'no'
}