diff --git a/spec/classes/trove_guestagent_spec.rb b/spec/classes/trove_guestagent_spec.rb index 38a08033..61f021cd 100644 --- a/spec/classes/trove_guestagent_spec.rb +++ b/spec/classes/trove_guestagent_spec.rb @@ -7,8 +7,7 @@ describe 'trove::guestagent' do context 'with default parameters' do let :pre_condition do - "class { 'trove': } - class { 'trove::guestagent::service_credentials': + "class { 'trove::guestagent::service_credentials': password => 'verysectrete', }" end @@ -34,20 +33,49 @@ describe 'trove::guestagent' do end it 'configures trove-guestagent with default parameters' do - is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('trove') - is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('') - is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_response_timeout').with_value('') - is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('trove') - is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/transport_url').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/driver').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/topics').with_value('') - is_expected.to contain_oslo__messaging__rabbit('trove_guestagent_config').with( - :rabbit_use_ssl => '', + is_expected.to contain_oslo__messaging__default('trove_guestagent_config').with( + :transport_url => '', + :control_exchange => 'trove', + :rpc_response_timeout => '', ) - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('') + + is_expected.to contain_oslo__messaging__notifications('trove_guestagent_config').with( + :transport_url => '', + :driver => '', + :topics => '' + ) + + is_expected.to contain_oslo__messaging__rabbit('trove_guestagent_config').with( + :rabbit_use_ssl => '', + :rabbit_ha_queues => '', + :heartbeat_in_pthread => '', + :kombu_reconnect_delay => '', + :kombu_failover_strategy => '', + :amqp_durable_queues => '', + :kombu_ssl_ca_certs => '', + :kombu_ssl_certfile => '', + :kombu_ssl_keyfile => '', + :kombu_ssl_version => '', + ) + + is_expected.to contain_oslo__messaging__amqp('trove_guestagent_config').with( + :server_request_prefix => '', + :broadcast_prefix => '', + :group_request_prefix => '', + :container_name => '', + :idle_timeout => '', + :trace => '', + :ssl_ca_file => '', + :ssl_cert_file => '', + :ssl_key_file => '', + :ssl_key_password => '', + :sasl_mechanisms => '', + :sasl_config_dir => '', + :sasl_config_name => '', + :username => '', + :password => '', + ) + is_expected.to contain_trove_guestagent_config('DEFAULT/swift_url').with_value('') is_expected.to contain_trove_guestagent_config('DEFAULT/swift_service_type').with_value('') is_expected.to contain_trove_guestagent_config('DEFAULT/root_grant').with_value('') @@ -66,19 +94,7 @@ describe 'trove::guestagent' do ) end - context 'when using a single RabbitMQ server' do - let :pre_condition do - "class { 'trove': } - class { 'trove::guestagent::service_credentials': - password => 'verysectrete', - }" - end - it 'configures trove-guestagent with RabbitMQ' do - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - end - end - - context 'when using a single RabbitMQ server with enable ha options' do + context 'with custom rabbitmq parameters' do let :pre_condition do "class { 'trove': rabbit_ha_queues => 'true', @@ -90,27 +106,15 @@ describe 'trove::guestagent' do }" end it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('true') - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') + is_expected.to contain_oslo__messaging__rabbit('trove_guestagent_config').with( + :rabbit_ha_queues => true, + :heartbeat_in_pthread => true, + :amqp_durable_queues => true, + ) end end - context 'when using multiple RabbitMQ servers' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => true, - } - class { 'trove::guestagent::service_credentials': - password => 'verysectrete', - }" - end - it 'configures trove-guestagent with RabbitMQ' do - is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - end - end - - context 'when using default transport url' do + context 'with custom messaging default parameters' do let :pre_condition do "class { 'trove': default_transport_url => 'rabbit://user:pass@host:1234/virt', @@ -121,13 +125,15 @@ describe 'trove::guestagent' do password => 'verysectrete', }" end - it 'configures trove-guestagent with DEFAULT/transport_url' do - is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') - is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_response_timeout').with_value('120') - is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('openstack') + + it 'configures trove-guestagent with messaging default parameters' do + is_expected.to contain_oslo__messaging__default('trove_guestagent_config').with( + :transport_url => 'rabbit://user:pass@host:1234/virt', + :control_exchange => 'openstack', + :rpc_response_timeout => '120', + ) end end - end context 'with custom parameters' do @@ -140,7 +146,7 @@ describe 'trove::guestagent' do let :params do { - :swift_url => "http://10.0.0.1:8080/v1/AUTH_", + :swift_url => 'http://10.0.0.1:8080/v1/AUTH_', :swift_service_type => 'object-store', :rabbit_use_ssl => 'true' } @@ -224,8 +230,6 @@ describe 'trove::guestagent' do let :pre_condition do "class { 'trove': default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', - rpc_response_timeout => '60', - control_exchange => 'exchange', notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' } class { 'trove::guestagent::service_credentials': @@ -234,40 +238,14 @@ describe 'trove::guestagent' do end it do - is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_response_timeout').with_value('60') - is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('exchange') - is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') + is_expected.to contain_oslo__messaging__default('trove_guestagent_config').with( + :transport_url => 'rabbit://rabbit_user:password@localhost:5673', + ) + is_expected.to contain_oslo__messaging__notifications('trove_guestagent_config').with( + :transport_url => 'rabbit://rabbit_user:password@localhost:5673', + ) end end - - context 'with amqp messaging' do - let :pre_condition do - "class { 'trove' : } - class { 'trove::guestagent::service_credentials': - password => 'verysectrete', - }" - end - - it do - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/server_request_prefix').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/broadcast_prefix').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/group_request_prefix').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/container_name').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/idle_timeout').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/trace').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/ssl_ca_file').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/ssl_cert_file').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/ssl_key_file').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/ssl_key_password').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/sasl_mechanisms').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/sasl_config_dir').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/sasl_config_name').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/username').with_value('') - is_expected.to contain_trove_guestagent_config('oslo_messaging_amqp/password').with_value('') - end - end - end on_supported_os({