From f07363b6afbfa07213c2a20732968b9ec4bbe332 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Tue, 13 Mar 2012 16:30:19 -0700 Subject: [PATCH] Update spec tests This commit updates the spec tests so that they should work. - the ssh module that they depend on had introduced a dependency on the operatingsystem fact - tests had not been updated to reflect using xinetd and not the service to run the rsync daemon - update travis-ci to include the xinetd module --- .gitignore | 1 + .travis.yml | 1 + spec/classes/swift_spec.rb | 4 ++++ spec/classes/swift_storage_account_spec.rb | 4 ++++ spec/classes/swift_storage_all_spec.rb | 15 +++++++++------ spec/classes/swift_storage_container_spec.rb | 4 ++++ spec/classes/swift_storage_object_spec.rb | 4 ++++ spec/classes/swift_storage_spec.rb | 6 +++++- spec/defines/swift_storage_generic_spec.rb | 7 +++++-- spec/defines/swift_storage_server_spec.rb | 7 +++++-- 10 files changed, 42 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 9d98ae1a..4d0b6578 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ spec/fixtures/modules/memcached spec/fixtures/modules/rsync spec/fixtures/modules/ssh spec/fixtures/modules/stdlib +spec/fixtures/modules/xinetd diff --git a/.travis.yml b/.travis.yml index 7e5bd413..bdef0752 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ rvm: before_script: - 'git clone git://github.com/saz/puppet-ssh spec/fixtures/modules/ssh' - 'git clone git://github.com/puppetlabs/puppetlabs-rsync spec/fixtures/modules/rsync' + - 'git clone git://github.com/ghoneycutt/puppet-xinetd spec/fixtures/modules/xinetd' - 'git clone git://github.com/saz/puppet-memcached spec/fixtures/modules/memcached' - 'git clone git://github.com/puppetlabs/puppetlabs-stdlib spec/fixtures/modules/stdlib' - 'git clone git://github.com/puppetlabs/puppet-apt spec/fixtures/modules/apt' diff --git a/spec/classes/swift_spec.rb b/spec/classes/swift_spec.rb index 1787a72b..f084932d 100644 --- a/spec/classes/swift_spec.rb +++ b/spec/classes/swift_spec.rb @@ -6,6 +6,10 @@ describe 'swift' do {:swift_hash_suffix => 'string'} end + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "include ssh::server::install" end diff --git a/spec/classes/swift_storage_account_spec.rb b/spec/classes/swift_storage_account_spec.rb index df0d2e53..3c5a8b27 100644 --- a/spec/classes/swift_storage_account_spec.rb +++ b/spec/classes/swift_storage_account_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' describe 'swift::storage::account' do + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "class { 'ssh::server::install': } class { 'swift': swift_hash_suffix => 'foo' } diff --git a/spec/classes/swift_storage_all_spec.rb b/spec/classes/swift_storage_all_spec.rb index 09715d25..dcd7224b 100644 --- a/spec/classes/swift_storage_all_spec.rb +++ b/spec/classes/swift_storage_all_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' describe 'swift::storage::all' do # TODO I am not testing the upstart code b/c it should be temporary + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "class { 'swift': swift_hash_suffix => 'changeme' } include ssh::server::install @@ -52,12 +56,11 @@ describe 'swift::storage::all' do ['object', 'container', 'account'].each do |type| it { should contain_package("swift-#{type}").with_ensure('present') } it { should contain_service("swift-#{type}").with( - {:provider => 'upstart', - :ensure => 'running', + {:provider => 'upstart', + :ensure => 'running', :enable => true, - :hasstatus => true, - :subscribe => 'Service[rsync]'} - )} + :hasstatus => true + })} it { should contain_file("/etc/swift/#{type}-server/").with( {:ensure => 'directory', :owner => 'swift', @@ -85,7 +88,7 @@ describe 'swift::storage::all' do )} it { should contain_class('rsync::server').with( - {:use_xinetd => false, + {:use_xinetd => true, :address => param_hash[:storage_local_net_ip] } )} diff --git a/spec/classes/swift_storage_container_spec.rb b/spec/classes/swift_storage_container_spec.rb index ae86bf1c..93fce613 100644 --- a/spec/classes/swift_storage_container_spec.rb +++ b/spec/classes/swift_storage_container_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' describe 'swift::storage::container' do + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "class { 'ssh::server::install': } class { 'swift': swift_hash_suffix => 'foo' } diff --git a/spec/classes/swift_storage_object_spec.rb b/spec/classes/swift_storage_object_spec.rb index c5e5ee0b..5a3b1615 100644 --- a/spec/classes/swift_storage_object_spec.rb +++ b/spec/classes/swift_storage_object_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' describe 'swift::storage::object' do + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "class { 'ssh::server::install': } class { 'swift': swift_hash_suffix => 'foo' } diff --git a/spec/classes/swift_storage_spec.rb b/spec/classes/swift_storage_spec.rb index 2b36e93e..2b4eea64 100644 --- a/spec/classes/swift_storage_spec.rb +++ b/spec/classes/swift_storage_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' describe 'swift::storage' do # TODO I am not testing the upstart code b/c it should be temporary + let :facts do + {:operatingsystem => 'Ubuntu'} + end + describe 'when required classes are specified' do let :pre_condition do "class { 'swift': swift_hash_suffix => 'changeme' } @@ -22,7 +26,7 @@ describe 'swift::storage' do end it { should contain_class('rsync::server').with( - {:use_xinetd => false, + {:use_xinetd => true, :address => params[:storage_local_net_ip] } )} diff --git a/spec/defines/swift_storage_generic_spec.rb b/spec/defines/swift_storage_generic_spec.rb index eca6e701..9f291554 100644 --- a/spec/defines/swift_storage_generic_spec.rb +++ b/spec/defines/swift_storage_generic_spec.rb @@ -5,6 +5,10 @@ describe 'swift::storage::generic' do 'account' end + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "class { 'ssh::server::install': } class { 'swift': swift_hash_suffix => 'foo' } @@ -46,8 +50,7 @@ describe 'swift::storage::generic' do :ensure => 'running', :enable => true, :hasstatus => true, - :provider => param_hash[:service_provider], - :subscribe => 'Service[rsync]' + :provider => param_hash[:service_provider] )} it { should contain_file("/etc/swift/#{t}-server/").with( :ensure => 'directory', diff --git a/spec/defines/swift_storage_server_spec.rb b/spec/defines/swift_storage_server_spec.rb index 17fdf5f8..1c24584d 100644 --- a/spec/defines/swift_storage_server_spec.rb +++ b/spec/defines/swift_storage_server_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' describe 'swift::storage::server' do + let :facts do + {:operatingsystem => 'Ubuntu'} + end + let :pre_condition do "class { 'ssh::server::install': } class { 'swift': swift_hash_suffix => 'foo' } @@ -53,8 +57,7 @@ describe 'swift::storage::server' do it { should contain_service("swift-#{t}").with( :ensure => 'running', :enable => true, - :hasstatus => true, - :subscribe => 'Service[rsync]' + :hasstatus => true )} it { should contain_file("/etc/swift/#{t}-server/").with( :ensure => 'directory',