From: Tom Hughes Date: Tue, 18 Feb 2020 21:52:03 +0000 (+0000) Subject: Add test for taginfo cookbook X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/f712c160d80bb100bf99fa38793c26d8024f2002?ds=sidebyside Add test for taginfo cookbook --- diff --git a/.kitchen.yml b/.kitchen.yml index 792949fa9..b9f2ae89e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -194,6 +194,13 @@ suites: - name: switch2osm run_list: - recipe[switch2osm::default] + - name: taginfo + run_list: + - recipe[taginfo::default] + attributes: + taginfo: + sites: + - name: taginfo.example.com - name: tilecache run_list: - recipe[tilecache::default] diff --git a/.travis.yml b/.travis.yml index e210de27a..9abf71c10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -138,6 +138,9 @@ jobs: - name: "Test Kitchen (switch2osm)" script: - bundle exec kitchen test switch2osm-ubuntu-1804 + - name: "Test Kitchen (taginfo)" + script: + - bundle exec kitchen test taginfo-ubuntu-1804 - name: "Test Kitchen (tilecache)" script: - bundle exec kitchen test tilecache-ubuntu-1804 diff --git a/cookbooks/taginfo/attributes/default.rb b/cookbooks/taginfo/attributes/default.rb index c7098b77b..266ac250a 100644 --- a/cookbooks/taginfo/attributes/default.rb +++ b/cookbooks/taginfo/attributes/default.rb @@ -1 +1,3 @@ default[:taginfo][:sites] = [] + +default[:accounts][:users][:taginfo][:status] = :role diff --git a/cookbooks/taginfo/metadata.rb b/cookbooks/taginfo/metadata.rb index 37794a28e..3fdbc2f51 100644 --- a/cookbooks/taginfo/metadata.rb +++ b/cookbooks/taginfo/metadata.rb @@ -6,6 +6,7 @@ description "Installs and configures taginfo" version "1.0.0" supports "ubuntu" +depends "accounts" depends "apache" depends "passenger" depends "git" diff --git a/cookbooks/taginfo/recipes/default.rb b/cookbooks/taginfo/recipes/default.rb index 4289c0042..50ea6b86d 100644 --- a/cookbooks/taginfo/recipes/default.rb +++ b/cookbooks/taginfo/recipes/default.rb @@ -19,6 +19,7 @@ require "json" +include_recipe "accounts" include_recipe "apache" include_recipe "passenger" include_recipe "git" @@ -54,6 +55,7 @@ package "ruby#{ruby_version}" gem_package "bundler#{ruby_version}" do package_name "bundler" + version "~> 1.16.2" gem_binary "gem#{ruby_version}" options "--format-executable" end diff --git a/roles/taginfo.rb b/roles/taginfo.rb index 9da56f28c..c7d3d5b51 100644 --- a/roles/taginfo.rb +++ b/roles/taginfo.rb @@ -8,7 +8,6 @@ default_attributes( :status => :administrator }, :taginfo => { - :status => :role, :members => [:jochen, :tomh] } } diff --git a/test/data_bags/accounts/taginfo.json b/test/data_bags/accounts/taginfo.json new file mode 100644 index 000000000..b74e3b095 --- /dev/null +++ b/test/data_bags/accounts/taginfo.json @@ -0,0 +1,6 @@ +{ + "id": "taginfo", + "uid": "520", + "comment": "Taginfo", + "manage_home": false +} diff --git a/test/integration/taginfo/serverspec/apache_spec.rb b/test/integration/taginfo/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/taginfo/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