Browse Source

Added test recipe for testing some attributes

Xabier de Zuazo 10 years ago
parent
commit
ebd129c1de

+ 4 - 0
.kitchen.yml

@@ -26,3 +26,7 @@ suites:
   run_list:
     - recipe[dovecot_test]
   attributes: {}
+- name: attributes
+  run_list:
+    - recipe[dovecot_test::attributes]
+  attributes: {}

+ 10 - 0
test/integration/attributes/bats/default.bats

@@ -0,0 +1,10 @@
+#!/usr/bin/env bats
+
+@test "dovecot should be running" {
+  ps axu | grep -q 'doveco[t]'
+}
+
+@test "doveconf should run without errors" {
+  doveconf > /dev/null
+}
+

+ 172 - 0
test/kitchen/cookbooks/dovecot_test/recipes/attributes.rb

@@ -0,0 +1,172 @@
+#
+# Cookbook Name:: dovecot_test
+# Recipe:: attributes
+#
+# Copyright 2013, Onddo Labs, Sl.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# auth.rb
+
+node.default['dovecot']['auth']['checkpassword'] = { # hash
+  'passdb' => {
+    'driver' => 'checkpassword',
+    'args' => '/usr/bin/checkpassword',
+  },
+  'userdb' => {
+    'driver' => 'prefetch',
+  },
+}
+node.default['dovecot']['auth']['system']['passdb'] = [ # array
+  {
+    # without driver
+    'args' => 'dovecot',
+  },
+  {
+    'driver' => 'passwd',
+    'args' => '',
+  },
+  {
+    'driver' => 'shadow',
+    'args' => '',
+  },
+  {
+    'driver' => 'bsdauth',
+    'args' => '',
+  },
+]
+
+# conf-dovecot-dict-sql.rb
+
+node.default['dovecot']['conf']['dict_sql']['maps'] = [
+  {
+    'pattern' => 'priv/quota/storage',
+    'table' => 'quota',
+    'username_field' => 'username',
+    'value_field' => 'bytes',
+  },
+  {
+    'pattern' => 'priv/quota/messages',
+    'table' => 'quota',
+    'username_field' => 'username',
+    'value_field' => 'messages',
+  },
+  {
+    'pattern' => 'shared/expire/$user/$mailbox',
+    'table' => 'expires',
+    'value_field' => 'expire_stamp',
+    'fields' => {
+      'username' => '$user',
+      'mailbox' => '$mailbox',
+    },
+  },
+]
+
+# namespaces.rb
+
+node.default['dovecot']['namespaces'] = [
+  {
+    'separator' => '/',
+    'prefix' => '"#mbox/"',
+    'location' => 'mbox:~/mail:INBOX=/var/mail/%u',
+    'inbox' => true,
+    'hidden' => true,
+    'list' => false,
+  }, {
+    'separator' => '/',
+    'prefix' => '',
+    'location' => 'maildir:~/Maildir',
+  }, {
+    'name' => 'inbox',
+    'separator' => '/',
+    'prefix' => '',
+    'inbox' => 'yes',
+    'inbox' => true,
+    'mailboxes' => {
+      'Drafts' => {
+        'special_use' => '\Drafts',
+      },
+      'Junk' => {
+        'special_use' => '\Junk',
+      },
+      'Trash' => {
+        'special_use' => '\Trash',
+      },
+      'Sent' => {
+        'special_use' => '\Sent',
+      },
+      'Sent Messages' => {
+        'special_use' => '\Sent',
+      },
+      'virtual/All' => {
+        'special_use' => '\All',
+      },
+      'virtual/Flagged' => {
+        'special_use' => '\All',
+      },
+    },
+  },
+]
+
+# plugins.rb
+
+node.default['dovecot']['plugins']['mail_log'] = {
+  'mail_log_events' => 'delete undelete expunge copy mailbox_delete mailbox_rename',
+  'mail_log_fields' => 'uid box msgid size'
+}
+node.default['dovecot']['plugins']['sieve'] = {
+  'sieve' => '~/.dovecot.sieve',
+  'sieve_dir' => '~/sieve',
+}
+
+# protocols.rb
+
+node.default['dovecot']['protocols']['lda'] = {
+  'mail_plugins' => [ '$mail_plugins' ],
+}
+
+# services.rb
+
+node.default['dovecot']['services']['director']['listeners'] = [
+  { 'unix:login/director' => {
+      'mode' => '0666',
+  } },
+  { 'fifo:login/proxy-notify' => {
+      'mode' => '0666',
+  } },
+  { 'unix:director-userdb' => {
+      'mode' => '0666',
+   } },
+  { 'inet' => {
+      'port' => '5432',
+  } },
+]
+node.default['dovecot']['services']['imap-login'] = {
+  'listeners' => [
+    { 'inet:imap' => {
+     'port' => 143,
+    } },
+    { 'inet:imaps' => {
+      'port' => 993,
+      'ssl' => true,
+    } },
+  ],
+  'service_count' => 1,
+  'process_min_avail' => 0,
+  'vsz_limit' => '64M',
+}
+
+
+include_recipe 'dovecot'
+