]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for supybot cookbook
authorTom Hughes <tom@compton.nu>
Thu, 20 Feb 2020 19:13:15 +0000 (19:13 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 20 Feb 2020 19:13:15 +0000 (19:13 +0000)
.kitchen.yml
.travis.yml
cookbooks/supybot/attributes/default.rb [new file with mode: 0644]
cookbooks/supybot/metadata.rb
cookbooks/supybot/recipes/default.rb
roles/supybot.rb
test/data_bags/accounts/supybot.json [new file with mode: 0644]
test/data_bags/supybot/passwords.json [new file with mode: 0644]
test/data_bags/supybot/users.json [new file with mode: 0644]
test/integration/supybot/serverspec/supybot_spec.rb [new file with mode: 0644]

index 2e937d12146f41d479a4c29f11ff55d8ee1eba92..e91b64040a30edbd3882ffe552a5f65b725b967c 100644 (file)
@@ -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]
index b9f212d8516a3a1164bb4e058bac7635cfbf1b54..d699655dd074984fb7b7cc293116c60e83dc26b6 100644 (file)
@@ -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 (file)
index 0000000..1e8be78
--- /dev/null
@@ -0,0 +1 @@
+default[:accounts][:users][:supybot][:status] = :role
index 1b372ae221fa91f82bcbb36961a609657ebdcdf7..76dbe20f28c1a589eef21a178f18ec87b8617f57 100644 (file)
@@ -6,4 +6,5 @@ description       "Installs and configures supybot"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "systemd"
index d1c1ea32d8f9e17b1ece07f0fcfb5f9a374120de..7cd8836d7270e51124c1ec71ba5b52592b8c8c0c 100644 (file)
@@ -17,6 +17,8 @@
 # limitations under the License.
 #
 
+include_recipe "accounts"
+
 users = data_bag_item("supybot", "users")
 passwords = data_bag_item("supybot", "passwords")
 
index 877fc766a7c930c847f921a4dbe4c9a87fde6355..23a64d835784892d3a6d3bf68a779b83af3e98c7 100644 (file)
@@ -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 (file)
index 0000000..b623c99
--- /dev/null
@@ -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 (file)
index 0000000..4ae280f
--- /dev/null
@@ -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 (file)
index 0000000..7a318dc
--- /dev/null
@@ -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 (file)
index 0000000..97a7db2
--- /dev/null
@@ -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