Files
puppet-swift/spec/defines/swift_storage_generic_spec.rb
Dan Bode 5083e19bc4 Decouple storage server types from each other
Previously, all of the storage server types
(account, container, proxy) were always
configured to be installed on the same node.

It often makes sense to only have the account and
container together, and to put the object server on
a different node. (or its possible that other
configurations make sense)

This commit refactors the swift module so that
each of the types of nodes can be built
independently of each other.
2012-03-02 20:01:49 -08:00

63 lines
1.7 KiB
Ruby

require 'spec_helper'
describe 'swift::storage::generic' do
let :title do
'account'
end
let :pre_condition do
"class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' }
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
end
let :default_params do
{:package_ensure => 'present',
:service_provider => 'upstart'}
end
describe 'with an invalid title' do
let :title do
'foo'
end
it 'should fail' do
expect do
subject
end.should raise_error(Puppet::Error, /does not match/)
end
end
['account', 'object', 'container'].each do |t|
[{},
{:package_ensure => 'latest',
:service_provider => 'init'}
].each do |param_set|
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
let :title do
t
end
let :param_hash do
default_params.merge(param_set)
end
let :params do
param_set
end
it { should contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) }
it { should contain_service("swift-#{t}").with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:provider => param_hash[:service_provider],
:subscribe => 'Service[rsync]'
)}
it { should contain_file("/etc/swift/#{t}-server/").with(
:ensure => 'directory',
:owner => 'swift',
:group => 'swift'
)}
end
# TODO - I do not want to add tests for the upstart stuff
# I need to check the tickets and see if this stuff is fixed
end
end
end