X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fnova%2Fspec%2Fclasses%2Fnova_compute_rbd_spec.rb;fp=3rdparty%2Fmodules%2Fnova%2Fspec%2Fclasses%2Fnova_compute_rbd_spec.rb;h=0000000000000000000000000000000000000000;hb=6e1426dc77fb4e5d51f07c187c6f2219431dc31e;hp=60eea2f17aefa49baa772372fa967a24bace08e6;hpb=87423ba664cd5f2bb462ebadd08b1a90d0fe1c8d;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/nova/spec/classes/nova_compute_rbd_spec.rb b/3rdparty/modules/nova/spec/classes/nova_compute_rbd_spec.rb deleted file mode 100644 index 60eea2f17..000000000 --- a/3rdparty/modules/nova/spec/classes/nova_compute_rbd_spec.rb +++ /dev/null @@ -1,127 +0,0 @@ -# -# Copyright (C) 2014 eNovance SAS -# -# Author: Emilien Macchi -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# Unit tests for nova::compute::rbd class -# - -require 'spec_helper' - -describe 'nova::compute::rbd' do - - let :params do - { :libvirt_rbd_user => 'nova', - :libvirt_rbd_secret_uuid => false, - :libvirt_images_rbd_pool => 'rbd', - :libvirt_images_rbd_ceph_conf => '/etc/ceph/ceph.conf' } - end - - shared_examples_for 'nova compute rbd' do - - it { should contain_class('nova::params') } - - it 'configure nova.conf with default parameters' do - should contain_nova_config('libvirt/images_type').with_value('rbd') - should contain_nova_config('libvirt/images_rbd_pool').with_value('rbd') - should contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf') - should contain_nova_config('libvirt/rbd_user').with_value('nova') - end - - context 'when overriding default parameters' do - before :each do - params.merge!( - :libvirt_rbd_user => 'joe', - :libvirt_rbd_secret_uuid => false, - :libvirt_images_rbd_pool => 'AnotherPool', - :libvirt_images_rbd_ceph_conf => '/tmp/ceph.conf' - ) - end - - it 'configure nova.conf with overridden parameters' do - should contain_nova_config('libvirt/images_type').with_value('rbd') - should contain_nova_config('libvirt/images_rbd_pool').with_value('AnotherPool') - should contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/tmp/ceph.conf') - should contain_nova_config('libvirt/rbd_user').with_value('joe') - end - end - - context 'when using cephx' do - before :each do - params.merge!( - :libvirt_rbd_secret_uuid => 'UUID', - :rbd_keyring => 'client.rbd_test' - ) - end - - it 'configure nova.conf with RBD secret UUID' do - should contain_nova_config('libvirt/rbd_secret_uuid').with_value('UUID') - end - - it 'configure ceph on compute nodes' do - verify_contents(subject, '/etc/nova/secret.xml', [ - "", - " ", - " client.rbd_test secret", - " ", - " UUID", - "" - ]) - should contain_exec('get-or-set virsh secret').with( - :command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret', - :creates => '/etc/nova/virsh.secret', - :require => 'File[/etc/nova/secret.xml]' - ) - - should contain_exec('set-secret-value virsh').with( - :command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)" - ) - end - end - - context 'when using cephx and passing libvirt_rbd_secret_key' do - before :each do - params.merge!( - :libvirt_rbd_secret_uuid => 'UUID', - :libvirt_rbd_secret_key => 'LIBVIRT/SECRET/KEY', - ) - end - - it 'set libvirt secret key from passed key' do - should contain_exec('set-secret-value virsh').with( - :command => "/usr/bin/virsh secret-set-value --secret #{params[:libvirt_rbd_secret_uuid]} --base64 #{params[:libvirt_rbd_secret_key]}" - ) - end - end - - end - - context 'on Debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - - it_configures 'nova compute rbd' - end - - context 'on RedHat platforms' do - let :facts do - { :osfamily => 'RedHat' } - end - - it_configures 'nova compute rbd' - end - -end