]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for mailman cookbook
authorTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 18:05:14 +0000 (18:05 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 18:05:14 +0000 (18:05 +0000)
.kitchen.yml
.travis.yml
cookbooks/mailman/recipes/default.rb
test/integration/mailman/serverspec/apache_spec.rb [new file with mode: 0644]
test/integration/mailman/serverspec/mailman_spec.rb [new file with mode: 0644]

index 949240e32046d00b45aa29bbf7096dafb655eecc..b21df580b12e075289a7be063db75768aab84e97 100644 (file)
@@ -106,6 +106,9 @@ suites:
       apt:
         sources:
           - openstreetmap
+  - name: mailman
+    run_list:
+      - recipe[mailman::default]
   - name: memcached
     run_list:
       - recipe[memcached::default]
index 9a41f2b89596fae4986eeddc31034500b4018dd8..9b55eaa342ca30b921079408777c9b9f94a46b7b 100644 (file)
@@ -57,6 +57,9 @@ jobs:
     - name: "Test Kitchen (letsencrypt)"
       script:
         - bundle exec kitchen test letsencrypt-ubuntu-1804
+    - name: "Test Kitchen (mailman)"
+      script:
+        - bundle exec kitchen test mailman-ubuntu-1804
     - name: "Test Kitchen (memcached)"
       script:
         - bundle exec kitchen test memcached-ubuntu-1804
index 6e53ee8e531a17fb080a287d65fc716944600477..a4d9768ab8451df84109607260552f731451603a 100644 (file)
@@ -33,6 +33,13 @@ template "/etc/mailman/mm_cfg.py" do
   notifies :restart, "service[mailman]"
 end
 
+execute "newlist" do
+  command "newlist -q mailman mailman@example.com mailman"
+  user "root"
+  group "root"
+  not_if { ::File.exist?("/var/lib/mailman/lists/mailman/") }
+end
+
 service "mailman" do
   action [:enable, :start]
   supports :restart => true, :reload => true
diff --git a/test/integration/mailman/serverspec/apache_spec.rb b/test/integration/mailman/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/mailman/serverspec/mailman_spec.rb b/test/integration/mailman/serverspec/mailman_spec.rb
new file mode 100644 (file)
index 0000000..2d5fd35
--- /dev/null
@@ -0,0 +1,13 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("mailman") do
+  it { should be_installed }
+end
+
+describe service("mailman") do
+  it { should be_enabled }
+  it { should be_running }
+end