From 76bec6dcb9b65dd84f54d243101513b2c36cae52 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 27 Oct 2016 21:27:03 +0100 Subject: [PATCH] Add tests for the forum cookbook --- .kitchen.yml | 4 ++++ test/data_bags/accounts/forum.json | 6 ++++++ test/data_bags/forum/passwords.json | 5 +++++ .../forum/serverspec/apache_spec.rb | 21 +++++++++++++++++++ .../forum/serverspec/mysql_spec.rb | 17 +++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 test/data_bags/accounts/forum.json create mode 100644 test/data_bags/forum/passwords.json create mode 100644 test/integration/forum/serverspec/apache_spec.rb create mode 100644 test/integration/forum/serverspec/mysql_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index fede9d89a..b800b89a3 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -28,6 +28,10 @@ suites: - name: bind run_list: - recipe[bind::default] + - name: forum + run_list: + - recipe[accounts::default] + - role[forum] - name: munin run_list: - recipe[munin::default] diff --git a/test/data_bags/accounts/forum.json b/test/data_bags/accounts/forum.json new file mode 100644 index 000000000..12c9e3837 --- /dev/null +++ b/test/data_bags/accounts/forum.json @@ -0,0 +1,6 @@ +{ + "id": "forum", + "uid": "522", + "comment": "Forum", + "manage_home": false +} diff --git a/test/data_bags/forum/passwords.json b/test/data_bags/forum/passwords.json new file mode 100644 index 000000000..384f48105 --- /dev/null +++ b/test/data_bags/forum/passwords.json @@ -0,0 +1,5 @@ +{ + "id": "passwords", + "database": "database-password", + "cookie_seed": "cookie-seed" +} diff --git a/test/integration/forum/serverspec/apache_spec.rb b/test/integration/forum/serverspec/apache_spec.rb new file mode 100644 index 000000000..9d5268271 --- /dev/null +++ b/test/integration/forum/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 } +end + +describe port(443) do + it { should be_listening } +end diff --git a/test/integration/forum/serverspec/mysql_spec.rb b/test/integration/forum/serverspec/mysql_spec.rb new file mode 100644 index 000000000..68e63582b --- /dev/null +++ b/test/integration/forum/serverspec/mysql_spec.rb @@ -0,0 +1,17 @@ +require "serverspec" + +# Required by serverspec +set :backend, :exec + +describe package("mysql-server") do + it { should be_installed } +end + +describe service("mysql") do + it { should be_enabled } + it { should be_running } +end + +describe port(3306) do + it { should be_listening } +end -- 2.39.5