From: Tom Hughes Date: Thu, 20 Feb 2020 19:13:15 +0000 (+0000) Subject: Add test for supybot cookbook X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/1322a7380e34a8f7b66943ffd10dff3b68dfa806?hp=c61dad4d0afbe41d85716e5231e76d94b6a529af Add test for supybot cookbook --- diff --git a/.kitchen.yml b/.kitchen.yml index 2e937d121..e91b64040 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -212,6 +212,9 @@ suites: - name: subversion run_list: - recipe[subversion::default] + - name: supybot + run_list: + - recipe[supybot::default] - name: switch2osm run_list: - recipe[switch2osm::default] diff --git a/.travis.yml b/.travis.yml index b9f212d85..d699655dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -160,6 +160,9 @@ jobs: - name: "Test Kitchen (subversion)" script: - bundle exec kitchen test subversion-ubuntu-1804 + - name: "Test Kitchen (supybot)" + script: + - bundle exec kitchen test supybot-ubuntu-1804 - name: "Test Kitchen (switch2osm)" script: - bundle exec kitchen test switch2osm-ubuntu-1804 diff --git a/cookbooks/supybot/attributes/default.rb b/cookbooks/supybot/attributes/default.rb new file mode 100644 index 000000000..1e8be7808 --- /dev/null +++ b/cookbooks/supybot/attributes/default.rb @@ -0,0 +1 @@ +default[:accounts][:users][:supybot][:status] = :role diff --git a/cookbooks/supybot/metadata.rb b/cookbooks/supybot/metadata.rb index 1b372ae22..76dbe20f2 100644 --- a/cookbooks/supybot/metadata.rb +++ b/cookbooks/supybot/metadata.rb @@ -6,4 +6,5 @@ description "Installs and configures supybot" version "1.0.0" supports "ubuntu" +depends "accounts" depends "systemd" diff --git a/cookbooks/supybot/recipes/default.rb b/cookbooks/supybot/recipes/default.rb index d1c1ea32d..7cd8836d7 100644 --- a/cookbooks/supybot/recipes/default.rb +++ b/cookbooks/supybot/recipes/default.rb @@ -17,6 +17,8 @@ # limitations under the License. # +include_recipe "accounts" + users = data_bag_item("supybot", "users") passwords = data_bag_item("supybot", "passwords") diff --git a/roles/supybot.rb b/roles/supybot.rb index 877fc766a..23a64d835 100644 --- a/roles/supybot.rb +++ b/roles/supybot.rb @@ -1,14 +1,6 @@ name "supybot" description "Role applied to all supybot servers" -default_attributes( - :accounts => { - :users => { - :supybot => { :status => :role } - } - } -) - run_list( "recipe[supybot]" ) diff --git a/test/data_bags/accounts/supybot.json b/test/data_bags/accounts/supybot.json new file mode 100644 index 000000000..b623c99a4 --- /dev/null +++ b/test/data_bags/accounts/supybot.json @@ -0,0 +1,5 @@ +{ + "id": "supybot", + "uid": "517", + "comment": "Supybot" +} diff --git a/test/data_bags/supybot/passwords.json b/test/data_bags/supybot/passwords.json new file mode 100644 index 000000000..4ae280fef --- /dev/null +++ b/test/data_bags/supybot/passwords.json @@ -0,0 +1,4 @@ +{ + "id": "passwords", + "nickserv": "nickserv" +} diff --git a/test/data_bags/supybot/users.json b/test/data_bags/supybot/users.json new file mode 100644 index 000000000..7a318dc6e --- /dev/null +++ b/test/data_bags/supybot/users.json @@ -0,0 +1,4 @@ +{ + "id": "users", + "Firefishy": "Firefishy" +} diff --git a/test/integration/supybot/serverspec/supybot_spec.rb b/test/integration/supybot/serverspec/supybot_spec.rb new file mode 100644 index 000000000..97a7db2dc --- /dev/null +++ b/test/integration/supybot/serverspec/supybot_spec.rb @@ -0,0 +1,13 @@ +require "serverspec" + +# Required by serverspec +set :backend, :exec + +describe package("supybot") do + it { should be_installed } +end + +describe service("supybot") do + it { should be_enabled } + it { should be_running } +end