Files
cookbook-openstack-object-s…/spec/account_spec.rb
Mark Vanderwiel d0ce1d6c57 Add swift.conf template
* new template with attributes for values
* Allow use of Common databags, deprecated swift databag
* update banners in all templates
* update specs

This is another patch on the road to bringing the swift cookbook
up to speed with the latest Common functions and with Juno in general.

Change-Id: I028776c481a1c96bba3496adfcca149f9ada42d3
Blueprint: object-storage-cleanup
2015-01-15 18:00:35 +00:00

60 lines
2.0 KiB
Ruby

# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-object-storage::account-server' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['object-storage']['disk_enum_expr'] = "[{ 'sda' => {}}]"
node.set['openstack']['object-storage']['disk_test_filter'] = [
'candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/',
"File.exist?('/dev/' + candidate)",
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
# mock out an interface on the storage node
node.set['network'] = MOCK_NODE_NETWORK_DATA['network']
runner.converge(described_recipe)
end
include_context 'swift-stubs'
it 'upgrades swift account packages' do
expect(chef_run).to upgrade_package('swift-account')
end
it 'upgrades swiftclient package' do
expect(chef_run).to upgrade_package('python-swiftclient')
end
it 'starts swift account services on boot' do
%w{swift-account swift-account-auditor swift-account-reaper swift-account-replicator}.each do |svc|
expect(chef_run).to enable_service(svc)
end
end
describe '/etc/swift/account-server.conf' do
let(:file) { chef_run.template('/etc/swift/account-server.conf') }
it_behaves_like 'custom template banner displayer' do
let(:file_name) { file.name }
end
it 'creates account-server.conf' do
expect(chef_run).to create_template(file.name).with(
user: 'swift',
group: 'swift',
mode: 0600
)
end
describe 'default attribute values' do
it_behaves_like 'a common swift server default attribute values checker', 'account', '0.0.0.0', '6002'
end
it_behaves_like 'a common swift server configurator', 'account', '0.0.0.0', '6002'
end
end
end