2012-03-30 01:09:50 -07:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'nova::api' do
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
'include nova'
|
|
|
|
end
|
|
|
|
|
2012-10-14 14:26:25 -07:00
|
|
|
let :params do
|
2014-01-30 16:30:43 -05:00
|
|
|
{ :admin_password => 'passw0rd' }
|
2012-10-14 14:26:25 -07:00
|
|
|
end
|
|
|
|
|
2014-01-30 16:30:43 -05:00
|
|
|
let :facts do
|
2015-11-23 20:37:52 +00:00
|
|
|
@default_facts.merge({ :processorcount => 5 })
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'nova-api' do
|
|
|
|
|
|
|
|
context 'with default parameters' do
|
|
|
|
|
|
|
|
it 'installs nova-api package and service' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_service('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_service],
|
2015-05-20 11:02:10 -07:00
|
|
|
:ensure => 'running',
|
2014-01-30 16:30:43 -05:00
|
|
|
:hasstatus => true,
|
2015-07-22 22:47:49 +02:00
|
|
|
:enable => true,
|
|
|
|
:tag => 'nova-service',
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_package('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_package],
|
|
|
|
:ensure => 'present',
|
2015-07-22 22:47:49 +02:00
|
|
|
:tag => ['openstack', 'nova-package'],
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2015-11-16 02:55:39 +00:00
|
|
|
is_expected.to contain_package('nova-api').that_requires('Anchor[nova::install::begin]')
|
|
|
|
is_expected.to contain_package('nova-api').that_notifies('Anchor[nova::install::end]')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to_not contain_exec('validate_nova_api')
|
2012-05-08 13:32:36 -05:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
it 'configures keystone_authtoken middleware' do
|
2015-12-31 14:51:22 +08:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
|
2015-12-31 14:51:22 +08:00
|
|
|
is_expected.to contain_nova_config(
|
|
|
|
'keystone_authtoken/identity_uri').with_value('http://127.0.0.1:35357/')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/admin_tenant_name').with_value('services')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/admin_user').with_value('nova')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/admin_password').with_value('passw0rd').with_secret(true)
|
2012-04-23 19:14:58 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
2015-08-14 15:42:16 -04:00
|
|
|
it 'enable metadata in evenlet configuration' do
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/enabled_apis').with_value('osapi_compute,metadata')
|
|
|
|
end
|
|
|
|
|
2015-10-14 16:36:35 -04:00
|
|
|
it { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')}
|
|
|
|
|
2014-01-30 16:30:43 -05:00
|
|
|
it 'configures various stuff' do
|
2016-04-20 16:26:51 -04:00
|
|
|
is_expected.to contain_nova_config('wsgi/api_paste_config').with('value' => 'api-paste.ini')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8774')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen').with('value' => '0.0.0.0')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen_port').with('value' => '8775')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '0.0.0.0')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '5')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_workers').with('value' => '5')
|
2015-09-15 22:41:14 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/default_floating_pool').with('value' => 'nova')
|
2015-11-04 12:07:10 +02:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/fping_path').with('value' => '/usr/sbin/fping')
|
2016-05-18 17:40:30 +03:00
|
|
|
is_expected.to contain_nova_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => '<SERVICE DEFAULT>')
|
2013-05-03 12:46:59 +02:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
2014-05-08 00:56:15 +02:00
|
|
|
it 'do not configure v3 api' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('osapi_v3/enabled').with('value' => false)
|
2014-05-08 00:56:15 +02:00
|
|
|
end
|
|
|
|
|
2014-01-30 16:30:43 -05:00
|
|
|
it 'unconfigures neutron_metadata proxy' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with(:value => false)
|
|
|
|
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with(:ensure => 'absent')
|
2013-04-26 06:17:03 -04:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with overridden parameters' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
2015-05-20 11:02:10 -07:00
|
|
|
:enabled => false,
|
2014-04-02 16:08:24 +02:00
|
|
|
:ensure_package => '2012.1-2',
|
|
|
|
:auth_uri => 'https://10.0.0.1:9999/',
|
2015-12-31 14:51:22 +08:00
|
|
|
:identity_uri => 'https://10.0.0.1:8888/',
|
2014-04-02 16:08:24 +02:00
|
|
|
:admin_tenant_name => 'service2',
|
|
|
|
:admin_user => 'nova2',
|
|
|
|
:admin_password => 'passw0rd2',
|
|
|
|
:api_bind_address => '192.168.56.210',
|
|
|
|
:metadata_listen => '127.0.0.1',
|
2015-09-30 11:06:40 -04:00
|
|
|
:metadata_listen_port => 8875,
|
|
|
|
:osapi_compute_listen_port => 8874,
|
2014-04-02 16:08:24 +02:00
|
|
|
:volume_api_class => 'nova.volume.cinder.API',
|
|
|
|
:use_forwarded_for => false,
|
|
|
|
:ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)',
|
2013-08-06 10:58:50 -05:00
|
|
|
:neutron_metadata_proxy_shared_secret => 'secrete',
|
2014-04-02 16:08:24 +02:00
|
|
|
:osapi_compute_workers => 1,
|
|
|
|
:metadata_workers => 2,
|
2015-09-15 22:41:14 -04:00
|
|
|
:default_floating_pool => 'public',
|
2014-05-08 00:56:15 +02:00
|
|
|
:osapi_v3 => true,
|
2016-05-18 17:40:30 +03:00
|
|
|
:pci_alias => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\",\"name\":\"graphic_card\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"name\":\"network_card\"}]",
|
|
|
|
:enable_proxy_headers_parsing => true
|
2014-01-30 16:30:43 -05:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'installs nova-api package and service' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_package('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_package],
|
2014-11-13 11:55:04 -05:00
|
|
|
:ensure => '2012.1-2',
|
2015-07-22 22:47:49 +02:00
|
|
|
:tag => ['openstack', 'nova-package'],
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_service('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_service],
|
2015-05-20 11:02:10 -07:00
|
|
|
:ensure => 'stopped',
|
2014-01-30 16:30:43 -05:00
|
|
|
:hasstatus => true,
|
2015-07-22 22:47:49 +02:00
|
|
|
:enable => false,
|
|
|
|
:tag => 'nova-service',
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2012-04-23 19:14:58 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
it 'configures keystone_authtoken middleware' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2015-12-31 14:51:22 +08:00
|
|
|
'keystone_authtoken/identity_uri').with_value('https://10.0.0.1:8888/')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/admin_tenant_name').with_value('service2')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/admin_user').with_value('nova2')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config(
|
2013-10-10 10:26:37 +02:00
|
|
|
'keystone_authtoken/admin_password').with_value('passw0rd2').with_secret(true)
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_paste_api_ini(
|
2013-09-08 17:46:42 +00:00
|
|
|
'filter:ratelimit/limits').with_value('(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)')
|
2012-04-23 19:14:58 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
it 'configures various stuff' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '192.168.56.210')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8874')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen').with('value' => '127.0.0.1')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen_port').with('value' => '8875')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '192.168.56.210')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/use_forwarded_for').with('value' => false)
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '1')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_workers').with('value' => '2')
|
2015-09-15 22:41:14 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/default_floating_pool').with('value' => 'public')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with('value' => true)
|
|
|
|
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with('value' => 'secrete')
|
2016-05-18 17:40:30 +03:00
|
|
|
is_expected.to contain_nova_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => true)
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
2014-05-08 00:56:15 +02:00
|
|
|
|
|
|
|
it 'configure nova api v3' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('osapi_v3/enabled').with('value' => true)
|
2014-05-08 00:56:15 +02:00
|
|
|
end
|
2015-02-06 23:22:09 +11:00
|
|
|
|
|
|
|
it 'configures nova pci_alias entries' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/pci_alias').with(
|
2015-02-06 23:22:09 +11:00
|
|
|
'value' => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\",\"name\":\"graphic_card\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"name\":\"network_card\"}]"
|
|
|
|
)
|
|
|
|
end
|
2012-04-23 19:14:58 -07:00
|
|
|
end
|
2013-05-14 18:44:01 +02:00
|
|
|
|
2014-10-06 23:22:59 -04:00
|
|
|
context 'while validating the service with default command' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:validate => true,
|
|
|
|
})
|
|
|
|
end
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_exec('execute nova-api validation').with(
|
2014-10-06 23:22:59 -04:00
|
|
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
:provider => 'shell',
|
|
|
|
:tries => '10',
|
|
|
|
:try_sleep => '2',
|
|
|
|
:command => 'nova --os-auth-url http://127.0.0.1:5000/ --os-tenant-name services --os-username nova --os-password passw0rd flavor-list',
|
|
|
|
)}
|
|
|
|
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_anchor('create nova-api anchor').with(
|
2014-10-06 23:22:59 -04:00
|
|
|
:require => 'Exec[execute nova-api validation]',
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'while validating the service with custom command' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:validate => true,
|
|
|
|
:validation_options => { 'nova-api' => { 'command' => 'my-script' } }
|
|
|
|
})
|
|
|
|
end
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_exec('execute nova-api validation').with(
|
2014-10-06 23:22:59 -04:00
|
|
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
:provider => 'shell',
|
|
|
|
:tries => '10',
|
|
|
|
:try_sleep => '2',
|
|
|
|
:command => 'my-script',
|
|
|
|
)}
|
|
|
|
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_anchor('create nova-api anchor').with(
|
2014-10-06 23:22:59 -04:00
|
|
|
:require => 'Exec[execute nova-api validation]',
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2014-01-13 22:58:10 -06:00
|
|
|
context 'while not managing service state' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:enabled => false,
|
|
|
|
:manage_service => false,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_service('nova-api').without_ensure }
|
2014-01-13 22:58:10 -06:00
|
|
|
end
|
2014-11-19 23:11:34 -05:00
|
|
|
|
|
|
|
context 'with default database parameters' do
|
|
|
|
let :pre_condition do
|
|
|
|
"include nova"
|
|
|
|
end
|
|
|
|
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to_not contain_nova_config('database/connection') }
|
|
|
|
it { is_expected.to_not contain_nova_config('database/slave_connection') }
|
2016-01-29 17:39:33 -05:00
|
|
|
it { is_expected.to_not contain_nova_config('api_database/connection') }
|
|
|
|
it { is_expected.to_not contain_nova_config('api_database/slave_connection') }
|
2015-11-23 20:37:52 +00:00
|
|
|
it { is_expected.to_not contain_nova_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
2014-11-19 23:11:34 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with overridden database parameters' do
|
|
|
|
let :pre_condition do
|
|
|
|
"class { 'nova':
|
2016-01-29 17:39:33 -05:00
|
|
|
database_connection => 'mysql://user:pass@db/db1',
|
|
|
|
slave_connection => 'mysql://user:pass@slave/db1',
|
|
|
|
api_database_connection => 'mysql://user:pass@db/db2',
|
|
|
|
api_slave_connection => 'mysql://user:pass@slave/db2',
|
|
|
|
database_idle_timeout => '30',
|
2014-11-19 23:11:34 -05:00
|
|
|
}
|
|
|
|
"
|
|
|
|
end
|
|
|
|
|
2016-01-29 17:39:33 -05:00
|
|
|
it { is_expected.to contain_nova_config('database/connection').with_value('mysql://user:pass@db/db1').with_secret(true) }
|
|
|
|
it { is_expected.to contain_nova_config('database/slave_connection').with_value('mysql://user:pass@slave/db1').with_secret(true) }
|
|
|
|
it { is_expected.to contain_nova_config('api_database/connection').with_value('mysql://user:pass@db/db2').with_secret(true) }
|
|
|
|
it { is_expected.to contain_nova_config('api_database/slave_connection').with_value('mysql://user:pass@slave/db2').with_secret(true) }
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_nova_config('database/idle_timeout').with_value('30') }
|
2014-11-19 23:11:34 -05:00
|
|
|
end
|
|
|
|
|
2015-10-14 16:36:35 -04:00
|
|
|
context 'with custom instance_name_template' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:instance_name_template => 'instance-%08x',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures instance_name_template' do
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_value('instance-%08x');
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-01-27 21:24:14 -05:00
|
|
|
context 'with custom keystone identity_uri' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:identity_uri => 'https://foo.bar:1234/',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures identity_uri' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
|
2015-01-27 21:24:14 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-12-31 14:51:22 +08:00
|
|
|
context 'with custom keystone identity_uri and auth_uri ' do
|
2015-01-27 21:24:14 -05:00
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:identity_uri => 'https://foo.bar:35357/',
|
|
|
|
:auth_uri => 'https://foo.bar:5000/v2.0/',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures identity_uri' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
|
|
|
|
is_expected.to contain_nova_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
|
2015-01-27 21:24:14 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-14 15:42:16 -04:00
|
|
|
context 'when running nova API in wsgi compute, and enabling metadata' do
|
|
|
|
before do
|
|
|
|
params.merge!({ :service_name => 'httpd' })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
|
|
|
include ::nova"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'enable nova API service' do
|
|
|
|
is_expected.to contain_service('nova-api').with(
|
|
|
|
:ensure => 'running',
|
|
|
|
:name => platform_params[:nova_api_service],
|
|
|
|
:enable => true,
|
|
|
|
:tag => 'nova-service',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
it 'enable metadata in evenlet configuration' do
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/enabled_apis').with_value('metadata')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when running nova API in wsgi for compute, and disabling metadata' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:service_name => 'httpd',
|
|
|
|
:enabled_apis => ['osapi_compute'] })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
|
|
|
include ::nova"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'disable nova API service' do
|
|
|
|
is_expected.to contain_service('nova-api').with(
|
|
|
|
:ensure => 'stopped',
|
|
|
|
:name => platform_params[:nova_api_service],
|
|
|
|
:enable => false,
|
|
|
|
:tag => 'nova-service',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when enabled_apis is not an array' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:service_name => 'httpd',
|
|
|
|
:enabled_apis => 'osapi_compute' })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
|
|
|
include ::nova"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'disable nova API service' do
|
|
|
|
is_expected.to contain_service('nova-api').with(
|
|
|
|
:ensure => 'stopped',
|
|
|
|
:name => platform_params[:nova_api_service],
|
|
|
|
:enable => false,
|
|
|
|
:tag => 'nova-service',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when service_name is not valid' do
|
|
|
|
before do
|
|
|
|
params.merge!({ :service_name => 'foobar' })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
|
|
|
include ::nova"
|
|
|
|
end
|
|
|
|
|
|
|
|
it_raises 'a Puppet::Error', /Invalid service_name/
|
|
|
|
end
|
|
|
|
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
context 'on Debian platforms' do
|
|
|
|
before do
|
2015-08-14 15:42:16 -04:00
|
|
|
facts.merge!(
|
|
|
|
:osfamily => 'Debian',
|
|
|
|
:operatingsystem => 'Debian',
|
|
|
|
:operatingsystemrelease => '8.0',
|
|
|
|
:operatingsystemmajrelease => '8',
|
|
|
|
:concat_basedir => '/var/lib/puppet/concat',
|
|
|
|
:fqdn => 'some.host.tld',
|
|
|
|
)
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
let :platform_params do
|
|
|
|
{ :nova_api_package => 'nova-api',
|
|
|
|
:nova_api_service => 'nova-api' }
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
it_behaves_like 'nova-api'
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
context 'on RedHat platforms' do
|
|
|
|
before do
|
2015-08-14 15:42:16 -04:00
|
|
|
facts.merge!(
|
|
|
|
:osfamily => 'RedHat',
|
|
|
|
:operatingsystem => 'RedHat',
|
|
|
|
:operatingsystemrelease => '7.0',
|
|
|
|
:operatingsystemmajrelease => '7',
|
|
|
|
:concat_basedir => '/var/lib/puppet/concat',
|
|
|
|
:fqdn => 'some.host.tld',
|
|
|
|
)
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
let :platform_params do
|
|
|
|
{ :nova_api_package => 'openstack-nova-api',
|
|
|
|
:nova_api_service => 'openstack-nova-api' }
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'nova-api'
|
|
|
|
end
|
|
|
|
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|