fix spec tests
This commit is contained in:
@@ -6,6 +6,12 @@ describe 'openstack::compute' do
|
|||||||
{
|
{
|
||||||
:private_interface => 'eth0',
|
:private_interface => 'eth0',
|
||||||
:internal_address => '0.0.0.0',
|
:internal_address => '0.0.0.0',
|
||||||
|
:nova_user_password => 'nova_pass',
|
||||||
|
:rabbit_password => 'rabbit_pw',
|
||||||
|
:sql_connection => 'mysql://user:pass@host/dbname/',
|
||||||
|
:cinder_sql_connection => 'mysql://user:pass@host/dbname/',
|
||||||
|
:quantum => false,
|
||||||
|
:fixed_range => '10.0.0.0/16',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -22,13 +28,13 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
it {
|
it {
|
||||||
should contain_class('nova').with(
|
should contain_class('nova').with(
|
||||||
:sql_connection => false,
|
:sql_connection => 'mysql://user:pass@host/dbname/',
|
||||||
:rabbit_host => false,
|
:rabbit_host => '127.0.0.1',
|
||||||
:rabbit_userid => 'nova',
|
:rabbit_userid => 'nova',
|
||||||
:rabbit_password => 'rabbit_pw',
|
:rabbit_password => 'rabbit_pw',
|
||||||
:image_service => 'nova.image.glance.GlanceImageService',
|
:image_service => 'nova.image.glance.GlanceImageService',
|
||||||
:glance_api_servers => false,
|
:glance_api_servers => false,
|
||||||
:verbose => false
|
:verbose => 'False'
|
||||||
)
|
)
|
||||||
should contain_class('nova::compute').with(
|
should contain_class('nova::compute').with(
|
||||||
:enabled => true,
|
:enabled => true,
|
||||||
@@ -43,8 +49,6 @@ describe 'openstack::compute' do
|
|||||||
should contain_nova_config('multi_host').with( :value => 'False' )
|
should contain_nova_config('multi_host').with( :value => 'False' )
|
||||||
should contain_nova_config('send_arp_for_ha').with( :value => 'False' )
|
should contain_nova_config('send_arp_for_ha').with( :value => 'False' )
|
||||||
should_not contain_class('nova::api')
|
should_not contain_class('nova::api')
|
||||||
should_not contain_class('nova::volume')
|
|
||||||
should_not contain_class('nova::volume::iscsi')
|
|
||||||
should contain_class('nova::network').with({
|
should contain_class('nova::network').with({
|
||||||
:enabled => false,
|
:enabled => false,
|
||||||
:install_service => false,
|
:install_service => false,
|
||||||
@@ -82,7 +86,7 @@ describe 'openstack::compute' do
|
|||||||
let :params do
|
let :params do
|
||||||
default_params.merge(override_params)
|
default_params.merge(override_params)
|
||||||
end
|
end
|
||||||
it {
|
it do
|
||||||
should contain_class('nova').with(
|
should contain_class('nova').with(
|
||||||
:sql_connection => 'mysql://user:passwd@host/name',
|
:sql_connection => 'mysql://user:passwd@host/name',
|
||||||
:rabbit_host => 'my_host',
|
:rabbit_host => 'my_host',
|
||||||
@@ -105,8 +109,6 @@ describe 'openstack::compute' do
|
|||||||
should contain_nova_config('multi_host').with( :value => 'False' )
|
should contain_nova_config('multi_host').with( :value => 'False' )
|
||||||
should contain_nova_config('send_arp_for_ha').with( :value => 'False' )
|
should contain_nova_config('send_arp_for_ha').with( :value => 'False' )
|
||||||
should_not contain_class('nova::api')
|
should_not contain_class('nova::api')
|
||||||
should_not contain_class('nova::volume')
|
|
||||||
should_not contain_class('nova::volume::iscsi')
|
|
||||||
should contain_class('nova::network').with({
|
should contain_class('nova::network').with({
|
||||||
:enabled => false,
|
:enabled => false,
|
||||||
:install_service => false,
|
:install_service => false,
|
||||||
@@ -116,7 +118,7 @@ describe 'openstack::compute' do
|
|||||||
:enabled => false,
|
:enabled => false,
|
||||||
:install_service => false
|
:install_service => false
|
||||||
})
|
})
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when enabling volume management" do
|
describe "when enabling volume management" do
|
||||||
@@ -129,52 +131,32 @@ describe 'openstack::compute' do
|
|||||||
it do
|
it do
|
||||||
should contain_nova_config('multi_host').with({ 'value' => 'False'})
|
should contain_nova_config('multi_host').with({ 'value' => 'False'})
|
||||||
should_not contain_class('nova::api')
|
should_not contain_class('nova::api')
|
||||||
should contain_class('nova::volume').with(:enabled => true)
|
|
||||||
should contain_class('nova::network').with({
|
should contain_class('nova::network').with({
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
'install_service' => false
|
'install_service' => false
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
describe 'with default volume settings' do
|
|
||||||
it { should contain_class('nova::volume::iscsi').with(
|
|
||||||
:volume_group => 'nova-volumes',
|
|
||||||
:iscsi_ip_address => '0.0.0.0'
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
describe 'when overriding volume parameters' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:manage_volumes => true,
|
|
||||||
:nova_volume => 'nova-volumes2',
|
|
||||||
:internal_address => '127.0.0.1'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
it { should contain_class('nova::volume::iscsi').with(
|
|
||||||
:volume_group => 'nova-volumes2',
|
|
||||||
:iscsi_ip_address => '127.0.0.1'
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when configuring for multi host" do
|
describe 'when quantum is false' do
|
||||||
|
describe 'configuring for multi host' do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge({
|
default_params.merge({
|
||||||
:multi_host => true,
|
:multi_host => true,
|
||||||
:public_interface => 'eth0'
|
:public_interface => 'eth0',
|
||||||
|
:quantum => false
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it {
|
it 'should configure nova for multi-host' do
|
||||||
should contain_class('keystone::python')
|
#should contain_class('keystone::python')
|
||||||
should contain_nova_config('multi_host').with({ 'value' => 'True'})
|
should contain_nova_config('multi_host').with(:value => 'True')
|
||||||
should contain_nova_config('send_arp_for_ha').with(:value => 'True')
|
should contain_nova_config('send_arp_for_ha').with( :value => 'True')
|
||||||
should_not contain_class('nova::volume')
|
|
||||||
should_not contain_class('nova::volume::iscsi')
|
|
||||||
should contain_class('nova::network').with({
|
should contain_class('nova::network').with({
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'install_service' => true
|
'install_service' => true
|
||||||
})
|
})
|
||||||
}
|
end
|
||||||
describe 'with defaults' do
|
describe 'with defaults' do
|
||||||
it { should contain_class('nova::api').with(
|
it { should contain_class('nova::api').with(
|
||||||
:enabled => true,
|
:enabled => true,
|
||||||
@@ -183,17 +165,31 @@ describe 'openstack::compute' do
|
|||||||
:admin_password => 'nova_pass'
|
:admin_password => 'nova_pass'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
describe 'when overrding nova volumes' do
|
end
|
||||||
|
describe 'when overriding network params' do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge({
|
default_params.merge({
|
||||||
:multi_host => true,
|
:multi_host => true,
|
||||||
:public_interface => 'eth0',
|
:public_interface => 'eth0',
|
||||||
:nova_user_password => 'foo'
|
:manage_volumes => true,
|
||||||
|
:private_interface => 'eth1',
|
||||||
|
:public_interface => 'eth2',
|
||||||
|
:fixed_range => '12.0.0.0/24',
|
||||||
|
:network_manager => 'nova.network.manager.VlanManager',
|
||||||
|
:network_config => {'vlan_interface' => 'eth0'}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
it { should contain_class('nova::api').with(
|
it { should contain_class('nova::network').with({
|
||||||
:admin_password => 'foo'
|
:private_interface => 'eth1',
|
||||||
)}
|
:public_interface => 'eth2',
|
||||||
|
:fixed_range => '12.0.0.0/24',
|
||||||
|
:floating_range => false,
|
||||||
|
:network_manager => 'nova.network.manager.VlanManager',
|
||||||
|
:config_overrides => {'vlan_interface' => 'eth0'},
|
||||||
|
:create_networks => false,
|
||||||
|
'enabled' => true,
|
||||||
|
'install_service' => true
|
||||||
|
})}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -221,8 +217,6 @@ describe 'openstack::compute' do
|
|||||||
it {
|
it {
|
||||||
should contain_nova_config('multi_host').with({ 'value' => 'True'})
|
should contain_nova_config('multi_host').with({ 'value' => 'True'})
|
||||||
should contain_class('nova::api')
|
should contain_class('nova::api')
|
||||||
should contain_class('nova::volume')
|
|
||||||
should contain_class('nova::volume::iscsi')
|
|
||||||
should contain_class('nova::network').with({
|
should contain_class('nova::network').with({
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'install_service' => true
|
'install_service' => true
|
||||||
@@ -230,30 +224,4 @@ describe 'openstack::compute' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when overriding network params' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:multi_host => true,
|
|
||||||
:public_interface => 'eth0',
|
|
||||||
:manage_volumes => true,
|
|
||||||
:private_interface => 'eth1',
|
|
||||||
:public_interface => 'eth2',
|
|
||||||
:fixed_range => '12.0.0.0/24',
|
|
||||||
:network_manager => 'nova.network.manager.VlanManager',
|
|
||||||
:network_config => {'vlan_interface' => 'eth0'}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
it { should contain_class('nova::network').with({
|
|
||||||
:private_interface => 'eth1',
|
|
||||||
:public_interface => 'eth2',
|
|
||||||
:fixed_range => '12.0.0.0/24',
|
|
||||||
:floating_range => false,
|
|
||||||
:network_manager => 'nova.network.manager.VlanManager',
|
|
||||||
:config_overrides => {'vlan_interface' => 'eth0'},
|
|
||||||
:create_networks => false,
|
|
||||||
'enabled' => true,
|
|
||||||
'install_service' => true
|
|
||||||
})}
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@@ -1,13 +1,25 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack::controller' do
|
describe 'openstack::controller' do
|
||||||
|
|
||||||
|
# minimum set of default parameters
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{
|
{
|
||||||
:private_interface => 'eth0',
|
:private_interface => 'eth0',
|
||||||
:public_interface => 'eth1',
|
:public_interface => 'eth1',
|
||||||
:internal_address => '127.0.0.1',
|
:internal_address => '127.0.0.1',
|
||||||
:public_address => '10.0.0.1',
|
:public_address => '10.0.0.1',
|
||||||
:export_resources => false,
|
:admin_email => 'some_user@some_fake_email_address.foo',
|
||||||
|
:admin_password => 'ChangeMe',
|
||||||
|
:rabbit_password => 'rabbit_pw',
|
||||||
|
:keystone_db_password => 'keystone_pass',
|
||||||
|
:keystone_admin_token => 'keystone_admin_token',
|
||||||
|
:glance_db_password => 'glance_pass',
|
||||||
|
:glance_user_password => 'glance_pass',
|
||||||
|
:nova_db_password => 'nova_pass',
|
||||||
|
:nova_user_password => 'nova_pass',
|
||||||
|
:secret_key => 'secret_key',
|
||||||
|
:quantum => false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -15,104 +27,221 @@ describe 'openstack::controller' do
|
|||||||
{
|
{
|
||||||
:operatingsystem => 'Ubuntu',
|
:operatingsystem => 'Ubuntu',
|
||||||
:osfamily => 'Debian',
|
:osfamily => 'Debian',
|
||||||
:concat_basedir => '/tmp/',
|
|
||||||
:puppetversion => '2.7.x',
|
:puppetversion => '2.7.x',
|
||||||
:memorysize => '2GB',
|
:memorysize => '2GB',
|
||||||
:processorcount => '2'
|
:processorcount => '2'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
default_params
|
default_params
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should_not contain_nova_config('auto_assign_floating_ip') }
|
context 'database' do
|
||||||
describe 'when auto assign floating ip is assigned' do
|
|
||||||
|
context 'with unsupported db type' do
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge(:auto_assign_floating_ip => 'true')
|
default_params.merge({:db_type => 'sqlite'})
|
||||||
end
|
|
||||||
it { should contain_nova_config('auto_assign_floating_ip').with(:value => 'True')}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
should contain_class('mysql::server').with(
|
expect { subject }.to raise_error(Puppet::Error)
|
||||||
:config_hash => {'bind_address' => '0.0.0.0', 'root_password' => 'sql_pass' }
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with default mysql params' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
:enabled => true,
|
||||||
|
:db_type => 'mysql',
|
||||||
|
:quantum => true,
|
||||||
|
:cinder => true
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_class('mysql::server').with(
|
||||||
|
:config_hash => {'bind_address' => '0.0.0.0', 'root_password' => 'sql_pass' },
|
||||||
|
:enabled => true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
it 'should contain openstack db config' do
|
||||||
|
should contain_class('keystone::db::mysql').with(
|
||||||
|
:user => 'keystone',
|
||||||
|
:password => 'keystone_pass',
|
||||||
|
:dbname => 'keystone',
|
||||||
|
:allowed_hosts => '%'
|
||||||
|
)
|
||||||
|
should contain_class('glance::db::mysql').with(
|
||||||
|
:user => 'glance',
|
||||||
|
:password => 'glance_pass',
|
||||||
|
:dbname => 'glance',
|
||||||
|
:allowed_hosts => '%'
|
||||||
|
)
|
||||||
|
should contain_class('nova::db::mysql').with(
|
||||||
|
:user => 'nova',
|
||||||
|
:password => 'nova_pass',
|
||||||
|
:dbname => 'nova',
|
||||||
|
:allowed_hosts => '%'
|
||||||
|
)
|
||||||
|
should contain_class('cinder::db::mysql').with(
|
||||||
|
:user => 'cinder',
|
||||||
|
:password => 'cinder_pass',
|
||||||
|
:dbname => 'cinder',
|
||||||
|
:allowed_hosts => '%'
|
||||||
|
)
|
||||||
|
should contain_class('quantum::db::mysql').with(
|
||||||
|
:user => 'quantum',
|
||||||
|
:password => 'quantum_pass',
|
||||||
|
:dbname => 'quantum',
|
||||||
|
:allowed_hosts => '%'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
it { should contain_class('mysql::server::account_security')}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when cinder and quantum are false' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
:quantum => false,
|
||||||
|
:cinder => false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
it do
|
||||||
|
should_not contain_class('quantum::db::mysql')
|
||||||
|
should_not contain_class('cinder::db::mysql')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when not enabled' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
{:enabled => false}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_class('mysql::server').with(
|
||||||
|
:config_hash => {'bind_address' => '0.0.0.0', 'root_password' => 'sql_pass' },
|
||||||
|
:enabled => false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
['keystone', 'nova', 'glance', 'cinder', 'quantum'].each do |x|
|
||||||
|
it { should_not contain_class("#{x}::db::mysql") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when account secutiry is not enabled' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
{:mysql_account_security => false}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should_not contain_class('mysql::server::account_security')}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'keystone' do
|
||||||
|
|
||||||
|
context 'with default params' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_class('keystone').with(
|
||||||
|
:verbose => 'False',
|
||||||
|
:debug => 'False',
|
||||||
|
:catalog_type => 'sql',
|
||||||
|
:enabled => true,
|
||||||
|
:admin_token => 'keystone_admin_token',
|
||||||
|
:sql_connection => "mysql://keystone:keystone_pass@127.0.0.1/keystone"
|
||||||
|
) }
|
||||||
|
|
||||||
|
it 'should contain endpoints' do
|
||||||
|
should contain_class('keystone::roles::admin').with(
|
||||||
|
:email => 'some_user@some_fake_email_address.foo',
|
||||||
|
:password => 'ChangeMe',
|
||||||
|
:admin_tenant => 'admin'
|
||||||
|
)
|
||||||
|
should contain_class('keystone::endpoint').with(
|
||||||
|
:public_address => '10.0.0.1',
|
||||||
|
:internal_address => '127.0.0.1',
|
||||||
|
:admin_address => '127.0.0.1',
|
||||||
|
:region => 'RegionOne'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
'nova' => 'nova_pass',
|
||||||
|
'cinder' => 'cinder_pass',
|
||||||
|
'glance' => 'glance_pass'
|
||||||
|
|
||||||
|
}.each do |type, pw|
|
||||||
|
should contain_class("#{type}::keystone::auth").with(
|
||||||
|
:password => pw,
|
||||||
|
:public_address => '10.0.0.1',
|
||||||
|
:internal_address => '10.0.0.1',
|
||||||
|
:admin_address => '10.0.0.1',
|
||||||
|
:region => 'RegionOne'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context 'when not enabled' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(:enabled => false)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not configure endpoints' do
|
||||||
|
should contain_class('keystone').with(:enabled => false)
|
||||||
|
should_not contain_class('keystone::roles::admin')
|
||||||
|
should_not contain_class('keystone::endpoint')
|
||||||
|
should_not contain_class('glance::keystone::auth')
|
||||||
|
should_not contain_class('nova::keystone::auth')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
should contain_class('memcached').with(
|
should contain_class('memcached').with(
|
||||||
:listen_ip => '127.0.0.1'
|
:listen_ip => '127.0.0.1'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when enabled' do
|
|
||||||
it 'should contain enabled database configs' do
|
|
||||||
should contain_class('mysql::server').with(
|
|
||||||
:enabled => true
|
|
||||||
)
|
|
||||||
should contain_class('keystone::db::mysql').with(
|
|
||||||
:password => 'keystone_pass'
|
|
||||||
)
|
|
||||||
should contain_class('glance::db::mysql').with(
|
|
||||||
:host => '127.0.0.1',
|
|
||||||
:password => 'glance_pass',
|
|
||||||
:before => ["Class[Glance::Registry]", "Exec[glance-manage db_sync]"]
|
|
||||||
)
|
|
||||||
should contain_class('nova::db::mysql').with(
|
|
||||||
:password => 'nova_pass',
|
|
||||||
:host => '127.0.0.1',
|
|
||||||
:allowed_hosts => '%'
|
|
||||||
)
|
|
||||||
end
|
|
||||||
it 'should contain enabled keystone configs with defaults' do
|
|
||||||
|
|
||||||
should contain_class('keystone').with(
|
|
||||||
:admin_token => 'keystone_admin_token',
|
context 'config for glance' do
|
||||||
:bind_host => '0.0.0.0',
|
|
||||||
:verbose => false,
|
context 'when enabled' do
|
||||||
:debug => false,
|
it 'should contain enabled glance with defaults' do
|
||||||
:catalog_type => 'sql',
|
|
||||||
:enabled => true
|
|
||||||
)
|
|
||||||
should contain_class('keystone::config::mysql').with(
|
|
||||||
:password => 'keystone_pass'
|
|
||||||
)
|
|
||||||
should contain_class('keystone::roles::admin').with(
|
|
||||||
:email => 'some_user@some_fake_email_address.foo',
|
|
||||||
:password => 'ChangeMe'
|
|
||||||
)
|
|
||||||
should contain_class('keystone::endpoint').with(
|
|
||||||
:public_address => '10.0.0.1',
|
|
||||||
:internal_address => '127.0.0.1',
|
|
||||||
:admin_address => '127.0.0.1'
|
|
||||||
)
|
|
||||||
should contain_class('glance::keystone::auth').with(
|
|
||||||
:password => 'glance_pass',
|
|
||||||
:public_address => '10.0.0.1',
|
|
||||||
:internal_address => '127.0.0.1',
|
|
||||||
:admin_address => '127.0.0.1'
|
|
||||||
#:before => ['Class[glance::api]', 'Class[glance::registry]']
|
|
||||||
)
|
|
||||||
should contain_class('nova::keystone::auth').with(
|
|
||||||
:password => 'nova_pass',
|
|
||||||
:public_address => '10.0.0.1',
|
|
||||||
:internal_address => '127.0.0.1',
|
|
||||||
:admin_address => '127.0.0.1'
|
|
||||||
#:before => 'Class[nova::api]'
|
|
||||||
)
|
|
||||||
should contain_class('glance::api').with(
|
should contain_class('glance::api').with(
|
||||||
:verbose => false,
|
:verbose => 'False',
|
||||||
:debug => false,
|
:debug => 'False',
|
||||||
:auth_type => 'keystone',
|
:auth_type => 'keystone',
|
||||||
:auth_host => '127.0.0.1',
|
:auth_host => '127.0.0.1',
|
||||||
:auth_port => '35357',
|
:auth_port => '35357',
|
||||||
:keystone_tenant => 'services',
|
:keystone_tenant => 'services',
|
||||||
:keystone_user => 'glance',
|
:keystone_user => 'glance',
|
||||||
:keystone_password => 'glance_pass',
|
:keystone_password => 'glance_pass',
|
||||||
|
:sql_connection => 'mysql://glance:glance_pass@127.0.0.1/glance',
|
||||||
:enabled => true
|
:enabled => true
|
||||||
)
|
)
|
||||||
should contain_class('glance::backend::file')
|
|
||||||
|
|
||||||
should contain_class('glance::registry').with(
|
should contain_class('glance::registry').with(
|
||||||
:verbose => false,
|
:verbose => 'False',
|
||||||
:debug => false,
|
:debug => 'False',
|
||||||
:auth_type => 'keystone',
|
:auth_type => 'keystone',
|
||||||
:auth_host => '127.0.0.1',
|
:auth_host => '127.0.0.1',
|
||||||
:auth_port => '35357',
|
:auth_port => '35357',
|
||||||
@@ -122,6 +251,82 @@ describe 'openstack::controller' do
|
|||||||
:sql_connection => "mysql://glance:glance_pass@127.0.0.1/glance",
|
:sql_connection => "mysql://glance:glance_pass@127.0.0.1/glance",
|
||||||
:enabled => true
|
:enabled => true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
should contain_class('glance::backend::file')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context 'when not enabled' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(:enabled => false)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should disable glance services' do
|
||||||
|
should contain_class('glance::api').with(
|
||||||
|
:enabled => false
|
||||||
|
)
|
||||||
|
|
||||||
|
should contain_class('glance::registry').with(
|
||||||
|
:enabled => false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context 'when params are overridden' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
:verbose => 'False',
|
||||||
|
:glance_user_password => 'glance_pass2',
|
||||||
|
:glance_db_password => 'glance_pass3',
|
||||||
|
:db_host => '127.0.0.2',
|
||||||
|
:glance_db_user => 'dan',
|
||||||
|
:glance_db_dbname => 'name',
|
||||||
|
:db_host => '127.0.0.2'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should override params for glance' do
|
||||||
|
should contain_class('glance::api').with(
|
||||||
|
:verbose => 'False',
|
||||||
|
:debug => 'False',
|
||||||
|
:auth_type => 'keystone',
|
||||||
|
:auth_host => '127.0.0.1',
|
||||||
|
:auth_port => '35357',
|
||||||
|
:keystone_tenant => 'services',
|
||||||
|
:keystone_user => 'glance',
|
||||||
|
:keystone_password => 'glance_pass2',
|
||||||
|
:sql_connection => 'mysql://dan:glance_pass3@127.0.0.2/name'
|
||||||
|
)
|
||||||
|
|
||||||
|
should contain_class('glance::registry').with(
|
||||||
|
:verbose => 'False',
|
||||||
|
:debug => 'False',
|
||||||
|
:auth_type => 'keystone',
|
||||||
|
:auth_host => '127.0.0.1',
|
||||||
|
:auth_port => '35357',
|
||||||
|
:keystone_tenant => 'services',
|
||||||
|
:keystone_user => 'glance',
|
||||||
|
:keystone_password => 'glance_pass2',
|
||||||
|
:sql_connection => "mysql://dan:glance_pass3@127.0.0.2/name"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'config for nova' do
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:operatingsystem => 'Ubuntu',
|
||||||
|
:osfamily => 'Debian',
|
||||||
|
:puppetversion => '2.7.x',
|
||||||
|
:memorysize => '2GB',
|
||||||
|
:processorcount => '2'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with default params' do
|
||||||
|
|
||||||
|
it 'should contain enabled nova services' do
|
||||||
should contain_class('nova::rabbitmq').with(
|
should contain_class('nova::rabbitmq').with(
|
||||||
:userid => 'nova',
|
:userid => 'nova',
|
||||||
:password => 'rabbit_pw',
|
:password => 'rabbit_pw',
|
||||||
@@ -134,7 +339,7 @@ describe 'openstack::controller' do
|
|||||||
:rabbit_password => 'rabbit_pw',
|
:rabbit_password => 'rabbit_pw',
|
||||||
:image_service => 'nova.image.glance.GlanceImageService',
|
:image_service => 'nova.image.glance.GlanceImageService',
|
||||||
:glance_api_servers => '10.0.0.1:9292',
|
:glance_api_servers => '10.0.0.1:9292',
|
||||||
:verbose => false
|
:verbose => 'False'
|
||||||
)
|
)
|
||||||
should contain_class('nova::api').with(
|
should contain_class('nova::api').with(
|
||||||
:enabled => true,
|
:enabled => true,
|
||||||
@@ -147,159 +352,20 @@ describe 'openstack::controller' do
|
|||||||
should contain_class('nova::scheduler').with(:enabled => true)
|
should contain_class('nova::scheduler').with(:enabled => true)
|
||||||
should contain_class('nova::objectstore').with(:enabled => true)
|
should contain_class('nova::objectstore').with(:enabled => true)
|
||||||
should contain_class('nova::vncproxy').with(:enabled => true)
|
should contain_class('nova::vncproxy').with(:enabled => true)
|
||||||
should contain_class('horizon').with(
|
|
||||||
:secret_key => 'dummy_secret_key',
|
|
||||||
:cache_server_ip => '127.0.0.1',
|
|
||||||
:cache_server_port => '11211',
|
|
||||||
:swift => false,
|
|
||||||
:quantum => false,
|
|
||||||
:horizon_app_links => false
|
|
||||||
)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
describe 'when overriding params' do
|
it { should_not contain_nova_config('auto_assign_floating_ip') }
|
||||||
|
end
|
||||||
|
context 'when auto assign floating ip is assigned' do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge(
|
default_params.merge(:auto_assign_floating_ip => 'true')
|
||||||
:keystone_db_password => 'pass',
|
|
||||||
:glance_db_password => 'pass2',
|
|
||||||
:nova_db_password => 'pass3',
|
|
||||||
:verbose => true,
|
|
||||||
:keystone_admin_token => 'foo',
|
|
||||||
:nova_user_password => 'pass5',
|
|
||||||
:glance_user_password => 'pass6',
|
|
||||||
:admin_email => 'dan@puppetlabs.com',
|
|
||||||
:admin_address => '127.0.0.2',
|
|
||||||
:admin_password => 'pass7',
|
|
||||||
:rabbit_user => 'rabby',
|
|
||||||
:rabbit_password => 'rabby_pw',
|
|
||||||
:fixed_range => '10.0.0.0/24',
|
|
||||||
:floating_range => '11.0.0.0/24',
|
|
||||||
:network_manager => 'nova.network.manager.VlanManager',
|
|
||||||
:network_config => {'vlan_interface' => 'eth4'},
|
|
||||||
:num_networks => 2,
|
|
||||||
:secret_key => 'real_secret_key',
|
|
||||||
:cache_server_ip => '127.0.0.2',
|
|
||||||
:cache_server_port => '11212',
|
|
||||||
:swift => true,
|
|
||||||
:quantum => true,
|
|
||||||
:horizon_app_links => true,
|
|
||||||
:glance_api_servers => '127.0.0.1:9292'
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
it 'should override db config' do
|
it { should contain_nova_config('auto_assign_floating_ip').with(:value => 'True')}
|
||||||
should contain_class('keystone::db::mysql').with(
|
|
||||||
:password => 'pass'
|
|
||||||
)
|
|
||||||
should contain_class('glance::db::mysql').with(
|
|
||||||
:password => 'pass2'
|
|
||||||
)
|
|
||||||
should contain_class('nova::db::mysql').with(
|
|
||||||
:password => 'pass3'
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
context 'when not enabled' do
|
||||||
it 'should override keystone config' do
|
|
||||||
should contain_class('keystone').with(
|
|
||||||
:verbose => true,
|
|
||||||
:debug => true,
|
|
||||||
:admin_token => 'foo'
|
|
||||||
)
|
|
||||||
should contain_class('keystone::config::mysql').with(
|
|
||||||
:password => 'pass'
|
|
||||||
)
|
|
||||||
should contain_class('keystone::endpoint').with(
|
|
||||||
:admin_address => '127.0.0.2'
|
|
||||||
)
|
|
||||||
should contain_class('keystone::roles::admin').with(
|
|
||||||
:email => 'dan@puppetlabs.com',
|
|
||||||
:password => 'pass7'
|
|
||||||
)
|
|
||||||
should contain_class('glance::keystone::auth').with(
|
|
||||||
:password => 'pass6',
|
|
||||||
:admin_address => '127.0.0.2'
|
|
||||||
)
|
|
||||||
should contain_class('nova::keystone::auth').with(
|
|
||||||
:password => 'pass5',
|
|
||||||
:admin_address => '127.0.0.2'
|
|
||||||
)
|
|
||||||
end
|
|
||||||
it 'should override glance config' do
|
|
||||||
should contain_class('glance::api').with(
|
|
||||||
:verbose => true,
|
|
||||||
:debug => true,
|
|
||||||
:keystone_password => 'pass6',
|
|
||||||
:enabled => true
|
|
||||||
)
|
|
||||||
should contain_class('glance::registry').with(
|
|
||||||
:verbose => true,
|
|
||||||
:debug => true,
|
|
||||||
:keystone_password => 'pass6',
|
|
||||||
:sql_connection => "mysql://glance:pass2@127.0.0.1/glance",
|
|
||||||
:enabled => true
|
|
||||||
)
|
|
||||||
end
|
|
||||||
it 'should override nova config' do
|
|
||||||
should contain_class('nova::rabbitmq').with(
|
|
||||||
:userid => 'rabby',
|
|
||||||
:password => 'rabby_pw',
|
|
||||||
:enabled => true
|
|
||||||
)
|
|
||||||
should contain_class('nova').with(
|
|
||||||
:sql_connection => 'mysql://nova:pass3@127.0.0.1/nova',
|
|
||||||
:rabbit_host => '127.0.0.1',
|
|
||||||
:rabbit_userid => 'rabby',
|
|
||||||
:rabbit_password => 'rabby_pw',
|
|
||||||
:image_service => 'nova.image.glance.GlanceImageService',
|
|
||||||
:glance_api_servers => '127.0.0.1:9292',
|
|
||||||
:verbose => true
|
|
||||||
)
|
|
||||||
should contain_class('nova::api').with(
|
|
||||||
:enabled => true,
|
|
||||||
:admin_tenant_name => 'services',
|
|
||||||
:admin_user => 'nova',
|
|
||||||
:admin_password => 'pass5'
|
|
||||||
)
|
|
||||||
should contain_class('nova::network').with(
|
|
||||||
:fixed_range => '10.0.0.0/24',
|
|
||||||
:floating_range => '11.0.0.0/24',
|
|
||||||
:network_manager => 'nova.network.manager.VlanManager',
|
|
||||||
:config_overrides => {'vlan_interface' => 'eth4'},
|
|
||||||
:num_networks => 2
|
|
||||||
)
|
|
||||||
end
|
|
||||||
describe 'it should override horizon params' do
|
|
||||||
it { should contain_class('horizon').with(
|
|
||||||
:secret_key => 'real_secret_key',
|
|
||||||
:cache_server_ip => '127.0.0.2',
|
|
||||||
:cache_server_port => '11212',
|
|
||||||
:swift => true,
|
|
||||||
:quantum => true,
|
|
||||||
:horizon_app_links => true
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when not enabled' do
|
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge(:enabled => false)
|
default_params.merge(:enabled => false)
|
||||||
end
|
end
|
||||||
it do
|
it 'should disable everything' do
|
||||||
should contain_class('mysql::server').with(
|
|
||||||
:enabled => false
|
|
||||||
)
|
|
||||||
should_not contain_class('keystone::db::mysql')
|
|
||||||
should_not contain_class('glance::db::mysql')
|
|
||||||
should_not contain_class('nova::db::mysql')
|
|
||||||
should contain_class('keystone::config::mysql')
|
|
||||||
should contain_class('keystone').with(:enabled => false)
|
|
||||||
should_not contain_class('keystone::roles::admin')
|
|
||||||
should_not contain_class('keystone::endpoint')
|
|
||||||
should_not contain_class('glance::keystone::auth')
|
|
||||||
should_not contain_class('nova::keystone::auth')
|
|
||||||
should contain_class('glance::api').with(:enabled => false)
|
|
||||||
should contain_class('glance::backend::file')
|
|
||||||
should contain_class('glance::registry').with(:enabled => false)
|
|
||||||
should contain_class('nova::rabbitmq').with(:enabled => false)
|
should contain_class('nova::rabbitmq').with(:enabled => false)
|
||||||
should contain_class('nova::api').with(:enabled => false)
|
should contain_class('nova::api').with(:enabled => false)
|
||||||
should contain_class('nova::cert').with(:enabled => false)
|
should contain_class('nova::cert').with(:enabled => false)
|
||||||
@@ -309,13 +375,95 @@ describe 'openstack::controller' do
|
|||||||
should contain_class('nova::vncproxy').with(:enabled => false)
|
should contain_class('nova::vncproxy').with(:enabled => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'nova network config' do
|
|
||||||
|
|
||||||
describe 'when enabled' do
|
context 'config for horizon' do
|
||||||
|
|
||||||
describe 'when multihost is not set' do
|
it 'should contain enabled horizon' do
|
||||||
|
should contain_class('horizon').with(
|
||||||
|
:secret_key => 'secret_key',
|
||||||
|
:cache_server_ip => '127.0.0.1',
|
||||||
|
:cache_server_port => '11211',
|
||||||
|
:swift => false,
|
||||||
|
:quantum => false,
|
||||||
|
:horizon_app_links => false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'cinder' do
|
||||||
|
|
||||||
|
context 'when disabled' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge(:cinder => false)
|
||||||
|
end
|
||||||
|
it 'should not contain cinder classes' do
|
||||||
|
should_not contain_class('cinder::base')
|
||||||
|
should_not contain_class('cinder::api')
|
||||||
|
should_not contain_class('cinder:"scheduler')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when enabled' do
|
||||||
|
let :params do
|
||||||
|
default_params
|
||||||
|
end
|
||||||
|
it 'should configure cinder using defaults' do
|
||||||
|
should contain_class('cinder::base').with(
|
||||||
|
:verbose => 'False',
|
||||||
|
:sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder?charset=utf8',
|
||||||
|
:rabbit_password => 'rabbit_pw'
|
||||||
|
)
|
||||||
|
should contain_class('cinder::api').with_keystone_password('cinder_pass')
|
||||||
|
should contain_class('cinder::scheduler')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when overriding config' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
:verbose => 'True',
|
||||||
|
:rabbit_password => 'rabbit_pw2',
|
||||||
|
:cinder_user_password => 'foo',
|
||||||
|
:cinder_db_password => 'bar',
|
||||||
|
:cinder_db_user => 'baz',
|
||||||
|
:cinder_db_dbname => 'blah',
|
||||||
|
:db_host => '127.0.0.2'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
it 'should configure cinder using defaults' do
|
||||||
|
should contain_class('cinder::base').with(
|
||||||
|
:verbose => 'True',
|
||||||
|
:sql_connection => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8',
|
||||||
|
:rabbit_password => 'rabbit_pw2'
|
||||||
|
)
|
||||||
|
should contain_class('cinder::api').with_keystone_password('foo')
|
||||||
|
should contain_class('cinder::scheduler')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'network config' do
|
||||||
|
|
||||||
|
context 'when quantum' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
default_params.merge(:quantum => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should_not contain_class('nova::network') }
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when nova network' do
|
||||||
|
|
||||||
|
|
||||||
|
context 'when multi-host is not set' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge(:quantum => false, :multi_host => false)
|
||||||
|
end
|
||||||
it {should contain_class('nova::network').with(
|
it {should contain_class('nova::network').with(
|
||||||
:private_interface => 'eth0',
|
:private_interface => 'eth0',
|
||||||
:public_interface => 'eth1',
|
:public_interface => 'eth1',
|
||||||
@@ -328,11 +476,11 @@ describe 'openstack::controller' do
|
|||||||
:enabled => true,
|
:enabled => true,
|
||||||
:install_service => true
|
:install_service => true
|
||||||
)}
|
)}
|
||||||
|
|
||||||
end
|
end
|
||||||
describe 'when multihost is set' do
|
|
||||||
|
context 'when multi-host is set' do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge(:multi_host => true)
|
default_params.merge(:quantum => false, :multi_host => true)
|
||||||
end
|
end
|
||||||
it { should contain_nova_config('multi_host').with(:value => 'True')}
|
it { should contain_nova_config('multi_host').with(:value => 'True')}
|
||||||
it {should contain_class('nova::network').with(
|
it {should contain_class('nova::network').with(
|
||||||
@@ -340,46 +488,8 @@ describe 'openstack::controller' do
|
|||||||
:enabled => false,
|
:enabled => false,
|
||||||
:install_service => false
|
:install_service => false
|
||||||
)}
|
)}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when not enabled' do
|
|
||||||
|
|
||||||
describe 'when multihost is set' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge(
|
|
||||||
:multi_host => true,
|
|
||||||
:enabled => false
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it {should contain_class('nova::network').with(
|
|
||||||
:create_networks => false,
|
|
||||||
:enabled => false,
|
|
||||||
:install_service => false
|
|
||||||
)}
|
|
||||||
|
|
||||||
end
|
|
||||||
describe 'when multihost is not set' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge(
|
|
||||||
:multi_host => false,
|
|
||||||
:enabled => false
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it {should contain_class('nova::network').with(
|
|
||||||
:create_networks => false,
|
|
||||||
:enabled => false,
|
|
||||||
:install_service => false
|
|
||||||
)}
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user