Skip to content
Browse files

add spec tests

- for making horizon optional
- for adding rabbit_virtual_host
  • Loading branch information...
1 parent d48424b commit eb3e229484d2c1a6818142cbd7edcf71302bb949 Dan Bode committed Nov 7, 2012
Showing with 91 additions and 24 deletions.
  1. +55 −0 spec/classes/openstack_all_spec.rb
  2. +17 −14 spec/classes/openstack_compute_spec.rb
  3. +19 −10 spec/classes/openstack_controller_spec.rb
View
55 spec/classes/openstack_all_spec.rb
@@ -2,4 +2,59 @@
describe 'openstack::all' do
+ # minimum set of default parameters
+ let :default_params do
+ {
+ :public_address => '10.0.0.1',
+ :public_interface => 'eth1',
+ :private_interface => 'eth0',
+ :admin_email => 'some_user@some_fake_email_address.foo',
+ :mysql_root_password => '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
+
+ let :facts do
+ {
+ :operatingsystem => 'Ubuntu',
+ :osfamily => 'Debian',
+ :puppetversion => '2.7.x',
+ :memorysize => '2GB',
+ :processorcount => '2'
+ }
+ end
+
+ let :params do
+ default_params
+ end
+
+ context 'config for horizon' 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
+
+ describe 'when horizon is disabled' do
+ let :params do
+ default_params.merge(:horizon => false)
+ end
+ it { should_not contain_class('horizon') }
+ end
+ end
end
View
31 spec/classes/openstack_compute_spec.rb
@@ -28,13 +28,14 @@
end
it {
should contain_class('nova').with(
- :sql_connection => 'mysql://user:pass@host/dbname/',
- :rabbit_host => '127.0.0.1',
- :rabbit_userid => 'nova',
- :rabbit_password => 'rabbit_pw',
- :image_service => 'nova.image.glance.GlanceImageService',
- :glance_api_servers => false,
- :verbose => 'False'
+ :sql_connection => 'mysql://user:pass@host/dbname/',
+ :rabbit_host => '127.0.0.1',
+ :rabbit_userid => 'nova',
+ :rabbit_password => 'rabbit_pw',
+ :rabbit_virtual_host => '/',
+ :image_service => 'nova.image.glance.GlanceImageService',
+ :glance_api_servers => false,
+ :verbose => 'False'
)
should contain_class('nova::compute').with(
:enabled => true,
@@ -76,6 +77,7 @@
:rabbit_host => 'my_host',
:rabbit_password => 'my_rabbit_pw',
:rabbit_user => 'my_rabbit_user',
+ :rabbit_virtual_host => '/foo',
:glance_api_servers => ['controller:9292'],
:libvirt_type => 'qemu',
:vncproxy_host => '127.0.0.2',
@@ -88,13 +90,14 @@
end
it do
should contain_class('nova').with(
- :sql_connection => 'mysql://user:passwd@host/name',
- :rabbit_host => 'my_host',
- :rabbit_userid => 'my_rabbit_user',
- :rabbit_password => 'my_rabbit_pw',
- :image_service => 'nova.image.glance.GlanceImageService',
- :glance_api_servers => ['controller:9292'],
- :verbose => true
+ :sql_connection => 'mysql://user:passwd@host/name',
+ :rabbit_host => 'my_host',
+ :rabbit_userid => 'my_rabbit_user',
+ :rabbit_password => 'my_rabbit_pw',
+ :rabbit_virtual_host => '/foo',
+ :image_service => 'nova.image.glance.GlanceImageService',
+ :glance_api_servers => ['controller:9292'],
+ :verbose => true
)
should contain_class('nova::compute').with(
:enabled => true,
View
29 spec/classes/openstack_controller_spec.rb
@@ -330,18 +330,20 @@
it 'should contain enabled nova services' do
should contain_class('nova::rabbitmq').with(
- :userid => 'nova',
- :password => 'rabbit_pw',
- :enabled => true
+ :userid => 'nova',
+ :password => 'rabbit_pw',
+ :virtual_host => '/',
+ :enabled => true
)
should contain_class('nova').with(
- :sql_connection => 'mysql://nova:nova_pass@127.0.0.1/nova',
- :rabbit_host => '127.0.0.1',
- :rabbit_userid => 'nova',
- :rabbit_password => 'rabbit_pw',
- :image_service => 'nova.image.glance.GlanceImageService',
- :glance_api_servers => '10.0.0.1:9292',
- :verbose => 'False'
+ :sql_connection => 'mysql://nova:nova_pass@127.0.0.1/nova',
+ :rabbit_host => '127.0.0.1',
+ :rabbit_userid => 'nova',
+ :rabbit_password => 'rabbit_pw',
+ :rabbit_virtual_host => '/',
+ :image_service => 'nova.image.glance.GlanceImageService',
+ :glance_api_servers => '10.0.0.1:9292',
+ :verbose => 'False'
)
should contain_class('nova::api').with(
:enabled => true,
@@ -392,6 +394,13 @@
:horizon_app_links => false
)
end
+
+ describe 'when horizon is disabled' do
+ let :params do
+ default_params.merge(:horizon => false)
+ end
+ it { should_not contain_class('horizon') }
+ end
end
context 'cinder' do

0 comments on commit eb3e229

Please sign in to comment.
Something went wrong with that request. Please try again.