From aebec5240469527c10aeb83394e77bd9e5907d66 Mon Sep 17 00:00:00 2001 From: Thom May Date: Tue, 23 Jun 2015 14:50:15 +0100 Subject: [PATCH] Fix up OmniOS tests --- .kitchen.yml | 6 ++--- TESTING.md | 5 ++++ .../default/serverspec/default_spec.rb | 2 +- .../helpers/serverspec/spec_helper.rb | 23 +++++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 2455c90..8a8cce9 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -17,10 +17,10 @@ platforms: - name: centos-6.5 - name: centos-5.10 -- name: omnios-r151006c +- name: omnios-r151014 driver: - box: omnios-r151006c - box_url: http://omnios.omniti.com/media/OmniOS_Text_r151006c.iso + box: omnios-r151014 + box_url: http://omnios.omniti.com/media/omnios-r151014.box run_list: - recipe[fake::omnios] diff --git a/TESTING.md b/TESTING.md index 2b6e4ff..831f77f 100644 --- a/TESTING.md +++ b/TESTING.md @@ -11,6 +11,11 @@ Install the berkshelf plugin for vagrant, and berkshelf to your local Ruby envir vagrant plugin install vagrant-berkshelf gem install berkshelf +To test the OmniOS platform, you need to install the omnios vagrant +plugin + + vagrant plugin install vagrant-guest-omnios + Install Test Kitchen and its Vagrant driver. bundle install diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index 1a17f39..e717a09 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -27,7 +27,7 @@ describe 'postfix::default' do end context 'configures' do - describe file('/etc/postfix/main.cf') do + describe file("#{postfix_conf_path}/main.cf") do its(:content) { should match(/^# Generated by Chef for /) } end end diff --git a/test/integration/helpers/serverspec/spec_helper.rb b/test/integration/helpers/serverspec/spec_helper.rb index 3a964fb..fb6f099 100644 --- a/test/integration/helpers/serverspec/spec_helper.rb +++ b/test/integration/helpers/serverspec/spec_helper.rb @@ -2,3 +2,26 @@ require 'serverspec' set :backend, :exec set :path, '/sbin:/usr/local/sbin:$PATH' + +def get_family + fam = 'solaris2' + return fam unless File.exist? '/etc/release' + File.open("/etc/release") do |file| + while line = file.gets + case line + when /^\s*(OmniOS)/ + fam = 'omnios' + end + end + end + fam +end + +def postfix_conf_path + if os[:family] == 'solaris' && get_family == 'omnios' + '/opt/omni/etc/postfix/' + else + '/etc/postfix' + end +end +