2 # Copyright (C) 2014 Mirantis
4 # Author: Steapn Rogov <srogov@mirantis.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
18 # Unit tests for glance::backend::vsphere class
23 describe 'glance::backend::vsphere' do
26 'class { "glance::api": keystone_password => "pass" }'
29 shared_examples_for 'glance with vsphere backend' do
31 context 'when default parameters' do
34 :vcenter_host => '10.0.0.1',
35 :vcenter_user => 'root',
36 :vcenter_password => '123456',
37 :vcenter_datacenter => 'Datacenter',
38 :vcenter_datastore => 'Datastore',
39 :vcenter_image_dir => '/openstack_glance',
42 it 'configures glance-api.conf' do
43 should contain_glance_api_config('DEFAULT/default_store').with_value('vsphere')
44 should contain_glance_api_config('DEFAULT/vmware_api_insecure').with_value('False')
45 should contain_glance_api_config('DEFAULT/vmware_server_host').with_value('10.0.0.1')
46 should contain_glance_api_config('DEFAULT/vmware_server_username').with_value('root')
47 should contain_glance_api_config('DEFAULT/vmware_server_password').with_value('123456')
48 should contain_glance_api_config('DEFAULT/vmware_datastore_name').with_value('Datastore')
49 should contain_glance_api_config('DEFAULT/vmware_store_image_dir').with_value('/openstack_glance')
50 should contain_glance_api_config('DEFAULT/vmware_task_poll_interval').with_value('5')
51 should contain_glance_api_config('DEFAULT/vmware_api_retry_count').with_value('10')
52 should contain_glance_api_config('DEFAULT/vmware_datacenter_path').with_value('Datacenter')
56 context 'when overriding parameters' do
59 :vcenter_host => '10.0.0.1',
60 :vcenter_user => 'root',
61 :vcenter_password => '123456',
62 :vcenter_datacenter => 'Datacenter',
63 :vcenter_datastore => 'Datastore',
64 :vcenter_image_dir => '/openstack_glance',
65 :vcenter_api_insecure => 'True',
66 :vcenter_task_poll_interval => '6',
67 :vcenter_api_retry_count => '11',
70 it 'configures glance-api.conf' do
71 should contain_glance_api_config('DEFAULT/vmware_api_insecure').with_value('True')
72 should contain_glance_api_config('DEFAULT/vmware_task_poll_interval').with_value('6')
73 should contain_glance_api_config('DEFAULT/vmware_api_retry_count').with_value('11')
79 context 'on Debian platforms' do
81 { :osfamily => 'Debian' }
84 it_configures 'glance with vsphere backend'
87 context 'on RedHat platforms' do
89 { :osfamily => 'RedHat' }
92 it_configures 'glance with vsphere backend'