From 5f0fa40b30e9930a10929b6691f541c502ba4be8 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 18 Feb 2020 15:58:02 +0000 Subject: [PATCH] Add test for switch2osm cookbook --- .kitchen.yml | 3 +++ .travis.yml | 3 +++ cookbooks/switch2osm/metadata.rb | 3 ++- cookbooks/switch2osm/recipes/default.rb | 3 +++ .../switch2osm/serverspec/apache_spec.rb | 21 +++++++++++++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 test/integration/switch2osm/serverspec/apache_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 77ef19f96..949240e32 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -185,6 +185,9 @@ suites: - name: stateofthemap run_list: - recipe[stateofthemap::default] + - name: switch2osm + run_list: + - recipe[switch2osm::default] - name: tilecache run_list: - recipe[tilecache::default] diff --git a/.travis.yml b/.travis.yml index 3f16680ba..9a41f2b89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -126,6 +126,9 @@ jobs: - name: "Test Kitchen (stateofthemap)" script: - bundle exec kitchen test stateofthemap-ubuntu-1804 + - name: "Test Kitchen (switch2osm)" + script: + - bundle exec kitchen test switch2osm-ubuntu-1804 - name: "Test Kitchen (tilecache)" script: - bundle exec kitchen test tilecache-ubuntu-1804 diff --git a/cookbooks/switch2osm/metadata.rb b/cookbooks/switch2osm/metadata.rb index 3a380b93f..c87125ac3 100644 --- a/cookbooks/switch2osm/metadata.rb +++ b/cookbooks/switch2osm/metadata.rb @@ -6,4 +6,5 @@ description "Installs and configures servers for switch2osm" version "1.0.0" supports "ubuntu" -depends "wordpress" +depends "apache" +depends "git" diff --git a/cookbooks/switch2osm/recipes/default.rb b/cookbooks/switch2osm/recipes/default.rb index 3e0c51f9c..da4957cad 100644 --- a/cookbooks/switch2osm/recipes/default.rb +++ b/cookbooks/switch2osm/recipes/default.rb @@ -16,13 +16,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # + include_recipe "apache" include_recipe "git" package %w[ ruby ruby-dev + libssl-dev zlib1g-dev + pkg-config ] apache_module "expires" diff --git a/test/integration/switch2osm/serverspec/apache_spec.rb b/test/integration/switch2osm/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/switch2osm/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