2 # Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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
20 describe 'keystone::resource::service_identity' do
22 let (:title) { 'neutron' }
24 let :required_params do
25 { :password => 'secrete',
26 :service_type => 'network',
27 :admin_url => 'http://192.168.0.1:9696',
28 :internal_url => 'http://10.0.0.1:9696',
29 :public_url => 'http://7.7.7.7:9696' }
32 shared_examples 'keystone::resource::service_identity examples' do
34 context 'with only required parameters' do
39 it { should contain_keystone_user(title).with(
41 :password => 'secrete',
42 :email => 'neutron@localhost',
43 :tenant => 'services',
46 it { should contain_keystone_user_role("#{title}@services").with(
51 it { should contain_keystone_service(title).with(
54 :description => 'neutron service',
57 it { should contain_keystone_endpoint("RegionOne/#{title}").with(
59 :public_url => 'http://7.7.7.7:9696',
60 :internal_url => 'http://10.0.0.1:9696',
61 :admin_url => 'http://192.168.0.1:9696',
65 context 'when omitting a required parameter password' do
67 required_params.delete(:password)
69 it { expect { should raise_error(Puppet::Error) } }
74 context 'on a Debian osfamily' do
76 { :osfamily => "Debian" }
79 include_examples 'keystone::resource::service_identity examples'
82 context 'on a RedHat osfamily' do
84 { :osfamily => 'RedHat' }
87 include_examples 'keystone::resource::service_identity examples'