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
This commit is contained in:
Dan Bode
2012-03-13 16:30:19 -07:00
parent cb233bd6a1
commit f07363b6af
10 changed files with 42 additions and 11 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ spec/fixtures/modules/memcached
spec/fixtures/modules/rsync spec/fixtures/modules/rsync
spec/fixtures/modules/ssh spec/fixtures/modules/ssh
spec/fixtures/modules/stdlib spec/fixtures/modules/stdlib
spec/fixtures/modules/xinetd

View File

@@ -5,6 +5,7 @@ rvm:
before_script: before_script:
- 'git clone git://github.com/saz/puppet-ssh spec/fixtures/modules/ssh' - '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/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/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/puppetlabs-stdlib spec/fixtures/modules/stdlib'
- 'git clone git://github.com/puppetlabs/puppet-apt spec/fixtures/modules/apt' - 'git clone git://github.com/puppetlabs/puppet-apt spec/fixtures/modules/apt'

View File

@@ -6,6 +6,10 @@ describe 'swift' do
{:swift_hash_suffix => 'string'} {:swift_hash_suffix => 'string'}
end end
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"include ssh::server::install" "include ssh::server::install"
end end

View File

@@ -1,6 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe 'swift::storage::account' do describe 'swift::storage::account' do
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"class { 'ssh::server::install': } "class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' } class { 'swift': swift_hash_suffix => 'foo' }

View File

@@ -3,6 +3,10 @@ require 'spec_helper'
describe 'swift::storage::all' do describe 'swift::storage::all' do
# TODO I am not testing the upstart code b/c it should be temporary # TODO I am not testing the upstart code b/c it should be temporary
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"class { 'swift': swift_hash_suffix => 'changeme' } "class { 'swift': swift_hash_suffix => 'changeme' }
include ssh::server::install include ssh::server::install
@@ -52,12 +56,11 @@ describe 'swift::storage::all' do
['object', 'container', 'account'].each do |type| ['object', 'container', 'account'].each do |type|
it { should contain_package("swift-#{type}").with_ensure('present') } it { should contain_package("swift-#{type}").with_ensure('present') }
it { should contain_service("swift-#{type}").with( it { should contain_service("swift-#{type}").with(
{:provider => 'upstart', {:provider => 'upstart',
:ensure => 'running', :ensure => 'running',
:enable => true, :enable => true,
:hasstatus => true, :hasstatus => true
:subscribe => 'Service[rsync]'} })}
)}
it { should contain_file("/etc/swift/#{type}-server/").with( it { should contain_file("/etc/swift/#{type}-server/").with(
{:ensure => 'directory', {:ensure => 'directory',
:owner => 'swift', :owner => 'swift',
@@ -85,7 +88,7 @@ describe 'swift::storage::all' do
)} )}
it { should contain_class('rsync::server').with( it { should contain_class('rsync::server').with(
{:use_xinetd => false, {:use_xinetd => true,
:address => param_hash[:storage_local_net_ip] :address => param_hash[:storage_local_net_ip]
} }
)} )}

View File

@@ -1,6 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe 'swift::storage::container' do describe 'swift::storage::container' do
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"class { 'ssh::server::install': } "class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' } class { 'swift': swift_hash_suffix => 'foo' }

View File

@@ -1,6 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe 'swift::storage::object' do describe 'swift::storage::object' do
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"class { 'ssh::server::install': } "class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' } class { 'swift': swift_hash_suffix => 'foo' }

View File

@@ -3,6 +3,10 @@ require 'spec_helper'
describe 'swift::storage' do describe 'swift::storage' do
# TODO I am not testing the upstart code b/c it should be temporary # 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 describe 'when required classes are specified' do
let :pre_condition do let :pre_condition do
"class { 'swift': swift_hash_suffix => 'changeme' } "class { 'swift': swift_hash_suffix => 'changeme' }
@@ -22,7 +26,7 @@ describe 'swift::storage' do
end end
it { should contain_class('rsync::server').with( it { should contain_class('rsync::server').with(
{:use_xinetd => false, {:use_xinetd => true,
:address => params[:storage_local_net_ip] :address => params[:storage_local_net_ip]
} }
)} )}

View File

@@ -5,6 +5,10 @@ describe 'swift::storage::generic' do
'account' 'account'
end end
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"class { 'ssh::server::install': } "class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' } class { 'swift': swift_hash_suffix => 'foo' }
@@ -46,8 +50,7 @@ describe 'swift::storage::generic' do
:ensure => 'running', :ensure => 'running',
:enable => true, :enable => true,
:hasstatus => true, :hasstatus => true,
:provider => param_hash[:service_provider], :provider => param_hash[:service_provider]
:subscribe => 'Service[rsync]'
)} )}
it { should contain_file("/etc/swift/#{t}-server/").with( it { should contain_file("/etc/swift/#{t}-server/").with(
:ensure => 'directory', :ensure => 'directory',

View File

@@ -1,6 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe 'swift::storage::server' do describe 'swift::storage::server' do
let :facts do
{:operatingsystem => 'Ubuntu'}
end
let :pre_condition do let :pre_condition do
"class { 'ssh::server::install': } "class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' } class { 'swift': swift_hash_suffix => 'foo' }
@@ -53,8 +57,7 @@ describe 'swift::storage::server' do
it { should contain_service("swift-#{t}").with( it { should contain_service("swift-#{t}").with(
:ensure => 'running', :ensure => 'running',
:enable => true, :enable => true,
:hasstatus => true, :hasstatus => true
:subscribe => 'Service[rsync]'
)} )}
it { should contain_file("/etc/swift/#{t}-server/").with( it { should contain_file("/etc/swift/#{t}-server/").with(
:ensure => 'directory', :ensure => 'directory',