From fc362f4ab0e13f45d9c1f1c3c0b8c21177ce4e92 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 12 Jan 2023 11:45:09 +0000 Subject: [PATCH] Add tests for foundation cookbook --- .github/workflows/test-kitchen.yml | 5 +++++ .kitchen.yml | 15 +++++++++++++ test/data_bags/foundation/passwords.json | 19 +++++++++++++++++ .../serverspec/apache_spec.rb | 21 +++++++++++++++++++ .../foundation-dwg/serverspec/apache_spec.rb | 21 +++++++++++++++++++ .../foundation-mwg/serverspec/apache_spec.rb | 21 +++++++++++++++++++ .../foundation-owg/serverspec/apache_spec.rb | 21 +++++++++++++++++++ .../foundation-wiki/serverspec/apache_spec.rb | 21 +++++++++++++++++++ 8 files changed, 144 insertions(+) create mode 100644 test/data_bags/foundation/passwords.json create mode 100644 test/integration/foundation-board/serverspec/apache_spec.rb create mode 100644 test/integration/foundation-dwg/serverspec/apache_spec.rb create mode 100644 test/integration/foundation-mwg/serverspec/apache_spec.rb create mode 100644 test/integration/foundation-owg/serverspec/apache_spec.rb create mode 100644 test/integration/foundation-wiki/serverspec/apache_spec.rb diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 76305aaa2..e1ddf7221 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -39,6 +39,11 @@ jobs: - exim - fail2ban - forum + - foundation-board + - foundation-dwg + - foundation-mwg + - foundation-owg + - foundation-wiki - ftp - geodns - geoipupdate diff --git a/.kitchen.yml b/.kitchen.yml index 830cc04c5..476301516 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -127,6 +127,21 @@ suites: - name: forum run_list: - recipe[forum::default] + - name: foundation-board + run_list: + - recipe[foundation::board] + - name: foundation-dwg + run_list: + - recipe[foundation::dwg] + - name: foundation-mwg + run_list: + - recipe[foundation::mwg] + - name: foundation-owg + run_list: + - recipe[foundation::owg] + - name: foundation-wiki + run_list: + - recipe[foundation::wiki] - name: ftp run_list: - recipe[ftp::default] diff --git a/test/data_bags/foundation/passwords.json b/test/data_bags/foundation/passwords.json new file mode 100644 index 000000000..b8b93caed --- /dev/null +++ b/test/data_bags/foundation/passwords.json @@ -0,0 +1,19 @@ +{ + "id": "passwords", + "wiki": { + "database": "database_password", + "admin": "admin_password" + }, + "board": { + "database": "database_password", + "admin": "admin_password" + }, + "dwg": { + "database": "database_password", + "admin": "admin_password" + }, + "mwg": { + "database": "database_password", + "admin": "admin_password" + } +} diff --git a/test/integration/foundation-board/serverspec/apache_spec.rb b/test/integration/foundation-board/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/foundation-board/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/foundation-dwg/serverspec/apache_spec.rb b/test/integration/foundation-dwg/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/foundation-dwg/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/foundation-mwg/serverspec/apache_spec.rb b/test/integration/foundation-mwg/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/foundation-mwg/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/foundation-owg/serverspec/apache_spec.rb b/test/integration/foundation-owg/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/foundation-owg/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/foundation-wiki/serverspec/apache_spec.rb b/test/integration/foundation-wiki/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/foundation-wiki/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.39.5