]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for geodns cookbook
authorTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 21:01:21 +0000 (21:01 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 21:01:21 +0000 (21:01 +0000)
.kitchen.yml
.travis.yml
cookbooks/geodns/metadata.rb
cookbooks/geodns/recipes/default.rb
cookbooks/geodns/templates/default/zone.map.erb [new file with mode: 0644]
cookbooks/geodns/templates/default/zone.resource.erb [new file with mode: 0644]
cookbooks/geodns/templates/default/zone.weighted.erb [new file with mode: 0644]
test/integration/serverinfo/gdsnd_spec.rb [new file with mode: 0644]

index 37f670c794b85ea1851beba10db34421b24640f4..792949fa99815344b3bac2205f1ef1615e43d5f7 100644 (file)
@@ -84,6 +84,15 @@ suites:
   - name: forum
     run_list:
       - recipe[forum::default]
   - name: forum
     run_list:
       - recipe[forum::default]
+  - name: geodns
+    run_list:
+      - recipe[geodns::default]
+    attributes:
+      networking:
+        interfaces:
+          test:
+            role: external
+            address: 172.18.0.2
   - name: geoipupdate
     run_list:
       - recipe[geoipupdate::default]
   - name: geoipupdate
     run_list:
       - recipe[geoipupdate::default]
index 8f02cbd483fde0066614823e23bfcf33e10142ad..e210de27a3727e15ce3bac2b6d58e591d68ab579 100644 (file)
@@ -48,6 +48,9 @@ jobs:
     - name: "Test Kitchen (forum)"
       script:
         - bundle exec kitchen test forum-ubuntu-1804
     - name: "Test Kitchen (forum)"
       script:
         - bundle exec kitchen test forum-ubuntu-1804
+    - name: "Test Kitchen (geodns)"
+      script:
+        - bundle exec kitchen test geodns-ubuntu-1804
     - name: "Test Kitchen (geoipupdate)"
       script:
         - bundle exec kitchen test geoipupdate-ubuntu-1804
     - name: "Test Kitchen (geoipupdate)"
       script:
         - bundle exec kitchen test geoipupdate-ubuntu-1804
index 4782ac0353498ca4999bc18ef3c00ed696830c73..b912c744291a9353452ca7fc6aa6092cf02f2c9e 100644 (file)
@@ -7,4 +7,5 @@ description       "Installs and configures a geographic DNS server"
 version           "1.0.0"
 supports          "ubuntu"
 depends           "geoipupdate"
 version           "1.0.0"
 supports          "ubuntu"
 depends           "geoipupdate"
+depends           "networking"
 depends           "systemd"
 depends           "systemd"
index 813ac250cfed8404c00584543ea2d3eb48df1a52..f017fb1242da37dc597a9348b85a69f22794c57c 100644 (file)
@@ -29,6 +29,19 @@ directory "/etc/gdnsd/config.d" do
   mode 0o755
 end
 
   mode 0o755
 end
 
+%w[tile nominatim].each do |zone|
+  %w[map resource weighted].each do |type|
+    template "/etc/gdnsd/config.d/#{zone}.#{type}" do
+      action :create_if_missing
+      source "zone.#{type}.erb"
+      owner "nobody"
+      group "nogroup"
+      mode 0o644
+      variables :zone => zone
+    end
+  end
+end
+
 template "/etc/gdnsd/config" do
   source "config.erb"
   owner "root"
 template "/etc/gdnsd/config" do
   source "config.erb"
   owner "root"
diff --git a/cookbooks/geodns/templates/default/zone.map.erb b/cookbooks/geodns/templates/default/zone.map.erb
new file mode 100644 (file)
index 0000000..25bf3ad
--- /dev/null
@@ -0,0 +1,3 @@
+<%= @zone %> => {
+  datacenters => [dummy]
+}
diff --git a/cookbooks/geodns/templates/default/zone.resource.erb b/cookbooks/geodns/templates/default/zone.resource.erb
new file mode 100644 (file)
index 0000000..3c1426b
--- /dev/null
@@ -0,0 +1,6 @@
+<%= @zone %> => {
+  map => <%= @zone %>
+  dcmap => {
+    dummy => dummy.example.com.
+  }
+}
diff --git a/cookbooks/geodns/templates/default/zone.weighted.erb b/cookbooks/geodns/templates/default/zone.weighted.erb
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/integration/serverinfo/gdsnd_spec.rb b/test/integration/serverinfo/gdsnd_spec.rb
new file mode 100644 (file)
index 0000000..65adc36
--- /dev/null
@@ -0,0 +1,18 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("gdnsd") do
+  it { should be_installed }
+end
+
+describe service("gdnsd") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(53) do
+  it { should be_listening.with("udp") }
+  it { should be_listening.with("tcp") }
+end