Browse Source

some basic integration tests added and a kitchen.yml file

Xabier de Zuazo 10 years ago
parent
commit
1cbb7dadad
6 changed files with 63 additions and 26 deletions
  1. 12 4
      .gitignore
  2. 15 13
      .kitchen.yml
  3. 8 2
      Gemfile
  4. 15 4
      Vagrantfile
  5. 3 3
      metadata.rb
  6. 10 0
      test/integration/default/bats/default.bats

+ 12 - 4
.gitignore

@@ -1,10 +1,18 @@
-.bundle
+.vagrant
+Berksfile.lock
+*~
+*#
+.#*
+\#*#
+.*.sw[a-z]
+*.un~
+/cookbooks
+Gemfile.lock
+bin/*
+.bundle/*
 .cache
 .kitchen
 bin
 metadata.json
-Gemfile.lock
 test/kitchen/.kitchen/
 .kitchen.local.yml
-Berksfile.lock
-.vagrant

+ 15 - 13
.kitchen.yml

@@ -1,26 +1,28 @@
 ---
 driver_plugin: vagrant
+driver_config:
+  require_chef_omnibus: true
 
 platforms:
 - name: ubuntu-12.04
   driver_config:
-    box: canonical-ubuntu-12.04
-    box_url: http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box
-    require_chef_omnibus: true
-- name: ubuntu-10.04
+    box: opscode-ubuntu-12.04
+    box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.4.box
+- name: centos-6.4
   driver_config:
-    box: opscode-ubuntu-10.04
-    box_url: http://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_chef-11.2.0.box
-- name: centos-6.3
+    box: opscode-centos-6.4
+    box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_chef-11.4.4.box
+- name: debian-7.0-chef10
   driver_config:
-    box: opscode-centos-6.3
-    box_url: http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.3_chef-11.2.0.box
-- name: centos-5.8
+    box: debian-7.0.0-chef_10.26.0-1-amd64
+    box_url: https://onddo-vm.s3.amazonaws.com/vagrant/debian-7.0.0-chef_10.26.0-1-amd64.box
+- name: debian-7.0-chef11
   driver_config:
-    box: opscode-centos-5.8
-    box_url: http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.8_chef-11.2.0.box
+    box: debian-7.0.0-chef_11.4.4-2-amd64
+    box_url: https://onddo-vm.s3.amazonaws.com/vagrant/debian-7.0.0-chef_11.4.4-2-amd64.box
 
 suites:
 - name: default
-  run_list: ["recipe[dovecot]"]
+  run_list:
+    - recipe[dovecot]
   attributes: {}

+ 8 - 2
Gemfile

@@ -1,4 +1,10 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
 source 'https://rubygems.org'
 
-gem 'test-kitchen', :group => :integration
-gem 'kitchen-vagrant', :group => :integration
+gem 'vagrant' #, :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.2.2'
+gem 'berkshelf', '~> 1.4.0'
+gem 'test-kitchen', '~> 1.0.0.alpha.0'
+gem 'kitchen-vagrant', '~> 0.10.0'
+

+ 15 - 4
Vagrantfile

@@ -1,6 +1,17 @@
-require 'kitchen/vagrant'
-require 'berkshelf/vagrant'
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
 
-Vagrant::Config.run do |config|
-  Kitchen::Vagrant.define_vms(config)
+Vagrant.configure("2") do |config|
+  config.vm.hostname = "dovecot-berkshelf"
+
+  config.ssh.max_tries = 40
+  config.ssh.timeout   = 120
+
+  config.berkshelf.enabled = true
+
+  config.vm.provision :chef_solo do |chef|
+    chef.run_list = [
+        "recipe[dovecot::default]"
+    ]
+  end
 end

+ 3 - 3
metadata.rb

@@ -6,7 +6,7 @@ description      'Installs/Configures dovecot'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
 version          '0.1.0'
 
-supports 'centos'
-supports 'debian'
-supports 'ubuntu'
+supports 'centos', '>= 6.0'
+supports 'debian', '>= 7.0'
+supports 'ubuntu', '>= 12.04'
 

+ 10 - 0
test/integration/default/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
+}
+