Use rspec-puppet-facts

Convert the rest of the tests to leverage rspec-puppet-facts

Change-Id: Ic2c20516f73214f790ac9ed9fd4a773ee9d5f6af
This commit is contained in:
Alex Schultz 2018-11-06 17:00:40 -07:00
parent ae7183ff2f
commit 0e5843dc89
16 changed files with 753 additions and 669 deletions

View File

@ -11,136 +11,130 @@ describe 'manila::api' do
{}
end
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie'
})
end
describe 'with only required params' do
let :params do
req_params
end
shared_examples_for 'manila::api' do
context 'with only required params' do
let :params do
req_params
end
it { is_expected.to contain_service('manila-api').with(
'hasstatus' => true,
'ensure' => 'running',
'tag' => 'manila-service',
)}
it { is_expected.to contain_class('manila::policy') }
it { is_expected.to contain_service('manila-api').with(
'hasstatus' => true,
'ensure' => 'running',
'tag' => 'manila-service',
)}
it { is_expected.to contain_class('manila::policy') }
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/auth_strategy').with(:value => 'keystone')
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(:value => '0.0.0.0')
is_expected.to contain_manila_config('DEFAULT/enabled_share_protocols').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('manila_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
)
is_expected.to contain_manila_config('DEFAULT/default_share_type').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/osapi_share_workers').with(:value => '2')
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/auth_strategy').with(:value => 'keystone')
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(:value => '0.0.0.0')
is_expected.to contain_manila_config('DEFAULT/enabled_share_protocols').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('manila_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
)
is_expected.to contain_manila_config('DEFAULT/default_share_type').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/osapi_share_workers').with(:value => '2')
end
it 'should run db sync' do
is_expected.to contain_class('manila::db::sync')
end
end
it 'should run db sync' do
is_expected.to contain_class('manila::db::sync')
end
end
describe 'with a default share type' do
let :params do
req_params.merge({'default_share_type' => 'default'})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure the default share type' do
is_expected.to contain_manila_config('DEFAULT/default_share_type').with(
:value => 'default'
)
end
end
describe 'with service workers' do
let :params do
req_params.merge({'service_workers' => '4'})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure the share workers' do
is_expected.to contain_manila_config('DEFAULT/osapi_share_workers').with(
:value => '4'
)
end
end
describe 'with only required params' do
let :params do
req_params.merge({'bind_host' => '192.168.1.3'})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(
:value => '192.168.1.3'
)
end
end
describe 'with only required params' do
let :params do
req_params.merge({'enable_proxy_headers_parsing' => true})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure manila api correctly' do
is_expected.to contain_oslo__middleware('manila_config').with(
:enable_proxy_headers_parsing => true,
)
end
end
describe 'with enabled false' do
let :params do
req_params.merge({'enabled' => false})
end
it { is_expected.to contain_class('manila::policy') }
it 'should stop the service' do
is_expected.to contain_service('manila-api').with_ensure('stopped')
end
it 'includes manila::db::sync' do
is_expected.to contain_class('manila::db::sync')
end
end
describe 'with sync_db false' do
let :params do
req_params.merge({'sync_db' => false})
end
it { is_expected.to contain_class('manila::policy') }
it 'should not include manila::db::sync' do
is_expected.to_not contain_class('manila::db::sync')
end
end
describe 'with manage_service false' do
let :params do
req_params.merge({'manage_service' => false})
end
it { is_expected.to contain_class('manila::policy') }
it 'should not change the state of the service' do
is_expected.to contain_service('manila-api').without_ensure
end
end
describe 'with ratelimits' do
let :params do
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
context 'with a default share type' do
let :params do
req_params.merge({'default_share_type' => 'default'})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure the default share type' do
is_expected.to contain_manila_config('DEFAULT/default_share_type').with(
:value => 'default'
)
end
end
it { is_expected.to contain_class('manila::policy') }
it { is_expected.to contain_manila_api_paste_ini('filter:ratelimit/limits').with(
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
)}
end
context 'with service workers' do
let :params do
req_params.merge({'service_workers' => '4'})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure the share workers' do
is_expected.to contain_manila_config('DEFAULT/osapi_share_workers').with(
:value => '4'
)
end
end
describe 'when running manila-api in wsgi' do
context 'with only required params' do
let :params do
req_params.merge({'bind_host' => '192.168.1.3'})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(
:value => '192.168.1.3'
)
end
end
context 'with only required params' do
let :params do
req_params.merge({'enable_proxy_headers_parsing' => true})
end
it { is_expected.to contain_class('manila::policy') }
it 'should configure manila api correctly' do
is_expected.to contain_oslo__middleware('manila_config').with(
:enable_proxy_headers_parsing => true,
)
end
end
context 'with enabled false' do
let :params do
req_params.merge({'enabled' => false})
end
it { is_expected.to contain_class('manila::policy') }
it 'should stop the service' do
is_expected.to contain_service('manila-api').with_ensure('stopped')
end
it 'includes manila::db::sync' do
is_expected.to contain_class('manila::db::sync')
end
end
context 'with sync_db false' do
let :params do
req_params.merge({'sync_db' => false})
end
it { is_expected.to contain_class('manila::policy') }
it 'should not include manila::db::sync' do
is_expected.to_not contain_class('manila::db::sync')
end
end
context 'with manage_service false' do
let :params do
req_params.merge({'manage_service' => false})
end
it { is_expected.to contain_class('manila::policy') }
it 'should not change the state of the service' do
is_expected.to contain_service('manila-api').without_ensure
end
end
context 'with ratelimits' do
let :params do
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
end
it { is_expected.to contain_class('manila::policy') }
it { is_expected.to contain_manila_api_paste_ini('filter:ratelimit/limits').with(
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
)}
end
context 'when running manila-api in wsgi' do
let :params do
req_params.merge!({ :service_name => 'httpd' })
end
@ -162,7 +156,7 @@ describe 'manila::api' do
end
end
describe 'when service_name is not valid' do
context 'when service_name is not valid' do
let :params do
req_params.merge!({ :service_name => 'foobar' })
end
@ -178,4 +172,17 @@ describe 'manila::api' do
it_raises 'a Puppet::Error', /Invalid service_name/
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::api'
end
end
end

View File

@ -50,20 +50,14 @@ describe 'manila::backends' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila backends'
end
it_configures 'manila backends'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'manila backends'
end
end

View File

@ -7,52 +7,61 @@ describe 'manila::db::mysql' do
}
end
let :facts do
@default_facts.merge({:osfamily => 'Debian'})
end
let :pre_condition do
'include mysql::server'
end
describe 'with only required params' do
let :params do
req_params
end
it { is_expected.to contain_openstacklib__db__mysql('manila').with(
:user => 'manila',
:password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
) }
end
describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'manilapass',
:allowed_hosts => ['127.0.0.1','%']
}
shared_examples_for 'manila::db::mysql' do
context 'with only required params' do
let :params do
req_params
end
it { is_expected.to contain_openstacklib__db__mysql('manila').with(
:user => 'manila',
:password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
) }
end
context "overriding allowed_hosts param to array" do
let :params do
{
:password => 'manilapass',
:allowed_hosts => ['127.0.0.1','%']
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'manilapass2',
:allowed_hosts => '192.168.1.1'
}
end
context "overriding allowed_hosts param to string" do
let :params do
{
:password => 'manilapass2',
:allowed_hosts => '192.168.1.1'
}
end
end
context "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'manilapass2',
:allowed_hosts => '127.0.0.1'
}
end
end
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'manilapass2',
:allowed_hosts => '127.0.0.1'
}
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::db::mysql'
end
end
end

View File

@ -86,16 +86,7 @@ describe 'manila::db' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie',
})
end
it_configures 'manila::db'
shared_examples_for 'manila::db on Debian' do
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://manila:manila@localhost/manila' }
@ -105,15 +96,7 @@ describe 'manila::db' do
end
end
context 'on Redhat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat',
:operatingsystemrelease => '7.1',
})
end
it_configures 'manila::db'
shared_examples_for 'manila::db on RedHat' do
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://manila:manila@localhost/manila' }
@ -122,4 +105,16 @@ describe 'manila::db' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::db'
it_behaves_like "manila::db on #{facts[:osfamily]}"
end
end
end

View File

@ -19,17 +19,26 @@ describe 'manila::ganesha' do
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value(value)
end
end
end
shared_examples_for 'manila::ganesha on RedHat' do
it { is_expected.to contain_package('nfs-ganesha').with(
:name => 'nfs-ganesha',
:ensure => 'present',
:name => 'nfs-ganesha',
:ensure => 'present',
) }
end
context 'on Red Hat platforms' do
let :facts do
@default_facts.merge({:osfamily => 'RedHat'})
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_configures 'manila NFS Ganesha options for share drivers'
if facts[:osfamily] == 'RedHat'
it_configures 'manila::ganesha on RedHat'
end
end
end
end

View File

@ -7,251 +7,259 @@ describe 'manila' do
}
end
let :facts do
@default_facts.merge({:osfamily => 'Debian'})
end
shared_examples_for 'manila' do
context 'with only required params' do
let :params do
req_params
end
describe 'with only required params' do
let :params do
req_params
it { is_expected.to contain_class('manila::logging') }
it { is_expected.to contain_class('manila::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('manila_config').with({
:purge => false
})
end
it 'should contain default config' do
is_expected.to contain_manila_config('DEFAULT/transport_url').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('DEFAULT/rpc_response_timeout').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/topics').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/driver').with(
:value => 'messaging'
)
is_expected.to contain_manila_config('DEFAULT/control_exchange').with(
:value => 'openstack'
)
is_expected.to contain_manila_config('oslo_messaging_rabbit/amqp_durable_queues').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_rabbit/rabbit_ha_queues').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_rabbit/kombu_failover_strategy').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('DEFAULT/debug').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('DEFAULT/storage_availability_zone').with(
:value => 'nova'
)
is_expected.to contain_manila_config('DEFAULT/api_paste_config').with(
:value => '/etc/manila/api-paste.ini'
)
is_expected.to contain_manila_config('DEFAULT/rootwrap_config').with(
:value => '/etc/manila/rootwrap.conf'
)
is_expected.to contain_manila_config('DEFAULT/state_path').with(
:value => '/var/lib/manila'
)
is_expected.to contain_manila_config('DEFAULT/host').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_concurrency/lock_path').with(
:value => '/tmp/manila/manila_locks'
)
is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
)
is_expected.to contain_oslo__log('manila_config').with(:log_dir => '/var/log/manila')
end
end
it { is_expected.to contain_class('manila::logging') }
it { is_expected.to contain_class('manila::params') }
context 'with enable ha queues' do
let :params do
req_params.merge({'rabbit_ha_queues' => true})
end
it 'passes purge to resource' do
is_expected.to contain_resources('manila_config').with({
:purge => false
})
it 'should contain rabbit_ha_queues' do
is_expected.to contain_manila_config('oslo_messaging_rabbit/rabbit_ha_queues').with(
:value => true
)
end
end
it 'should contain default config' do
is_expected.to contain_manila_config('DEFAULT/transport_url').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('DEFAULT/rpc_response_timeout').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/topics').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/driver').with(
:value => 'messaging'
)
is_expected.to contain_manila_config('DEFAULT/control_exchange').with(
:value => 'openstack'
)
is_expected.to contain_manila_config('oslo_messaging_rabbit/amqp_durable_queues').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_rabbit/rabbit_ha_queues').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_rabbit/kombu_failover_strategy').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('DEFAULT/debug').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('DEFAULT/storage_availability_zone').with(
:value => 'nova'
)
is_expected.to contain_manila_config('DEFAULT/api_paste_config').with(
:value => '/etc/manila/api-paste.ini'
)
is_expected.to contain_manila_config('DEFAULT/rootwrap_config').with(
:value => '/etc/manila/rootwrap.conf'
)
is_expected.to contain_manila_config('DEFAULT/state_path').with(
:value => '/var/lib/manila'
)
is_expected.to contain_manila_config('DEFAULT/host').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_concurrency/lock_path').with(
:value => '/tmp/manila/manila_locks'
)
is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
)
is_expected.to contain_oslo__log('manila_config').with(:log_dir => '/var/log/manila')
end
end
context 'with SSL enabled' do
let :params do
req_params.merge!({
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
:kombu_ssl_version => 'TLSv1'
})
end
describe 'with enable ha queues' do
let :params do
req_params.merge({'rabbit_ha_queues' => true})
end
it 'should contain rabbit_ha_queues' do
is_expected.to contain_manila_config('oslo_messaging_rabbit/rabbit_ha_queues').with(
:value => true
)
end
end
describe 'with SSL enabled' do
let :params do
req_params.merge!({
it { is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
:kombu_ssl_version => 'TLSv1'
})
)}
end
it { is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
:kombu_ssl_version => 'TLSv1'
)}
end
context 'with SSL enabled without kombu' do
let :params do
req_params.merge!({
:rabbit_use_ssl => true,
})
end
describe 'with SSL enabled without kombu' do
let :params do
req_params.merge!({
it { is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => true,
})
)}
end
it { is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => true,
)}
end
context 'with SSL disabled' do
let :params do
req_params.merge!({
:rabbit_use_ssl => false,
})
end
describe 'with SSL disabled' do
let :params do
req_params.merge!({
it { is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => false,
})
)}
end
it { is_expected.to contain_oslo__messaging__rabbit('manila_config').with(
:rabbit_use_ssl => false,
)}
end
context 'with amqp_durable_queues disabled' do
let :params do
req_params.merge({
:amqp_durable_queues => false,
})
end
describe 'with amqp_durable_queues disabled' do
let :params do
req_params.merge({
:amqp_durable_queues => false,
})
it { is_expected.to contain_manila_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(false) }
end
it { is_expected.to contain_manila_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(false) }
end
context 'with amqp_durable_queues enabled' do
let :params do
req_params.merge({
:amqp_durable_queues => true,
})
end
describe 'with amqp_durable_queues enabled' do
let :params do
req_params.merge({
:amqp_durable_queues => true,
})
it { is_expected.to contain_manila_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) }
end
it { is_expected.to contain_manila_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) }
end
context 'with sqlite' do
let :params do
{
:sql_connection => 'sqlite:////var/lib/manila/manila.sqlite',
}
end
describe 'with sqlite' do
let :params do
{
:sql_connection => 'sqlite:////var/lib/manila/manila.sqlite',
}
it { is_expected.to_not contain_class('mysql::python') }
it { is_expected.to_not contain_class('mysql::bindings') }
it { is_expected.to_not contain_class('mysql::bindings::python') }
end
it { is_expected.to_not contain_class('mysql::python') }
it { is_expected.to_not contain_class('mysql::bindings') }
it { is_expected.to_not contain_class('mysql::bindings::python') }
end
context 'with SSL socket options set' do
let :params do
{
:use_ssl => true,
:cert_file => '/path/to/cert',
:ca_file => '/path/to/ca',
:key_file => '/path/to/key',
}
end
describe 'with SSL socket options set' do
let :params do
{
:use_ssl => true,
:cert_file => '/path/to/cert',
:ca_file => '/path/to/ca',
:key_file => '/path/to/key',
}
it { is_expected.to contain_manila_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_key_file').with_value('/path/to/key') }
end
it { is_expected.to contain_manila_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_key_file').with_value('/path/to/key') }
end
context 'with SSL socket options set to false' do
let :params do
{
:use_ssl => false,
:cert_file => false,
:ca_file => false,
:key_file => false,
}
end
describe 'with SSL socket options set to false' do
let :params do
{
:use_ssl => false,
:cert_file => false,
:ca_file => false,
:key_file => false,
}
it { is_expected.to contain_manila_config('DEFAULT/ssl_ca_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_cert_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_key_file').with_ensure('absent') }
end
it { is_expected.to contain_manila_config('DEFAULT/ssl_ca_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_cert_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_key_file').with_ensure('absent') }
end
context 'with SSL socket options set wrongly configured' do
let :params do
{
:use_ssl => true,
:ca_file => '/path/to/ca',
:key_file => '/path/to/key',
}
end
describe 'with SSL socket options set wrongly configured' do
let :params do
{
:use_ssl => true,
:ca_file => '/path/to/ca',
:key_file => '/path/to/key',
}
it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
end
it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
end
context 'with transport_url entries' do
describe 'with transport_url entries' do
let :params do
{
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:rpc_response_timeout => '120',
:control_exchange => 'manila',
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
}
end
let :params do
{
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:rpc_response_timeout => '120',
:control_exchange => 'manila',
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
}
it { is_expected.to contain_manila_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
it { is_expected.to contain_manila_config('DEFAULT/rpc_response_timeout').with_value('120') }
it { is_expected.to contain_manila_config('DEFAULT/control_exchange').with_value('manila') }
it { is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
end
it { is_expected.to contain_manila_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
it { is_expected.to contain_manila_config('DEFAULT/rpc_response_timeout').with_value('120') }
it { is_expected.to contain_manila_config('DEFAULT/control_exchange').with_value('manila') }
it { is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
end
context 'with amqp rpc supplied' do
describe 'with amqp rpc supplied' do
let :params do
{
:sql_connection => 'mysql+pymysql://user:password@host/database',
}
end
let :params do
{
:sql_connection => 'mysql+pymysql://user:password@host/database',
}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/server_request_prefix').with_value('exclusive') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/broadcast_prefix').with_value('broadcast') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/group_request_prefix').with_value('unicast') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/container_name').with_value('guest') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/idle_timeout').with_value('0') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/trace').with_value(false) }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/allow_insecure_clients').with_value(false) }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_key_password').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_ca_file').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_cert_file').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_key_file').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/username').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/password').with_value('<SERVICE DEFAULT>')}
end
it { is_expected.to contain_manila_config('oslo_messaging_amqp/server_request_prefix').with_value('exclusive') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/broadcast_prefix').with_value('broadcast') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/group_request_prefix').with_value('unicast') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/container_name').with_value('guest') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/idle_timeout').with_value('0') }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/trace').with_value(false) }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/allow_insecure_clients').with_value(false) }
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_key_password').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_ca_file').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_cert_file').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/ssl_key_file').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/username').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_manila_config('oslo_messaging_amqp/password').with_value('<SERVICE DEFAULT>')}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila'
end
end
end

View File

@ -7,107 +7,120 @@ describe 'manila::keystone::auth' do
:password_v2 => 'pw2'}
end
describe 'with only required params' do
shared_examples_for 'manila::keystone::auth' do
context 'with only required params' do
it 'should contain auth info' do
it 'should contain auth info' do
is_expected.to contain_keystone_user('manila').with(
:ensure => 'present',
:password => 'pw',
:email => 'manila@localhost',
)
is_expected.to contain_keystone_user_role('manila@services').with(
:ensure => 'present',
:roles => ['admin']
)
is_expected.to contain_keystone_service('manila::share').with(
:ensure => 'present',
:description => 'Manila Service'
)
is_expected.to contain_keystone_user('manila').with(
:ensure => 'present',
:password => 'pw',
:email => 'manila@localhost',
)
is_expected.to contain_keystone_user_role('manila@services').with(
:ensure => 'present',
:roles => ['admin']
)
is_expected.to contain_keystone_service('manila::share').with(
:ensure => 'present',
:description => 'Manila Service'
)
is_expected.to contain_keystone_user('manilav2').with(
:ensure => 'present',
:password => 'pw2',
:email => 'manilav2@localhost',
)
is_expected.to contain_keystone_user_role('manilav2@services').with(
:ensure => 'present',
:roles => ['admin']
)
is_expected.to contain_keystone_service('manilav2::sharev2').with(
:ensure => 'present',
:description => 'Manila Service v2'
)
is_expected.to contain_keystone_user('manilav2').with(
:ensure => 'present',
:password => 'pw2',
:email => 'manilav2@localhost',
)
is_expected.to contain_keystone_user_role('manilav2@services').with(
:ensure => 'present',
:roles => ['admin']
)
is_expected.to contain_keystone_service('manilav2::sharev2').with(
:ensure => 'present',
:description => 'Manila Service v2'
)
end
it { is_expected.to contain_keystone_endpoint('RegionOne/manila::share').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
:internal_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/manilav2::sharev2').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s',
:internal_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s'
) }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/manila::share').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
:internal_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/manilav2::sharev2').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s',
:internal_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s'
) }
end
context 'when overriding endpoint parameters' do
before do
params.merge!(
:region => 'RegionThree',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s',
:public_url_v2 => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
:admin_url_v2 => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
:internal_url_v2 => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
)
end
context 'when overriding endpoint parameters' do
before do
params.merge!(
:region => 'RegionThree',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s',
:public_url_v2 => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
:admin_url_v2 => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
:internal_url_v2 => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
)
it { is_expected.to contain_keystone_endpoint('RegionThree/manila::share').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)}
it { is_expected.to contain_keystone_endpoint('RegionThree/manilav2::sharev2').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
)}
end
it { is_expected.to contain_keystone_endpoint('RegionThree/manila::share').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)}
it { is_expected.to contain_keystone_endpoint('RegionThree/manilav2::sharev2').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
)}
end
describe 'when endpoint should not be configured' do
before do
params.merge!(
:configure_endpoint => false,
:configure_endpoint_v2 => false
)
end
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila::share') }
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manilav2::sharev2') }
end
describe 'when overriding service names' do
before do
params.merge!(
:service_name => 'manila_service',
:service_name_v2 => 'manila_service_v2',
)
context 'when endpoint should not be configured' do
before do
params.merge!(
:configure_endpoint => false,
:configure_endpoint_v2 => false
)
end
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila::share') }
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manilav2::sharev2') }
end
it { is_expected.to contain_keystone_user('manila') }
it { is_expected.to contain_keystone_user_role('manila@services') }
it { is_expected.to contain_keystone_service('manila_service::share') }
it { is_expected.to contain_keystone_service('manila_service_v2::sharev2') }
it { is_expected.to contain_keystone_endpoint('RegionOne/manila_service::share') }
it { is_expected.to contain_keystone_endpoint('RegionOne/manila_service_v2::sharev2') }
context 'when overriding service names' do
before do
params.merge!(
:service_name => 'manila_service',
:service_name_v2 => 'manila_service_v2',
)
end
it { is_expected.to contain_keystone_user('manila') }
it { is_expected.to contain_keystone_user_role('manila@services') }
it { is_expected.to contain_keystone_service('manila_service::share') }
it { is_expected.to contain_keystone_service('manila_service_v2::sharev2') }
it { is_expected.to contain_keystone_endpoint('RegionOne/manila_service::share') }
it { is_expected.to contain_keystone_endpoint('RegionOne/manila_service_v2::sharev2') }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::keystone::auth'
end
end
end

View File

@ -25,10 +25,6 @@ describe 'manila::network::neutron' do
}
end
let :facts do
OSDefaults.get_facts({})
end
shared_examples_for 'neutron network plugin' do
let :params_hash do
default_params.merge(params)
@ -46,15 +42,25 @@ describe 'manila::network::neutron' do
end
context 'with default parameters' do
before do
params = {}
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
context 'with default parameters' do
before do
params = {}
end
it_configures 'neutron network plugin'
end
context 'with provided parameters' do
it_configures 'neutron network plugin'
end
end
it_configures 'neutron network plugin'
end
context 'with provided parameters' do
it_configures 'neutron network plugin'
end
end

View File

@ -2,11 +2,17 @@ require 'spec_helper'
describe 'manila::params' do
let :facts do
@default_facts.merge({:osfamily => 'Debian'})
end
it 'should compile' do
subject
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it 'should compile' do
subject
end
end
end
end

View File

@ -2,59 +2,73 @@ require 'spec_helper'
describe 'manila::quota' do
describe 'with default parameters' do
it 'contains default values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
is_expected.to contain_manila_config('DEFAULT/quota_snapshot_gigabytes').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 86400)
is_expected.to contain_manila_config('DEFAULT/until_refresh').with(
:value => 0)
is_expected.to contain_manila_config('DEFAULT/max_age').with(
:value => 0)
shared_examples_for 'manila::quota' do
context 'with default parameters' do
it 'contains default values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
is_expected.to contain_manila_config('DEFAULT/quota_snapshot_gigabytes').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 86400)
is_expected.to contain_manila_config('DEFAULT/until_refresh').with(
:value => 0)
is_expected.to contain_manila_config('DEFAULT/max_age').with(
:value => 0)
end
end
context 'with overridden parameters' do
let :params do
{ :quota_shares => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000,
:quota_snapshot_gigabytes => 10000,
:quota_share_networks => 100,
:reservation_expire => 864000,
:until_refresh => 10,
:max_age => 10,}
end
it 'contains overrided values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 100000)
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
is_expected.to contain_manila_config('DEFAULT/quota_snapshot_gigabytes').with(
:value => 10000)
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 100)
is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 864000)
is_expected.to contain_manila_config('DEFAULT/until_refresh').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/max_age').with(
:value => 10)
end
end
end
describe 'with overridden parameters' do
let :params do
{ :quota_shares => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000,
:quota_snapshot_gigabytes => 10000,
:quota_share_networks => 100,
:reservation_expire => 864000,
:until_refresh => 10,
:max_age => 10,}
end
it 'contains overrided values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 1000)
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 100000)
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
is_expected.to contain_manila_config('DEFAULT/quota_snapshot_gigabytes').with(
:value => 10000)
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 100)
is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 864000)
is_expected.to contain_manila_config('DEFAULT/until_refresh').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/max_age').with(
:value => 10)
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::quota'
end
end
end

View File

@ -2,68 +2,74 @@ require 'spec_helper'
describe 'manila::rabbitmq' do
let :facts do
@default_facts.merge({ :puppetversion => '2.7',
:osfamily => 'Debian',
})
end
shared_examples_for 'manila::rabbitmq' do
context 'with defaults' do
describe 'with defaults' do
it 'should contain all of the default resources' do
it 'should contain all of the default resources' do
is_expected.to contain_rabbitmq_vhost('/').with(
:provider => 'rabbitmqctl'
)
end
end
describe 'when a rabbitmq user is specified' do
let :params do
{
:userid => 'dan',
:password => 'pass'
}
end
it 'should contain user and permissions' do
is_expected.to contain_rabbitmq_user('dan').with(
:admin => true,
:password => 'pass',
:provider => 'rabbitmqctl'
)
is_expected.to contain_rabbitmq_user_permissions('dan@/').with(
:configure_permission => '.*',
:write_permission => '.*',
:read_permission => '.*',
:provider => 'rabbitmqctl'
)
is_expected.to contain_rabbitmq_vhost('/').with(
:provider => 'rabbitmqctl'
)
end
end
end
context 'when a rabbitmq user is specified' do
let :params do
{
:userid => 'dan',
:password => 'pass'
}
end
it 'should contain user and permissions' do
is_expected.to contain_rabbitmq_user('dan').with(
:admin => true,
:password => 'pass',
:provider => 'rabbitmqctl'
)
is_expected.to contain_rabbitmq_user_permissions('dan@/').with(
:configure_permission => '.*',
:write_permission => '.*',
:read_permission => '.*',
:provider => 'rabbitmqctl'
)
end
describe 'when disabled' do
let :params do
{
:userid => 'dan',
:password => 'pass',
:enabled => false
}
end
it 'should be disabled' do
context 'when disabled' do
let :params do
{
:userid => 'dan',
:password => 'pass',
:enabled => false
}
end
is_expected.to_not contain_rabbitmq_user('dan')
is_expected.to_not contain_rabbitmq_user_permissions('dan@/')
is_expected.to_not contain_rabbitmq_vhost('/')
it 'should be disabled' do
is_expected.to_not contain_rabbitmq_user('dan')
is_expected.to_not contain_rabbitmq_user_permissions('dan@/')
is_expected.to_not contain_rabbitmq_vhost('/')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::rabbitmq'
end
end
end

View File

@ -2,13 +2,9 @@ require 'spec_helper'
describe 'manila::scheduler' do
describe 'on debian platforms' do
shared_examples_for 'manila::scheduler on Debian' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
describe 'with default parameters' do
context 'with default parameters' do
it { is_expected.to contain_class('manila::params') }
@ -27,7 +23,7 @@ describe 'manila::scheduler' do
) }
end
describe 'with parameters' do
context 'with parameters' do
let :params do
{ :scheduler_driver => 'manila.scheduler.filter_scheduler.FilterScheduler',
@ -39,7 +35,7 @@ describe 'manila::scheduler' do
it { is_expected.to contain_package('manila-scheduler').with_ensure('present') }
end
describe 'with manage_service false' do
context 'with manage_service false' do
let :params do
{ 'manage_service' => false
}
@ -51,13 +47,9 @@ describe 'manila::scheduler' do
end
describe 'on rhel platforms' do
shared_examples_for 'manila::scheduler on RedHat' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
describe 'with default parameters' do
context 'with default parameters' do
it { is_expected.to contain_class('manila::params') }
@ -69,7 +61,7 @@ describe 'manila::scheduler' do
) }
end
describe 'with parameters' do
context 'with parameters' do
let :params do
{ :scheduler_driver => 'manila.scheduler.filter_scheduler.FilterScheduler' }
@ -78,4 +70,16 @@ describe 'manila::scheduler' do
it { is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('manila.scheduler.filter_scheduler.FilterScheduler') }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like "manila::scheduler on #{facts[:osfamily]}"
end
end
end

View File

@ -20,16 +20,30 @@ describe 'manila::share::generic' do
}
end
describe 'generic share driver' do
it 'configures generic share driver' do
is_expected.to contain_manila_config('DEFAULT/share_driver').with_value(
'manila.share.drivers.generic.GenericShareDriver')
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value(
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
'NFS=manila.share.drivers.helpers.NFSHelper')
params.each_pair do |config,value|
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
shared_examples_for 'manila::share::generic' do
context 'generic share driver' do
it 'configures generic share driver' do
is_expected.to contain_manila_config('DEFAULT/share_driver').with_value(
'manila.share.drivers.generic.GenericShareDriver')
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value(
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
'NFS=manila.share.drivers.helpers.NFSHelper')
params.each_pair do |config,value|
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
end
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'manila::share::generic'
end
end
end

View File

@ -21,20 +21,14 @@ describe 'manila::share::glusterfs' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
it_behaves_like 'glusterfs share driver'
end
it_configures 'glusterfs share driver'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'glusterfs share driver'
end
end

View File

@ -48,16 +48,25 @@ describe 'manila::share::netapp' do
end
context 'with default parameters' do
before do
params = {}
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
context 'with default parameters' do
before do
params = {}
end
it_configures 'netapp share driver'
end
context 'with provided parameters' do
it_configures 'netapp share driver'
end
end
it_configures 'netapp share driver'
end
context 'with provided parameters' do
it_configures 'netapp share driver'
end
end

View File

@ -27,28 +27,24 @@ describe 'manila::share' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld'}))
end
let :platform_params do
{ :package_name => 'manila-share' }
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :package_name => 'manila-share' }
when 'RedHat'
{ :package_name => 'openstack-manila-share' }
end
end
it_configures 'manila-share'
it_behaves_like 'manila-share'
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :package_name => 'openstack-manila-share' }
end
it_configures 'manila-share'
end
end