summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Barton <barton.tomas@gmail.com>2014-01-26 11:33:41 +0100
committerTomas Barton <barton.tomas@gmail.com>2014-01-26 18:26:34 +0100
commit5ce0dcda9776ada2b556f7e1de31702a32a9b318 (patch)
tree446fffb0137b8251a1f143f0c1206d39e14a46b4
parent550e78a4e673e89e5632c5b346952c47debbe36b (diff)
client spec
-rw-r--r--manifests/client/base.pp7
-rw-r--r--spec/classes/client_spec.rb42
2 files changed, 46 insertions, 3 deletions
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index 6687d65..4925c2d 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,9 +1,10 @@
class sshd::client::base {
# this is needed because the gid might have changed
file { '/etc/ssh/ssh_known_hosts':
- mode => '0644',
- owner => root,
- group => 0;
+ ensure => present,
+ mode => '0644',
+ owner => root,
+ group => 0;
}
# Now collect all server keys
diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb
new file mode 100644
index 0000000..bd3e35a
--- /dev/null
+++ b/spec/classes/client_spec.rb
@@ -0,0 +1,42 @@
+require 'spec_helper'
+
+describe 'sshd::client' do
+
+ shared_examples "a Linux OS" do
+ it { should contain_file('/etc/ssh/ssh_known_hosts').with(
+ {
+ 'ensure' => 'present',
+ 'owner' => 'root',
+ 'group' => '0',
+ 'mode' => '0644',
+ }
+ )}
+ end
+
+ context "Debian OS" do
+ let :facts do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistcodename => 'wheezy',
+ }
+ end
+ it_behaves_like "a Linux OS"
+ it { should contain_package('openssh-clients').with({
+ 'name' => 'openssh-client'
+ }) }
+ end
+
+ context "CentOS" do
+ it_behaves_like "a Linux OS" do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :osfamily => 'RedHat',
+ :lsbdistcodename => 'Final',
+ }
+ end
+ end
+ end
+
+end \ No newline at end of file