]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for osqa cookbook
authorTom Hughes <tom@compton.nu>
Wed, 19 Feb 2020 22:52:54 +0000 (22:52 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 19 Feb 2020 22:52:54 +0000 (22:52 +0000)
.kitchen.yml
.travis.yml
cookbooks/osqa/attributes/default.rb
cookbooks/osqa/metadata.rb
cookbooks/osqa/recipes/default.rb
roles/osqa.rb
test/data_bags/accounts/osqa.json [new file with mode: 0644]
test/integration/osqa/serverspec/apache_spec.rb [new file with mode: 0644]

index be107759a768ef4474b71193fb26c807cd637883..ec4e81755f4852c06720bf0c51fa20a8d21a9bda 100644 (file)
@@ -148,6 +148,9 @@ suites:
   - name: osmosis
     run_list:
       - recipe[osmosis::default]
+  - name: osqa
+    run_list:
+      - recipe[osqa::default]
   - name: otrs
     run_list:
       - recipe[otrs::default]
index 9a00148e7adc132984502d3ce917131b02612e43..e5f5b0b23d0667f241fcba9f87fd6c75340410ef 100644 (file)
@@ -102,6 +102,13 @@ jobs:
     - name: "Test Kitchen (osmosis)"
       script:
         - bundle exec kitchen test osmosis-ubuntu-1804
+    - name: "Test Kitchen (osqa)"
+      script:
+        - bundle exec kitchen test osqa-ubuntu-1804
+      attributes:
+        osqa:
+          sites:
+            - name: help.example.com
     - name: "Test Kitchen (otrs)"
       script:
         - bundle exec kitchen test otrs-ubuntu-1804
index 610f68605dbd1ef35da701605bedc919bf63d3c5..cc3243ffc6ceef22dd0bf31c6f5b142f3e69e9fd 100644 (file)
@@ -4,3 +4,5 @@ default[:osqa][:database_name] = "osqa"
 default[:osqa][:database_user] = "osqa"
 default[:osqa][:database_password] = ""
 default[:osqa][:sites] = []
+
+default[:accounts][:users][:osqa][:status] = :role
index 02f870410394bf7b57c1b901dc8f4e8b6086ef24..932a04697bdf149ffdbf33d85e0aa01930c42307 100644 (file)
@@ -6,6 +6,7 @@ description       "Installs and configures OSQA"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "memcached"
 depends           "python"
index 6e8d00d4afa128a62fba39ff4af256c415c7b1f1..a1fb95a444e625ca489408dc788c7e225caf941d 100644 (file)
 # limitations under the License.
 #
 
-include_recipe "tools"
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "memcached"
 include_recipe "python"
+include_recipe "tools"
 
 package "python-dev"
 package "libmysqlclient-dev"
index da7036fe05214fc3b7f592ffe7953a446b38664b..45a4cf04c1bca0aa8f0eb7e99908252faf8012c9 100644 (file)
@@ -2,11 +2,6 @@ name "osqa"
 description "Role applied to all OSQA servers"
 
 default_attributes(
-  :accounts => {
-    :users => {
-      :osqa => { :status => :role }
-    }
-  },
   :osqa => {
     :sites => [
       { :name => "help.openstreetmap.org",
diff --git a/test/data_bags/accounts/osqa.json b/test/data_bags/accounts/osqa.json
new file mode 100644 (file)
index 0000000..22361d0
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "osqa",
+  "uid": "510",
+  "comment": "osqa.openstreetmap.org",
+  "home": "/srv/help.openstreetmap.org"
+}
diff --git a/test/integration/osqa/serverspec/apache_spec.rb b/test/integration/osqa/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