Files
puppet-swift/spec/acceptance/basic_swift_spec.rb
Adam Vinsh 5a7d18975f Manage swift with swiftinit service provider
The 'swiftinit' provider is a custom provider of the service type
that manages swift services using swift-init.

Use of the swiftinit service provider is optional, the default is
to use service providers specified in params file. This provider
also manages swift services starting at boot by adding or removing
a templated init or services file and making systemctl calls.
See README for more detail.

A wrapper defined type 'swift::service' has been created to simplify
use of the swiftinit provider without adding logic to every class.
this wrapper also aids in input validation and testing of the
swiftinit provider.

Two extra runs of apply_manifest have been added to the
basic_swift_spec acceptance test. The service_provider
is set to "swiftinit".  The first run catches any errors upgrading
to the swiftinit service provider and the second run tests
idempotency.

This patch is an initial step towards using swift-init to manage
multiple swift services out of different configuration files such
as is needed to run a separate replication network.

Change-Id: I2f71c82c7a6c463f8c76a193409c0a17daa15bda
2015-12-07 16:00:50 -05:00

165 lines
5.2 KiB
Ruby

require 'spec_helper_acceptance'
describe 'basic swift' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
include ::openstack_integration
include ::openstack_integration::repos
include ::openstack_integration::rabbitmq
include ::openstack_integration::mysql
include ::openstack_integration::keystone
package { 'curl': ensure => present }
class { '::memcached':
listen_ip => '127.0.0.1',
}
# Swift resources
class { '::swift':
# not sure how I want to deal with this shared secret
swift_hash_suffix => 'secrete',
package_ensure => latest,
}
class { '::swift::keystone::auth':
password => 'a_big_secret',
}
# === Configure Storage
class { '::swift::storage':
storage_local_net_ip => '127.0.0.1',
}
# create xfs partitions on a loopback device and mounts them
swift::storage::loopback { '2':
require => Class['swift'],
}
# sets up storage nodes which is composed of a single
# device that contains an endpoint for an object, account, and container
swift::storage::node { '2':
mnt_base_dir => '/srv/node',
weight => 1,
manage_ring => true,
zone => '2',
storage_local_net_ip => '127.0.0.1',
require => Swift::Storage::Loopback[2] ,
}
class { '::swift::ringbuilder':
part_power => '18',
replicas => '1',
min_part_hours => 1,
require => Class['swift'],
}
class { '::swift::proxy':
proxy_local_net_ip => '127.0.0.1',
pipeline => ['healthcheck', 'cache', 'tempauth', 'dlo', 'proxy-server'],
account_autocreate => true,
require => Class['swift::ringbuilder'],
}
class { '::swift::proxy::authtoken':
admin_password => 'a_big_secret',
}
class {'::swift::objectexpirer':
interval => 600,
}
class {
[ '::swift::proxy::healthcheck', '::swift::proxy::cache',
'::swift::proxy::tempauth', '::swift::proxy::dlo' ]:
}
EOS
# Need to be run 2 times because we have an exported when creating the ring.
apply_manifest(pp, :catch_failures => false)
apply_manifest(pp, :catch_failures => true)
# The third run tests idempotency
apply_manifest(pp, :catch_changes => true)
end
describe port(8080) do
it { is_expected.to be_listening.with('tcp') }
end
end
context 'Using swiftinit service provider' do
it 'should work with no errors' do
swiftinit_pp= <<-EOS
include ::openstack_integration
include ::openstack_integration::repos
include ::openstack_integration::rabbitmq
include ::openstack_integration::mysql
include ::openstack_integration::keystone
package { 'curl': ensure => present }
class { '::memcached':
listen_ip => '127.0.0.1',
}
# Swift resources
class { '::swift':
# not sure how I want to deal with this shared secret
swift_hash_suffix => 'secrete',
package_ensure => latest,
}
class { '::swift::keystone::auth':
password => 'a_big_secret',
}
# === Configure Storage
class { '::swift::storage':
storage_local_net_ip => '127.0.0.1',
}
# create xfs partitions on a loopback device and mounts them
swift::storage::loopback { '2':
require => Class['swift'],
}
# sets up storage nodes which is composed of a single
# device that contains an endpoint for an object, account, and container
swift::storage::node { '2':
mnt_base_dir => '/srv/node',
weight => 1,
manage_ring => true,
zone => '2',
storage_local_net_ip => '127.0.0.1',
require => Swift::Storage::Loopback[2] ,
service_provider => 'swiftinit',
}
class { '::swift::ringbuilder':
part_power => '18',
replicas => '1',
min_part_hours => 1,
require => Class['swift'],
}
class { '::swift::proxy':
proxy_local_net_ip => '127.0.0.1',
pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'],
account_autocreate => true,
require => Class['swift::ringbuilder'],
service_provider => 'swiftinit',
}
class { '::swift::proxy::authtoken':
admin_password => 'a_big_secret',
}
class {'::swift::objectexpirer':
interval => 600,
service_provider => 'swiftinit',
}
class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: }
EOS
# Run one time to catch any errors upgrading to swiftinit service provider
apply_manifest(swiftinit_pp, :catch_failures => true)
# The second run tests idempotency
apply_manifest(swiftinit_pp, :catch_changes => true)
end
describe port(8080) do
it { is_expected.to be_listening.with('tcp') }
end
end
end