Add test for taginfo cookbook
authorTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 21:52:03 +0000 (21:52 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 21:52:03 +0000 (21:52 +0000)
.kitchen.yml
.travis.yml
cookbooks/taginfo/attributes/default.rb
cookbooks/taginfo/metadata.rb
cookbooks/taginfo/recipes/default.rb
roles/taginfo.rb
test/data_bags/accounts/taginfo.json [new file with mode: 0644]
test/integration/taginfo/serverspec/apache_spec.rb [new file with mode: 0644]

index 792949fa99815344b3bac2205f1ef1615e43d5f7..b9f2ae89e7280509e38d083ed829946a9a13f0c6 100644 (file)
@@ -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]
index e210de27a3727e15ce3bac2b6d58e591d68ab579..9abf71c105b4b9afd7b6182ff61801aef7877e90 100644 (file)
@@ -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
index c7098b77b7b58f17aa1e44917b5fae47b68c0acb..266ac250a6a7cd60aeb596bb4c5d4e2b1487a1f7 100644 (file)
@@ -1 +1,3 @@
 default[:taginfo][:sites] = []
+
+default[:accounts][:users][:taginfo][:status] = :role
index 37794a28ee4df3440679a4add44add9d696ec4a2..3fdbc2f51086bf2ce992c0314cee6ad9639f2c83 100644 (file)
@@ -6,6 +6,7 @@ description       "Installs and configures taginfo"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "passenger"
 depends           "git"
index 4289c0042d3b7f24b557959cd1055622421617a7..50ea6b86d6f910e40a888e699e75f789a5337767 100644 (file)
@@ -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
index 9da56f28c2903015501474ff6079101bc25f0a49..c7d3d5b51cd7ecdf2905d385e266be97fae9cd10 100644 (file)
@@ -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 (file)
index 0000000..b74e3b0
--- /dev/null
@@ -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 (file)
index 0000000..446d3b9
--- /dev/null
@@ -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