From 2b2961718a325af20aa7de5df922907f39c350c4 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 14 Feb 2020 16:06:16 +0000 Subject: [PATCH] Add test for donate cookbook --- .kitchen.yml | 7 +++++++ .travis.yml | 3 +++ test/data_bags/accounts/donate.json | 5 +++++ test/data_bags/donate/passwords.json | 4 ++++ .../donate/serverspec/apache_spec.rb | 21 +++++++++++++++++++ .../donate/serverspec/mysql_spec.rb | 17 +++++++++++++++ 6 files changed, 57 insertions(+) create mode 100644 test/data_bags/accounts/donate.json create mode 100644 test/data_bags/donate/passwords.json create mode 100644 test/integration/donate/serverspec/apache_spec.rb create mode 100644 test/integration/donate/serverspec/mysql_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 22cd1a636..89cbf3aba 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -72,6 +72,13 @@ suites: attributes: apache: mpm: prefork + - name: donate + run_list: + - recipe[accounts::default] + - role[donate] + attributes: + apache: + mpm: prefork - name: exim run_list: - recipe[exim::default] diff --git a/.travis.yml b/.travis.yml index 67fe98a19..9624f4c9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,9 @@ jobs: - name: "Test Kitchen (dmca)" script: - bundle exec kitchen test dmca-ubuntu-1804 + - name: "Test Kitchen (donate)" + script: + - bundle exec kitchen test donate-ubuntu-1804 - name: "Test Kitchen (exim)" script: - bundle exec kitchen test exim-ubuntu-1804 diff --git a/test/data_bags/accounts/donate.json b/test/data_bags/accounts/donate.json new file mode 100644 index 000000000..a0fdfcc02 --- /dev/null +++ b/test/data_bags/accounts/donate.json @@ -0,0 +1,5 @@ +{ + "id": "donate", + "uid": "524", + "comment": "OSMF Donations" +} diff --git a/test/data_bags/donate/passwords.json b/test/data_bags/donate/passwords.json new file mode 100644 index 000000000..5cfde8ec5 --- /dev/null +++ b/test/data_bags/donate/passwords.json @@ -0,0 +1,4 @@ +{ + "id": "passwords", + "database": "database-password" +} diff --git a/test/integration/donate/serverspec/apache_spec.rb b/test/integration/donate/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/donate/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 diff --git a/test/integration/donate/serverspec/mysql_spec.rb b/test/integration/donate/serverspec/mysql_spec.rb new file mode 100644 index 000000000..b0738f997 --- /dev/null +++ b/test/integration/donate/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.with("tcp") } +end -- 2.39.5