puppet-glance/spec/defines/glance_backend_multistore_vsphere_spec.rb
Alan Bishop fd02761c6e Update the method of configuring glance backends
This patch updates the method of configuring glance backends to use the
modern syntax associated with glance's Multi Store feature. Glance's
glance_store/stores and glance_store/default_store parameters were
deprecated in Rocky, and are scheduled for removal in Ussuri.

Backends are now specified using new glance::api::enabled_backends and
glance::api::default_backend parameters. A series of
glance::backend::multistore::* defined resources support configuring
multiple instances of each backend.

The legacy glance::api::stores and glance::api::default_store parameters,
as well as the glance::backend::* class resources, are deprecated, but
continue to function for backward compatibility.

The glance::backend::s3 class is completely deprecated. Glance removed
support for the s3 backend in Newton.

Closes-Bug: #1846808
Change-Id: I4f3ec9ee7c4147a4e62de961a9532bdc45526f6b
2019-10-16 14:46:39 -07:00

89 lines
3.7 KiB
Ruby

#
# Copyright 2019 Red Hat, Inc.
#
# 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 glance::backend::multistore::vsphere
#
require 'spec_helper'
describe 'glance::backend::multistore::vsphere' do
let (:title) { 'vsphere' }
let :pre_condition do
'class { "glance::api::authtoken": password => "pass" }'
end
shared_examples_for 'glance::backend::multistore::vsphere' do
context 'when default parameters' do
let :params do
{
:vmware_server_host => '10.0.0.1',
:vmware_server_username => 'root',
:vmware_server_password => '123456',
:vmware_datastores => 'Datacenter:Datastore',
:vmware_store_image_dir => '/openstack_glance',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('vsphere/store_description').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('vsphere/vmware_insecure').with_value('True')
is_expected.to contain_glance_api_config('vsphere/vmware_server_host').with_value('10.0.0.1')
is_expected.to contain_glance_api_config('vsphere/vmware_server_username').with_value('root')
is_expected.to contain_glance_api_config('vsphere/vmware_server_password').with_value('123456').with_secret(true)
is_expected.to contain_glance_api_config('vsphere/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to contain_glance_api_config('vsphere/vmware_task_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('vsphere/vmware_api_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('vsphere/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_api_config('vsphere/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding parameters' do
let :params do
{
:store_description => 'My vsphere store',
:vmware_server_host => '10.0.0.1',
:vmware_server_username => 'root',
:vmware_server_password => '123456',
:vmware_datastores => 'Datacenter:Datastore',
:vmware_store_image_dir => '/openstack_glance',
:vmware_ca_file => '/etc/glance/vcenter-ca.pem',
:vmware_task_poll_interval => '6',
:vmware_api_retry_count => '11',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('vsphere/store_description').with_value('My vsphere store')
is_expected.to contain_glance_api_config('vsphere/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem')
is_expected.to contain_glance_api_config('vsphere/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_api_config('vsphere/vmware_api_retry_count').with_value('11')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'glance::backend::multistore::vsphere'
end
end
end