]> git.openstreetmap.org Git - chef.git/commitdiff
Add tests for munin::server recipe
authorTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 17:52:14 +0000 (18:52 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 19:44:07 +0000 (20:44 +0100)
.kitchen.yml
cookbooks/munin/templates/default/munin.conf.erb
test/integration/munin-server/serverspec/apache_spec.rb [new file with mode: 0644]
test/integration/munin-server/serverspec/munin_spec.rb [new file with mode: 0644]
test/integration/munin-server/serverspec/rrdcached_spec.rb [new file with mode: 0644]

index 12ffa49142f46ae9a37577109bb3526fdb2ee937..389ab5792da02f4c6bb691f04065ca4edbdf9958 100644 (file)
@@ -28,6 +28,9 @@ suites:
   - name: munin
     run_list:
       - recipe[munin::default]
+  - name: munin-server
+    run_list:
+      - recipe[munin::server]
   - name: networking
     run_list:
       - recipe[networking::default]
index d5dc7a4b887678ca7a640437b35f8ea926e64f7d..ec443ed742cfd7434edd8d1b4ece94d775497ca5 100644 (file)
@@ -89,6 +89,7 @@ unknown_limit 144
 <% end -%>
 <% end -%>
 <% end -%>
+<% unless @frontends.empty? && @backends.empty? -%>
 
 # Configure compound graphs for www.openstreetmap.org
 [www.openstreetmap]
@@ -292,6 +293,8 @@ unknown_limit 144
     memcached_multi_bytes.bytes_written.negative bytes_read
     memcached_multi_bytes.bytes_written.label Traffic in (-) / out (+)
     memcached_multi_bytes.bytes_written.cdef bytes_written,8,*
+<% end -%>
+<% unless @tilecaches.empty? -%>
 
 # Configure compound graphs for tile.openstreetmap.org
 [tile.openstreetmap]
@@ -442,6 +445,8 @@ unknown_limit 144
     squid_byte_hitrates.<%= tc[:name].tr("-", "_") %>_hits.label <%= tc[:name] %>
     squid_byte_hitrates.<%= tc[:name].tr("-", "_") %>_hits.draw LINE1
 <% end -%>
+<% end -%>
+<% unless @renderers.empty? -%>
 
 # Configure compound graphs for render.openstreetmap.org
 [render.openstreetmap]
@@ -702,6 +707,7 @@ unknown_limit 144
     renderd_zoom_time.zoomtime6.cdef zoomtime6,1000,/
     renderd_zoom_time.zoomtime6.draw STACK
     renderd_zoom_time.zoomtime6.info Time for Metatiles for z19 - z20
+<% end -%>
 <% unless @geocoders.empty? -%>
 
 # Configure compound graphs for nominatim.openstreetmap.org
diff --git a/test/integration/munin-server/serverspec/apache_spec.rb b/test/integration/munin-server/serverspec/apache_spec.rb
new file mode 100644 (file)
index 0000000..57b0b7d
--- /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 }
+end
+
+describe port(443) do
+  it { should_not be_listening }
+end
diff --git a/test/integration/munin-server/serverspec/munin_spec.rb b/test/integration/munin-server/serverspec/munin_spec.rb
new file mode 100644 (file)
index 0000000..eeae1e4
--- /dev/null
@@ -0,0 +1,8 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("munin") do
+  it { should be_installed }
+end
diff --git a/test/integration/munin-server/serverspec/rrdcached_spec.rb b/test/integration/munin-server/serverspec/rrdcached_spec.rb
new file mode 100644 (file)
index 0000000..dad61e8
--- /dev/null
@@ -0,0 +1,13 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("rrdcached") do
+  it { should be_installed }
+end
+
+describe service("rrdcached") do
+  it { should be_enabled }
+  it { should be_running }
+end