]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/apache/spec/acceptance/prefork_worker_spec.rb
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / apache / spec / acceptance / prefork_worker_spec.rb
diff --git a/3rdparty/modules/apache/spec/acceptance/prefork_worker_spec.rb b/3rdparty/modules/apache/spec/acceptance/prefork_worker_spec.rb
new file mode 100644 (file)
index 0000000..0ac2723
--- /dev/null
@@ -0,0 +1,81 @@
+require 'spec_helper_acceptance'
+
+case fact('osfamily')
+when 'RedHat'
+  servicename = 'httpd'
+when 'Debian'
+  servicename = 'apache2'
+when 'FreeBSD'
+  servicename = 'apache24'
+when 'Gentoo'
+  servicename = 'apache2'
+end
+
+case fact('osfamily')
+when 'FreeBSD'
+  describe 'apache::mod::event class' do
+    describe 'running puppet code' do
+      # Using puppet_apply as a helper
+      it 'should work with no errors' do
+        pp = <<-EOS
+          class { 'apache':
+            mpm_module => 'event',
+          }
+        EOS
+
+        # Run it twice and test for idempotency
+        apply_manifest(pp, :catch_failures => true)
+        expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
+      end
+    end
+
+    describe service(servicename) do
+      it { is_expected.to be_running }
+      it { is_expected.to be_enabled }
+    end
+  end
+end
+
+describe 'apache::mod::worker class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+  describe 'running puppet code' do
+    # Using puppet_apply as a helper
+    it 'should work with no errors' do
+      pp = <<-EOS
+        class { 'apache':
+          mpm_module => 'worker',
+        }
+      EOS
+
+      # Run it twice and test for idempotency
+      apply_manifest(pp, :catch_failures => true)
+      expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
+    end
+  end
+
+  describe service(servicename) do
+    it { is_expected.to be_running }
+    it { is_expected.to be_enabled }
+  end
+end
+
+describe 'apache::mod::prefork class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+  describe 'running puppet code' do
+    # Using puppet_apply as a helper
+    it 'should work with no errors' do
+      pp = <<-EOS
+        class { 'apache':
+          mpm_module => 'prefork',
+        }
+      EOS
+
+      # Run it twice and test for idempotency
+      apply_manifest(pp, :catch_failures => true)
+      expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
+    end
+  end
+
+  describe service(servicename) do
+    it { is_expected.to be_running }
+    it { is_expected.to be_enabled }
+  end
+end