Merge pull request #19 from ghoneycutt/improve_spec_tests
Improve spec tests
This commit is contained in:
commit
62989c5c19
@ -31,9 +31,7 @@ describe 'ssh' do
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
it {
|
it { should contain_file('ssh_config').with_content(/^# This file is being maintained by Puppet.\n# DO NOT EDIT\n\n# \$OpenBSD: ssh_config,v 1.21 2005\/12\/06 22:38:27 reyk Exp \$/) }
|
||||||
should contain_file('ssh_config').with_content(/^# This file is being maintained by Puppet.\n# DO NOT EDIT\n\n# \$OpenBSD: ssh_config,v 1.21 2005\/12\/06 22:38:27 reyk Exp \$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it { should_not contain_file('ssh_config').with_content(/^\s*ForwardAgent$/) }
|
it { should_not contain_file('ssh_config').with_content(/^\s*ForwardAgent$/) }
|
||||||
it { should_not contain_file('ssh_config').with_content(/^\s*ForwardX11$/) }
|
it { should_not contain_file('ssh_config').with_content(/^\s*ForwardX11$/) }
|
||||||
@ -50,41 +48,15 @@ describe 'ssh' do
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
it {
|
it { should contain_file('sshd_config').with_content(/^SyslogFacility AUTH$/) }
|
||||||
should contain_file('sshd_config').with_content(/^SyslogFacility AUTH$/)
|
it { should contain_file('sshd_config').with_content(/^LoginGraceTime 120$/) }
|
||||||
}
|
it { should contain_file('sshd_config').with_content(/^PermitRootLogin no$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^ChallengeResponseAuthentication no$/) }
|
||||||
it {
|
it { should contain_file('sshd_config').with_content(/^PrintMotd yes$/) }
|
||||||
should contain_file('sshd_config').with_content(/^LoginGraceTime 120$/)
|
it { should contain_file('sshd_config').with_content(/^UseDNS yes$/) }
|
||||||
}
|
it { should contain_file('sshd_config').with_content(/^Banner none$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^XAuthLocation \/usr\/bin\/xauth$/) }
|
||||||
it {
|
it { should contain_file('sshd_config').with_content(/^Subsystem sftp \/usr\/libexec\/openssh\/sftp-server$/) }
|
||||||
should contain_file('sshd_config').with_content(/^PermitRootLogin no$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('sshd_config').with_content(/^ChallengeResponseAuthentication no$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('sshd_config').with_content(/^PrintMotd yes$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('sshd_config').with_content(/^UseDNS yes$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('sshd_config').with_content(/^Banner none$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('sshd_config').with_content(/^XAuthLocation \/usr\/bin\/xauth$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('sshd_config').with_content(/^Subsystem sftp \/usr\/libexec\/openssh\/sftp-server$/)
|
|
||||||
}
|
|
||||||
|
|
||||||
it {
|
it {
|
||||||
should contain_service('sshd_service').with({
|
should contain_service('sshd_service').with({
|
||||||
@ -137,6 +109,50 @@ describe 'ssh' do
|
|||||||
it { should contain_file('ssh_config').with_content(/^ ServerAliveInterval 300$/) }
|
it { should contain_file('ssh_config').with_content(/^ ServerAliveInterval 300$/) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with params used in sshd_config set on osfamily RedHat' do
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:fqdn => 'monkey.example.com',
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ=='
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:sshd_config_syslog_facility => 'DAEMON',
|
||||||
|
:sshd_config_login_grace_time => '60',
|
||||||
|
:permit_root_login => 'yes',
|
||||||
|
:sshd_config_challenge_resp_auth => 'yes',
|
||||||
|
:sshd_config_print_motd => 'no',
|
||||||
|
:sshd_config_use_dns => 'no',
|
||||||
|
:sshd_config_banner => '/etc/sshd_banner',
|
||||||
|
:sshd_config_xauth_location => '/opt/ssh/bin/xauth',
|
||||||
|
:sshd_config_subsystem_sftp => '/opt/ssh/bin/sftp',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it {
|
||||||
|
should contain_file('sshd_config').with({
|
||||||
|
'ensure' => 'file',
|
||||||
|
'path' => '/etc/ssh/sshd_config',
|
||||||
|
'owner' => 'root',
|
||||||
|
'group' => 'root',
|
||||||
|
'mode' => '0600',
|
||||||
|
'require' => 'Package[ssh_packages]',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
it { should contain_file('sshd_config').with_content(/^SyslogFacility DAEMON$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^LoginGraceTime 60$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^PermitRootLogin yes$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^ChallengeResponseAuthentication yes$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^PrintMotd no$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^UseDNS no$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^Banner \/etc\/sshd_banner$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^XAuthLocation \/opt\/ssh\/bin\/xauth$/) }
|
||||||
|
it { should contain_file('sshd_config').with_content(/^Subsystem sftp \/opt\/ssh\/bin\/sftp$/) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'with manage_root_ssh_config set to \'true\' on valid osfamily' do
|
context 'with manage_root_ssh_config set to \'true\' on valid osfamily' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{
|
{
|
||||||
@ -237,6 +253,7 @@ describe 'ssh' do
|
|||||||
'user' => 'root',
|
'user' => 'root',
|
||||||
}
|
}
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
it {
|
it {
|
||||||
should contain_ssh_authorized_key('root_for_userX').with({
|
should contain_ssh_authorized_key('root_for_userX').with({
|
||||||
'ensure' => 'present',
|
'ensure' => 'present',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user