Merge "This is to get closer to 100% chefspec coverage"

This commit is contained in:
Jenkins 2014-07-15 15:37:36 +00:00 committed by Gerrit Code Review
commit ff5c57b7ae
5 changed files with 32 additions and 3 deletions

View File

@ -1,12 +1,12 @@
# encoding: UTF-8
source 'https://rubygems.org'
gem 'chef', '~> 11.8'
gem 'chef', '~> 11.12'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 2.0.18'
gem 'hashie', '~> 2.0'
gem 'chefspec', '~> 3.4.0'
gem 'rspec', '~> 2.14.1'
gem 'chefspec', '~> 4.0.0'
gem 'rspec', '~> 3.0.0'
gem 'foodcritic', '~> 3.0.3'
gem 'strainer'
gem 'rubocop', '~> 0.18.1'

View File

@ -38,6 +38,10 @@ describe 'openstack-block-storage::api' do
describe '/var/cache/cinder' do
let(:dir) { chef_run.directory('/var/cache/cinder') }
it 'should create the directory' do
expect(chef_run).to create_directory(dir.name)
end
it 'has proper owner' do
expect(dir.owner).to eq('cinder')
expect(dir.group).to eq('cinder')
@ -55,6 +59,10 @@ describe 'openstack-block-storage::api' do
describe 'api-paste.ini' do
let(:file) { chef_run.template('/etc/cinder/api-paste.ini') }
it 'should create api-paste.ini' do
expect(chef_run).to create_template(file.name)
end
it 'has proper owner' do
expect(file.owner).to eq('cinder')
expect(file.group).to eq('cinder')

View File

@ -24,6 +24,10 @@ describe 'openstack-block-storage::cinder-common' do
describe '/etc/cinder' do
let(:dir) { chef_run.directory('/etc/cinder') }
it 'should create the /etc/cinder directory' do
expect(chef_run).to create_directory(dir.name)
end
it 'has proper owner' do
expect(dir.owner).to eq('cinder')
expect(dir.group).to eq('cinder')
@ -37,6 +41,10 @@ describe 'openstack-block-storage::cinder-common' do
describe 'cinder.conf' do
let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
it 'should create the cinder.conf template' do
expect(chef_run).to create_template(file.name)
end
it 'has proper owner' do
expect(file.owner).to eq('cinder')
expect(file.group).to eq('cinder')
@ -719,6 +727,10 @@ describe 'openstack-block-storage::cinder-common' do
describe '/var/lock/cinder' do
let(:dir) { chef_run.directory('/var/lock/cinder') }
it 'should create the /var/lock/cinder directory' do
expect(chef_run).to create_directory(dir.name)
end
it 'has proper owner' do
expect(dir.owner).to eq('cinder')
expect(dir.group).to eq('cinder')

View File

@ -55,6 +55,7 @@ describe 'openstack-block-storage::scheduler' do
[:weekday, '*'], [:month, '*'], [:user, 'cinder']]
crontests.each do |k, v|
expect(cron.send(k)).to eq v
expect(chef_run).to create_cron('cinder-volume-usage-audit')
end
expect(cron.action).to include :create
end

View File

@ -205,6 +205,10 @@ describe 'openstack-block-storage::volume' do
it 'configures storewize private key' do
san_key = chef_run.file chef_run.node['openstack']['block-storage']['san']['san_private_key']
expect(san_key.mode).to eq('0400')
expect(chef_run).to create_file('/v7000_rsa').with(
user: 'cinder',
group: 'cinder'
)
end
context 'ISCSI' do
@ -233,6 +237,10 @@ describe 'openstack-block-storage::volume' do
describe 'targets.conf' do
let(:file) { chef_run.template('/etc/tgt/targets.conf') }
it 'should create the targets.conf' do
expect(chef_run).to create_template(file.name)
end
it 'has proper modes' do
expect(sprintf('%o', file.mode)).to eq '600'
end