]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/openstacklib/spec/defines/openstacklib_messaging_rabbitmq_spec.rb
953c53be3c6e885830a94bceb827052c3b66cebc
[dsa-puppet.git] / 3rdparty / modules / openstacklib / spec / defines / openstacklib_messaging_rabbitmq_spec.rb
1 #
2 # Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3 #
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
16 # under the License.
17
18 require 'spec_helper'
19
20 describe 'openstacklib::messaging::rabbitmq' do
21
22   let (:title) { 'nova' }
23
24   shared_examples 'openstacklib::messaging::rabbitmq examples' do
25
26     let :params do
27       {}
28     end
29
30     context 'with default parameters' do
31       it { should contain_rabbitmq_user('guest').with(
32         :admin    => false,
33         :password => 'guest',
34         :provider => 'rabbitmqctl',
35       )}
36       it { should contain_rabbitmq_user_permissions('guest@/').with(
37         :configure_permission => '.*',
38         :write_permission     => '.*',
39         :read_permission      => '.*',
40         :provider             => 'rabbitmqctl',
41       )}
42       it { should contain_rabbitmq_vhost('/').with(
43         :provider => 'rabbitmqctl',
44       )}
45     end
46
47     context 'with custom parameters' do
48       before :each do
49         params.merge!(
50           :userid               => 'nova',
51           :password             => 'secrete',
52           :virtual_host         => '/nova',
53           :is_admin             => true,
54           :configure_permission => '.nova',
55           :write_permission     => '.nova',
56           :read_permission      => '.nova'
57         )
58       end
59
60       it { should contain_rabbitmq_user('nova').with(
61         :admin    => true,
62         :password => 'secrete',
63         :provider => 'rabbitmqctl',
64       )}
65       it { should contain_rabbitmq_user_permissions('nova@/nova').with(
66         :configure_permission => '.nova',
67         :write_permission     => '.nova',
68         :read_permission      => '.nova',
69         :provider             => 'rabbitmqctl',
70       )}
71       it { should contain_rabbitmq_vhost('/nova').with(
72         :provider => 'rabbitmqctl',
73       )}
74     end
75
76     context 'when disabling vhost management' do
77       before :each do
78         params.merge!( :manage_vhost => false )
79       end
80
81       it { should_not contain_rabbitmq_vhost }
82     end
83
84   end
85
86   context 'on a Debian osfamily' do
87     let :facts do
88       { :osfamily => "Debian" }
89     end
90
91     include_examples 'openstacklib::messaging::rabbitmq examples'
92   end
93
94   context 'on a RedHat osfamily' do
95     let :facts do
96       { :osfamily => 'RedHat' }
97     end
98
99     include_examples 'openstacklib::messaging::rabbitmq examples'
100   end
101 end