puppet-cinder/spec/unit/provider/cinder_spec.rb
qiaomin 385a2a1412 Replace port 35357 with 5000
Now that the v2.0 API has been removed, we don't have a reason to
include deployment instructions for two separate applications on
different ports.

Change-Id: I382b4f9b1c5954ce8d76bd66b1e35e9b2a521bb8
2018-05-13 00:40:03 +08:00

49 lines
1.5 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 = {
'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'project_domain_name' => 'Default',
'user_domain_name' => 'Default',
}
mock = {
'keystone_authtoken' => {
'www_authenticate_uri' => 'https://192.168.56.210:5000/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