]> gitweb.fluxo.info Git - puppet-sshd.git/commitdiff
client spec
authorTomas Barton <barton.tomas@gmail.com>
Sun, 26 Jan 2014 10:33:41 +0000 (11:33 +0100)
committerTomas Barton <barton.tomas@gmail.com>
Sun, 26 Jan 2014 17:26:34 +0000 (18:26 +0100)
manifests/client/base.pp
spec/classes/client_spec.rb [new file with mode: 0644]

index 6687d657cec76a523a1e9bb60c09ad842a4bf3b7..4925c2d07ca61178528b71f30b80638e803a7395 100644 (file)
@@ -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 (file)
index 0000000..bd3e35a
--- /dev/null
@@ -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