Add rspec tests for cinder
Tests all references to volume_group and cinder related resources. Change-Id: I2823dce44c32e4fc1b29d836224d24e6c272ef8b
This commit is contained in:
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|||||||
describe 'openstack::all' do
|
describe 'openstack::all' do
|
||||||
|
|
||||||
# minimum set of default parameters
|
# minimum set of default parameters
|
||||||
let :default_params do
|
let :params do
|
||||||
{
|
{
|
||||||
:public_address => '10.0.0.1',
|
:public_address => '10.0.0.1',
|
||||||
:public_interface => 'eth1',
|
:public_interface => 'eth1',
|
||||||
@@ -19,7 +19,7 @@ describe 'openstack::all' do
|
|||||||
:nova_db_password => 'nova_pass',
|
:nova_db_password => 'nova_pass',
|
||||||
:nova_user_password => 'nova_pass',
|
:nova_user_password => 'nova_pass',
|
||||||
:secret_key => 'secret_key',
|
:secret_key => 'secret_key',
|
||||||
:quantum => false,
|
:quantum => false
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -31,17 +31,13 @@ describe 'openstack::all' do
|
|||||||
:puppetversion => '2.7.x',
|
:puppetversion => '2.7.x',
|
||||||
:memorysize => '2GB',
|
:memorysize => '2GB',
|
||||||
:processorcount => '2',
|
:processorcount => '2',
|
||||||
:concat_basedir => '/var/lib/puppet/concat',
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let :params do
|
context 'with required parameters' do
|
||||||
default_params
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'config for horizon' do
|
it 'configures horizon' do
|
||||||
|
|
||||||
it 'should contain enabled horizon' do
|
|
||||||
should contain_class('horizon').with(
|
should contain_class('horizon').with(
|
||||||
:secret_key => 'secret_key',
|
:secret_key => 'secret_key',
|
||||||
:cache_server_ip => '127.0.0.1',
|
:cache_server_ip => '127.0.0.1',
|
||||||
@@ -52,11 +48,38 @@ describe 'openstack::all' do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when horizon is disabled' do
|
context 'when disabling horizon' do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge(:horizon => false)
|
params.merge!(:horizon => false)
|
||||||
end
|
end
|
||||||
it { should_not contain_class('horizon') }
|
it { should_not contain_class('horizon') }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with cinder' do
|
||||||
|
before do
|
||||||
|
params.merge!(
|
||||||
|
:cinder => true,
|
||||||
|
:cinder_user_password => 'cinder_ks_passw0rd',
|
||||||
|
:cinder_db_password => 'cinder_db_passw0rd'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures cinder' do
|
||||||
|
should contain_class('cinder::base').with(
|
||||||
|
:verbose => 'False',
|
||||||
|
:sql_connection => "mysql://cinder:cinder_db_passw0rd@127.0.0.1/cinder?charset=utf8",
|
||||||
|
:rabbit_password => 'rabbit_pw'
|
||||||
|
)
|
||||||
|
should contain_class('cinder::api').with(
|
||||||
|
:keystone_password => 'cinder_ks_passw0rd'
|
||||||
|
)
|
||||||
|
should contain_class('cinder::scheduler')
|
||||||
|
should contain_class('cinder::volume')
|
||||||
|
should contain_class('cinder::volume::iscsi').with(
|
||||||
|
:iscsi_ip_address => '127.0.0.1',
|
||||||
|
:volume_group => 'cinder-volumes'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe 'openstack::compute' do
|
describe 'openstack::compute' do
|
||||||
|
|
||||||
let :default_params do
|
let :params do
|
||||||
{
|
{
|
||||||
:private_interface => 'eth0',
|
:private_interface => 'eth0',
|
||||||
:internal_address => '0.0.0.0',
|
:internal_address => '0.0.0.0',
|
||||||
@@ -13,10 +13,10 @@ describe 'openstack::compute' do
|
|||||||
:nova_admin_tenant_name => 'services',
|
:nova_admin_tenant_name => 'services',
|
||||||
:nova_admin_user => 'nova',
|
:nova_admin_user => 'nova',
|
||||||
:enabled_apis => 'ec2,osapi_compute,metadata',
|
:enabled_apis => 'ec2,osapi_compute,metadata',
|
||||||
:sql_connection => 'mysql://user:pass@host/dbname/',
|
:sql_connection => 'mysql://user:pass@host/dbname',
|
||||||
:cinder_sql_connection => 'mysql://user:pass@host/dbname/',
|
:cinder_sql_connection => 'mysql://user:pass@host/dbcinder',
|
||||||
:quantum => false,
|
:quantum => false,
|
||||||
:fixed_range => '10.0.0.0/16',
|
:fixed_range => '10.0.0.0/16'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -28,12 +28,9 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using default class parameters" do
|
describe "when using default class parameters" do
|
||||||
let :params do
|
|
||||||
default_params
|
|
||||||
end
|
|
||||||
it {
|
it {
|
||||||
should contain_class('nova').with(
|
should contain_class('nova').with(
|
||||||
:sql_connection => 'mysql://user:pass@host/dbname/',
|
:sql_connection => 'mysql://user:pass@host/dbname',
|
||||||
:rabbit_host => '127.0.0.1',
|
:rabbit_host => '127.0.0.1',
|
||||||
:rabbit_userid => 'nova',
|
:rabbit_userid => 'nova',
|
||||||
:rabbit_password => 'rabbit_pw',
|
:rabbit_password => 'rabbit_pw',
|
||||||
@@ -72,8 +69,8 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when overriding parameters, but not enabling multi-host or volume management" do
|
describe "when overriding parameters, but not enabling multi-host or volume management" do
|
||||||
let :override_params do
|
before do
|
||||||
{
|
params.merge!(
|
||||||
:private_interface => 'eth1',
|
:private_interface => 'eth1',
|
||||||
:internal_address => '127.0.0.1',
|
:internal_address => '127.0.0.1',
|
||||||
:public_interface => 'eth2',
|
:public_interface => 'eth2',
|
||||||
@@ -87,11 +84,8 @@ describe 'openstack::compute' do
|
|||||||
:libvirt_type => 'qemu',
|
:libvirt_type => 'qemu',
|
||||||
:vncproxy_host => '127.0.0.2',
|
:vncproxy_host => '127.0.0.2',
|
||||||
:vnc_enabled => false,
|
:vnc_enabled => false,
|
||||||
:verbose => true,
|
:verbose => true
|
||||||
}
|
)
|
||||||
end
|
|
||||||
let :params do
|
|
||||||
default_params.merge(override_params)
|
|
||||||
end
|
end
|
||||||
it do
|
it do
|
||||||
should contain_class('nova').with(
|
should contain_class('nova').with(
|
||||||
@@ -130,10 +124,8 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when enabling volume management" do
|
describe "when enabling volume management" do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge({
|
params.merge!( :manage_volumes => true )
|
||||||
:manage_volumes => true
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
@@ -146,14 +138,40 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with cinder' do
|
||||||
|
before do
|
||||||
|
params.merge!(
|
||||||
|
:cinder => true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures cinder' do
|
||||||
|
should contain_class('cinder::base').with(
|
||||||
|
:rabbit_password => 'rabbit_pw',
|
||||||
|
:rabbit_host => '127.0.0.1',
|
||||||
|
:sql_connection => 'mysql://user:pass@host/dbcinder',
|
||||||
|
:verbose => 'False'
|
||||||
|
)
|
||||||
|
should contain_class('cinder::volume')
|
||||||
|
should contain_class('cinder::volume::iscsi').with(
|
||||||
|
:iscsi_ip_address => '127.0.0.1',
|
||||||
|
:volume_group => 'cinder-volumes'
|
||||||
|
)
|
||||||
|
should contain_nova_config('DEFAULT/volume_api_class').with(
|
||||||
|
:value => 'nova.volume.cinder.API'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'when quantum is false' do
|
describe 'when quantum is false' do
|
||||||
|
|
||||||
describe 'configuring for multi host' do
|
describe 'configuring for multi host' do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge({
|
params.merge!(
|
||||||
:multi_host => true,
|
:multi_host => true,
|
||||||
:public_interface => 'eth0',
|
:public_interface => 'eth0',
|
||||||
:quantum => false
|
:quantum => false
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should configure nova for multi-host' do
|
it 'should configure nova for multi-host' do
|
||||||
@@ -165,6 +183,7 @@ describe 'openstack::compute' do
|
|||||||
'install_service' => true
|
'install_service' => true
|
||||||
})
|
})
|
||||||
end
|
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,
|
||||||
@@ -175,9 +194,10 @@ describe 'openstack::compute' do
|
|||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when overriding network params' do
|
describe 'when overriding network params' do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge({
|
params.merge!(
|
||||||
:multi_host => true,
|
:multi_host => true,
|
||||||
:public_interface => 'eth0',
|
:public_interface => 'eth0',
|
||||||
:manage_volumes => true,
|
:manage_volumes => true,
|
||||||
@@ -186,8 +206,9 @@ describe 'openstack::compute' do
|
|||||||
:fixed_range => '12.0.0.0/24',
|
:fixed_range => '12.0.0.0/24',
|
||||||
:network_manager => 'nova.network.manager.VlanManager',
|
:network_manager => 'nova.network.manager.VlanManager',
|
||||||
:network_config => {'vlan_interface' => 'eth0'}
|
:network_config => {'vlan_interface' => 'eth0'}
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_class('nova::network').with({
|
it { should contain_class('nova::network').with({
|
||||||
:private_interface => 'eth1',
|
:private_interface => 'eth1',
|
||||||
:public_interface => 'eth2',
|
:public_interface => 'eth2',
|
||||||
@@ -203,10 +224,8 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when configuring for multi host without a public interface" do
|
describe "when configuring for multi host without a public interface" do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge({
|
params.merge!( :multi_host => true )
|
||||||
:multi_host => true
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it {
|
it {
|
||||||
@@ -215,12 +234,12 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when enabling volume management and using multi host" do
|
describe "when enabling volume management and using multi host" do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge({
|
params.merge!(
|
||||||
:multi_host => true,
|
:multi_host => true,
|
||||||
:public_interface => 'eth0',
|
:public_interface => 'eth0',
|
||||||
:manage_volumes => true,
|
:manage_volumes => true
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it {
|
it {
|
||||||
@@ -234,22 +253,23 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'when configuring quantum' do
|
describe 'when configuring quantum' do
|
||||||
let :params do
|
before do
|
||||||
default_params.merge({
|
params.merge!(
|
||||||
:internal_address => '127.0.0.1',
|
:internal_address => '127.0.0.1',
|
||||||
:public_interface => 'eth3',
|
:public_interface => 'eth3',
|
||||||
:quantum => true,
|
:quantum => true,
|
||||||
:keystone_host => '127.0.0.1',
|
:keystone_host => '127.0.0.1',
|
||||||
:quantum_host => '127.0.0.1',
|
:quantum_host => '127.0.0.1',
|
||||||
:quantum_user_password => 'quantum_user_password',
|
:quantum_user_password => 'quantum_user_password'
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should configure quantum' do
|
it 'should configure quantum' do
|
||||||
should contain_class('quantum').with(
|
should contain_class('quantum').with(
|
||||||
:verbose => 'False',
|
:verbose => 'False',
|
||||||
:debug => 'False',
|
:debug => 'False',
|
||||||
:rabbit_host => default_params[:rabbit_host],
|
:rabbit_host => params[:rabbit_host],
|
||||||
:rabbit_password => default_params[:rabbit_password]
|
:rabbit_password => params[:rabbit_password]
|
||||||
)
|
)
|
||||||
should contain_class('quantum::agents::ovs').with(
|
should contain_class('quantum::agents::ovs').with(
|
||||||
:enable_tunneling => true,
|
:enable_tunneling => true,
|
||||||
|
Reference in New Issue
Block a user