From ade44d5bd9baa4381024780db602de3d9e75fa28 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 18 Feb 2020 22:42:39 +0000 Subject: [PATCH] Add test for civicrm cookbook --- .kitchen.yml | 3 +++ .travis.yml | 3 +++ cookbooks/civicrm/recipes/default.rb | 6 +++++- test/data_bags/civicrm/passwords.json | 7 +++++++ .../civicrm/serverspec/apache_spec.rb | 21 +++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 test/data_bags/civicrm/passwords.json create mode 100644 test/integration/civicrm/serverspec/apache_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index d3f71ccfa..e383bd272 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -45,6 +45,9 @@ suites: - name: blogs run_list: - recipe[blogs::default] + - name: civicrm + run_list: + - recipe[civicrm::default] - name: clamav run_list: - recipe[clamav::default] diff --git a/.travis.yml b/.travis.yml index 4696f3700..25cf63dbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,9 @@ jobs: - name: "Test Kitchen (blogs)" script: - bundle exec kitchen test blogs-ubuntu-1804 + - name: "Test Kitchen (civicrm)" + script: + - bundle exec kitchen test civicrm-ubuntu-1804 - name: "Test Kitchen (clamav)" script: - bundle exec kitchen test clamav-ubuntu-1804 diff --git a/cookbooks/civicrm/recipes/default.rb b/cookbooks/civicrm/recipes/default.rb index 4486ea352..75e92f016 100644 --- a/cookbooks/civicrm/recipes/default.rb +++ b/cookbooks/civicrm/recipes/default.rb @@ -20,7 +20,11 @@ include_recipe "wordpress" include_recipe "mysql" -package "wkhtmltopdf" +package %w[ + rsync + unzip + wkhtmltopdf +] cache_dir = Chef::Config[:file_cache_path] diff --git a/test/data_bags/civicrm/passwords.json b/test/data_bags/civicrm/passwords.json new file mode 100644 index 000000000..fda558dd5 --- /dev/null +++ b/test/data_bags/civicrm/passwords.json @@ -0,0 +1,7 @@ +{ + "id": "passwords", + "database": "database-password", + "admin": "admin-password", + "key": "key", + "batch": "batch" +} diff --git a/test/integration/civicrm/serverspec/apache_spec.rb b/test/integration/civicrm/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/civicrm/serverspec/apache_spec.rb @@ -0,0 +1,21 @@ +require "serverspec" + +# Required by serverspec +set :backend, :exec + +describe package("apache2") do + it { should be_installed } +end + +describe service("apache2") do + it { should be_enabled } + it { should be_running } +end + +describe port(80) do + it { should be_listening.with("tcp") } +end + +describe port(443) do + it { should be_listening.with("tcp") } +end -- 2.43.2