]> gitweb.fluxo.info Git - puppet-sshd.git/commitdiff
basic init class specs
authorTomas Barton <barton.tomas@gmail.com>
Sun, 26 Jan 2014 10:19:11 +0000 (11:19 +0100)
committerTomas Barton <barton.tomas@gmail.com>
Sun, 26 Jan 2014 17:26:34 +0000 (18:26 +0100)
manifests/base.pp
spec/classes/init_spec.rb

index ef066e0d1871ca74dac7eb36160abf2ff487c1ba..a0f1872f47086d32e7b99c2c5f1bdfdf59a17705 100644 (file)
@@ -6,6 +6,7 @@ class sshd::base {
   }
 
   file { 'sshd_config':
+    ensure  => present,
     path    => '/etc/ssh/sshd_config',
     content => $sshd_config_content,
     notify  => Service[sshd],
index c1d9b6f6a60c37f8e7d79a8567fc0892b4925f98..794a92e6472add34a6201b31e6d189715c55c049 100644 (file)
@@ -7,6 +7,21 @@ describe 'sshd' do
     it { should compile.with_all_deps }
     it { should contain_class('sshd') }
     it { should contain_class('sshd::client') }
+
+    it { should contain_service('sshd').with(
+      :ensure     => 'running',
+      :enable     => true,
+      :hasstatus  => true,
+    )}
+
+    it { should contain_file('sshd_config').with(
+      {
+        'ensure'  => 'present',
+        'owner'   => 'root',
+        'group'   => '0',
+        'mode'    => '0600',
+      }
+    )}
   end
 
   context "Debian OS" do
@@ -19,6 +34,83 @@ describe 'sshd' do
     end
     it_behaves_like "a Linux OS"
     it { should contain_package('lsb-release') }
+    it { should contain_package('openssh') }
+    it { should contain_class('sshd::debian') }
+    it { should contain_service('sshd').with(
+      :hasrestart => true
+    )}
+
+    context "Ubuntu" do
+      let :facts do
+        {
+          :operatingsystem => 'Ubuntu',
+          :lsbdistcodename => 'precise',
+        }
+      end
+      it_behaves_like "a Linux OS"
+      it { should contain_package('lsb-release') }
+      it { should contain_package('openssh') }
+      it { should contain_service('sshd').with(
+        :hasrestart => true
+      )}
+    end
   end
 
+
+#  context "RedHat OS" do
+#    it_behaves_like "a Linux OS" do
+#      let :facts do
+#        {
+#          :operatingsystem => 'RedHat',
+#          :osfamily        => 'RedHat',
+#        }
+#      end
+#    end
+#  end
+
+  context "CentOS" do
+    it_behaves_like "a Linux OS" do
+      let :facts do
+        {
+        :operatingsystem => 'CentOS',
+        :osfamily        => 'RedHat',
+        :lsbdistcodename => 'Final',
+       }
+      end
+    end
+  end
+
+  context "Gentoo" do
+    let :facts do
+    {
+      :operatingsystem => 'Gentoo',
+      :osfamily        => 'Gentoo',
+    }
+    end
+    it_behaves_like "a Linux OS"
+    it { should contain_class('sshd::gentoo') }
+  end
+
+  context "OpenBSD" do
+    let :facts do
+      {
+      :operatingsystem => 'OpenBSD',
+      :osfamily        => 'OpenBSD',
+     }
+    end
+    it_behaves_like "a Linux OS"
+    it { should contain_class('sshd::openbsd') }
+  end
+
+#  context "FreeBSD" do
+#    it_behaves_like "a Linux OS" do
+#      let :facts do
+#        {
+#        :operatingsystem => 'FreeBSD',
+#        :osfamily        => 'FreeBSD',
+#       }
+#      end
+#    end
+#  end
+
 end
\ No newline at end of file