puppet-cinder/spec/classes/cinder_setup_test_volume_spec.rb
Javier Pena a8b991f6be Ensure test volume file permissions are correct
When setting up a test volume, we use dd (usually as root) to create
the file used for a loop mount. Permissions on that file will depend
on the umask, but they should not grant read for all to prevent
information leaks from Cinder volumes to any user.

Change-Id: Ie84650ec13cf746a3bbc99c9f652832c655f182f
2016-06-03 18:06:44 +02:00

25 lines
811 B
Ruby

require 'spec_helper'
describe 'cinder::setup_test_volume' do
it { is_expected.to contain_package('lvm2').with(
:ensure => 'present',
:require => 'Package[cinder]'
) }
it 'should contain volume creation execs' do
is_expected.to contain_exec('create_/var/lib/cinder/cinder-volumes').with(
:command => 'dd if=/dev/zero of="/var/lib/cinder/cinder-volumes" bs=1 count=0 seek=4G'
)
is_expected.to contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes')
is_expected.to contain_exec('pvcreate /dev/loop2')
is_expected.to contain_exec('vgcreate cinder-volumes /dev/loop2')
end
it 'should set 0640 permissions for cinder-volumes' do
is_expected.to contain_file('/var/lib/cinder/cinder-volumes').with(
:mode => '0640'
)
end
end