Merge pull request #468 from chef/chris-rock/integration

Move integration tests to test/integration
This commit is contained in:
Dominik Richter 2016-03-18 15:37:55 +01:00
commit f0312f4abe
49 changed files with 16 additions and 9 deletions

View file

@ -1,5 +1,6 @@
# encoding: utf-8
source 'https://supermarket.chef.io' source 'https://supermarket.chef.io'
cookbook 'apt' cookbook 'apt'
cookbook 'os_prepare', path: './cookbooks/os_prepare' cookbook 'os_prepare', path: './test/cookbooks/os_prepare'
cookbook 'runit', github: 'hw-cookbooks/runit' cookbook 'runit', github: 'hw-cookbooks/runit'

View file

@ -19,10 +19,9 @@ end
group :integration do group :integration do
gem 'berkshelf', '~> 4.0' gem 'berkshelf', '~> 4.0'
gem 'test-kitchen' gem 'test-kitchen', '~> 1.6'
gem 'kitchen-vagrant' gem 'kitchen-vagrant'
gem 'kitchen-inspec' gem 'kitchen-inspec', '0.12.5'
gem 'winrm-transport', '~> 1.0'
gem 'kitchen-ec2' gem 'kitchen-ec2'
end end

View file

@ -9,7 +9,7 @@ when 'ubuntu', 'rhel', 'centos', 'fedora'
# copy iso file for mount tests # copy iso file for mount tests
# NB created using `mkdir empty; mkisofs -o empty.iso empty/` # NB created using `mkdir empty; mkisofs -o empty.iso empty/`
cookbook_file '/root/empty.iso' do cookbook_file '/tmp/empty.iso' do
owner 'root' owner 'root'
group 'root' group 'root'
mode '0755' mode '0755'
@ -26,7 +26,7 @@ when 'ubuntu', 'rhel', 'centos', 'fedora'
# mount -o loop /root/empty.iso /mnt/iso-disk # mount -o loop /root/empty.iso /mnt/iso-disk
mount '/mnt/iso-disk' do mount '/mnt/iso-disk' do
device '/root/empty.iso' device '/tmp/empty.iso'
options 'loop' options 'loop'
action [:mount, :enable] action [:mount, :enable]
end end

View file

@ -6,6 +6,12 @@
# hw-cookbooks/postgresql is tested on these platforms # hw-cookbooks/postgresql is tested on these platforms
case node['platform'] case node['platform']
when 'ubuntu', 'centos' when 'ubuntu', 'centos'
# also skip it on ubuntu 15.10, because the cookbook is not supported
# with `enable_pgdg_apt` yet
return if node['platform_version'] == "15.10"
node.default['postgresql']['enable_pgdg_apt'] = true
node.default['postgresql']['config']['listen_addresses'] = 'localhost' node.default['postgresql']['config']['listen_addresses'] = 'localhost'
node.default['postgresql']['password']['postgres'] = 'md506be11be01439cb4abd537e454df34ea' # "inspec" node.default['postgresql']['password']['postgres'] = 'md506be11be01439cb4abd537e454df34ea' # "inspec"
include_recipe 'postgresql::server' include_recipe 'postgresql::server'

View file

@ -125,6 +125,7 @@ if os.unix?
end end
end end
# check file mount on linux
if os.linux? if os.linux?
# for server spec compatibility # for server spec compatibility
# Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed # Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed
@ -133,7 +134,7 @@ if os.linux?
it { should be_mounted } it { should be_mounted }
it { should be_mounted.with( :type => 'iso9660' ) } it { should be_mounted.with( :type => 'iso9660' ) }
it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) } it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) }
it { should be_mounted.with( :type => 'iso9660', :device => '/root/empty.iso' ) } it { should be_mounted.with( :type => 'iso9660', :device => '/tmp/empty.iso' ) }
it { should_not be_mounted.with( :type => 'ext4' ) } it { should_not be_mounted.with( :type => 'ext4' ) }
it { should_not be_mounted.with( :type => 'xfs' ) } it { should_not be_mounted.with( :type => 'xfs' ) }
end end
@ -142,7 +143,7 @@ if os.linux?
# also see mount_spec.rb # also see mount_spec.rb
describe file('/mnt/iso-disk') do describe file('/mnt/iso-disk') do
it { should be_mounted.only_with( { it { should be_mounted.only_with( {
:device=>"/root/empty.iso", :device=>"/tmp/empty.iso",
:type=>"iso9660", :type=>"iso9660",
:options=>{ :options=>{
:ro=>true} :ro=>true}

View file

@ -5,7 +5,7 @@ if os.linux?
describe mount '/mnt/iso-disk' do describe mount '/mnt/iso-disk' do
it { should be_mounted } it { should be_mounted }
its('count') { should eq 1 } its('count') { should eq 1 }
its('device') { should eq '/root/empty.iso' } its('device') { should eq '/tmp/empty.iso' }
its('type') { should eq 'iso9660' } its('type') { should eq 'iso9660' }
its('options') { should eq ['ro'] } its('options') { should eq ['ro'] }
end end