puppet-cinder/spec/unit/provider/cinder_spec.rb
Emilien Macchi bd49302617 Configure keystone authtoken options
In cinder::api, use keystone::resource::authtoken to configure
keystone_authtoken section in cinder.conf, with all parameters required
to configure keystonemiddleware.
This patch will allow to deploy Cinder to use Keystone v3
authentification.

Some deprecations:
cinder::api::auth_type is deprecated, use cinder::keystone::authtoken::auth_type instead.
cinder::api::identity_uri is deprecated, use cinder::keystone::authtoken::auth_url instead.
cinder::api::auth_uri is deprecated, use cinder::keystone::authtoken::auth_uri instead.
cinder::api::keystone_tenant is deprecated, use cinder::keystone::authtoken::project_name instead.
cinder::api::keystone_user is deprecated, use cinder::keystone::authtoken::username instead.
cinder::api::keystone_password is deprecated, use cinder::keystone::authtoken::password instead.
cinder::api::memcached_servers is deprecated, use cinder::keystone::authtoken::memcached_servers instead.

Closes-Bug: #1604463
Change-Id: I64736457bd8527198a8a81ea784d3bf74284063b
2016-08-02 03:09:55 +00:00

49 lines
1.4 KiB
Ruby

require 'puppet'
require 'spec_helper'
require 'puppet/provider/cinder'
require 'tempfile'
klass = Puppet::Provider::Cinder
describe Puppet::Provider::Cinder do
after :each do
klass.reset
end
describe 'when retrieving the auth credentials' do
it 'should fail if no auth params are passed and the glance config file does not have the expected contents' do
mock = {}
Puppet::Util::IniConfig::File.expects(:new).returns(mock)
mock.expects(:read).with('/etc/cinder/cinder.conf')
expect do
klass.cinder_credentials
end.to raise_error(Puppet::Error, /Cinder types will not work/)
end
it 'should read conf file with all sections' do
creds_hash = {
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'project_domain_name' => 'Default',
'user_domain_name' => 'Default',
}
mock = {
'keystone_authtoken' => {
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
}
}
Puppet::Util::IniConfig::File.expects(:new).returns(mock)
mock.expects(:read).with('/etc/cinder/cinder.conf')
expect(klass.cinder_credentials).to eq(creds_hash)
end
end
end