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

index e383bd272444bb06391d8dadcb03b5ffc7d6b0c2..be107759a768ef4474b71193fb26c807cd637883 100644 (file)
@@ -99,6 +99,9 @@ suites:
   - name: geoipupdate
     run_list:
       - recipe[geoipupdate::default]
+  - name: gps-tile
+    run_list:
+      - recipe[gps-tile::default]
   - name: incron
     run_list:
       - recipe[incron::default]
index 25cf63dbf9b6a370e5de49a32c41ff11142bc94b..9a00148e7adc132984502d3ce917131b02612e43 100644 (file)
@@ -57,6 +57,9 @@ jobs:
     - name: "Test Kitchen (geoipupdate)"
       script:
         - bundle exec kitchen test geoipupdate-ubuntu-1804
+    - name: "Test Kitchen (gps-tile)"
+      script:
+        - bundle exec kitchen test gps-tile-ubuntu-1804
     - name: "Test Kitchen (incron)"
       script:
         - bundle exec kitchen test incron-ubuntu-1804
diff --git a/cookbooks/gps-tile/attributes/default.rb b/cookbooks/gps-tile/attributes/default.rb
new file mode 100644 (file)
index 0000000..61ab02a
--- /dev/null
@@ -0,0 +1 @@
+default[:accounts][:users][:gpstile][:status] = :role
index 78acecfa55b3cfb4c3a7b7c2a9ab8ae52e0cb155..c23644f44d5e12221dec270dc92e0deacc7b2c21 100644 (file)
@@ -6,5 +6,8 @@ description       "Configures a GPS tile server"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
+depends           "git"
+depends           "memcached"
 depends           "systemd"
index 5de9d5573f326a1709a5e9caa4b7a4c725ea59d6..42b3f8a288e749b1cc17083629bbb77cc207bd52 100644 (file)
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "apache"
+include_recipe "git"
+include_recipe "memcached"
 
 package %w[
   make
@@ -48,7 +51,7 @@ end
 
 execute "/srv/gps-tile.openstreetmap.org/import/src/Makefile" do
   action :nothing
-  command "make"
+  command "make DB=none LDFLAGS=-lm"
   cwd "/srv/gps-tile.openstreetmap.org/import/src"
   user "gpstile"
   group "gpstile"
index 285d461de69cea0ed216758151eda7cec42a8ebb..e6a0e5ec2f340fd1001c85bac26b5117bf1a531c 100644 (file)
@@ -6,7 +6,6 @@ default_attributes(
     :users => {
       :enf => { :status => :administrator },
       :gpstile => {
-        :status => :role,
         :members => [:enf, :tomh]
       }
     }
@@ -25,6 +24,5 @@ default_attributes(
 )
 
 run_list(
-  "recipe[memcached]",
   "recipe[gps-tile]"
 )
diff --git a/test/data_bags/accounts/gpstile.json b/test/data_bags/accounts/gpstile.json
new file mode 100644 (file)
index 0000000..3a242c4
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "gpstile",
+  "uid": "519",
+  "comment": "gps-tile.openstreetmap.org",
+  "home": "/srv/gps-tile.openstreetmap.org"
+}
diff --git a/test/integration/gps-tile/serverspec/apache_spec.rb b/test/integration/gps-tile/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
diff --git a/test/integration/gps-tile/serverspec/gpsupdate_spec.rb b/test/integration/gps-tile/serverspec/gpsupdate_spec.rb
new file mode 100644 (file)
index 0000000..bf6a3db
--- /dev/null
@@ -0,0 +1,9 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe service("gps-update") do
+  it { should be_enabled }
+  it { should be_running }
+end