Merge "Update tests to leverage rspec-puppet-facts"

This commit is contained in:
Jenkins 2016-01-14 19:53:50 +00:00 committed by Gerrit Code Review
commit af979699b8
12 changed files with 205 additions and 302 deletions

View File

@ -119,89 +119,44 @@ describe 'aodh::api' do
it_raises 'a Puppet::Error', /Invalid service_name/
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '8.0',
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
:processorcount => 2,
})
end
let :platform_params do
{ :api_package_name => 'aodh-api',
:api_service_name => 'aodh-api' }
end
it_configures 'aodh-api'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.1',
:fqdn => 'some.host.tld',
:concat_basedir => '/var/lib/puppet/concat',
:processorcount => 2,
})
end
let :platform_params do
{ :api_package_name => 'openstack-aodh-api',
:api_service_name => 'openstack-aodh-api' }
end
it_configures 'aodh-api'
end
describe 'with custom auth_uri' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
before do
params.merge!({
:keystone_auth_uri => 'https://foo.bar:1234/',
})
end
it 'should configure custom auth_uri correctly' do
is_expected.to contain_aodh_config('keystone_authtoken/auth_uri').with_value( 'https://foo.bar:1234/' )
context "with custom keystone identity_uri and auth_uri" do
before do
params.merge!({
:keystone_identity_uri => 'https://foo.bar:35357/',
:keystone_auth_uri => 'https://foo.bar:5000/v2.0/',
})
end
it 'configures identity_uri and auth_uri but deprecates old auth settings' do
is_expected.to contain_aodh_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
is_expected.to contain_aodh_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
end
end
end
describe "with custom keystone identity_uri" do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
before do
params.merge!({
:keystone_identity_uri => 'https://foo.bar:1234/',
})
end
it 'configures identity_uri' do
is_expected.to contain_aodh_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
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',
:processorcount => 2,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
describe "with custom keystone identity_uri and auth_uri" do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
before do
params.merge!({
:keystone_identity_uri => 'https://foo.bar:35357/',
:keystone_auth_uri => 'https://foo.bar:5000/v2.0/',
})
end
it 'configures identity_uri and auth_uri but deprecates old auth settings' do
is_expected.to contain_aodh_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
is_expected.to contain_aodh_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :api_package_name => 'aodh-api',
:api_service_name => 'aodh-api' }
when 'RedHat'
{ :api_package_name => 'openstack-aodh-api',
:api_service_name => 'openstack-aodh-api' }
end
end
it_configures 'aodh-api'
end
end

View File

@ -36,20 +36,16 @@ describe 'aodh::auth' do
end
context 'on Debian platforms' do
let :facts do
{ :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())
end
it_configures 'aodh-auth'
end
it_configures 'aodh-auth'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'aodh-auth'
end
end

View File

@ -15,19 +15,16 @@ describe 'aodh::client' do
end
end
context 'on Debian platforms' do
let :facts do
{ :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())
end
it_configures 'aodh client'
it_configures 'aodh client'
end
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'aodh client'
end
end

View File

@ -10,15 +10,7 @@ describe 'aodh::db::postgresql' do
'include postgresql::server'
end
context 'on a RedHat osfamily' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
}
end
shared_examples 'aodh::db::postgresql' do
context 'with only required parameters' do
let :params do
req_params
@ -32,27 +24,19 @@ describe 'aodh::db::postgresql' do
end
context 'on a Debian osfamily' do
let :facts do
{
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
}
end
context 'with only required parameters' do
let :params do
req_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({
:concat_basedir => '/var/lib/puppet/concat'
}))
end
it { is_expected.to contain_postgresql__server__db('aodh').with(
:user => 'aodh',
:password => 'md534e5dd092d680f3d8c11c62951fb5c19'
)}
it_configures 'aodh::db::postgresql'
end
end
end

View File

@ -87,16 +87,7 @@ describe 'aodh::db' do
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie',
}
end
it_configures 'aodh::db'
shared_examples_for 'aodh::db on Debian' do
context 'with sqlite backend' do
let :params do
{ :database_connection => 'sqlite:///var/lib/aodh/aodh.sqlite', }
@ -109,7 +100,6 @@ describe 'aodh::db' do
:tag => 'openstack'
)
end
end
context 'using pymysql driver' do
@ -127,15 +117,7 @@ describe 'aodh::db' do
end
end
context 'on Redhat platforms' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemrelease => '7.1',
}
end
it_configures 'aodh::db'
shared_examples_for 'aodh::db on RedHat' do
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://aodh:aodh@localhost/aodh', }
@ -144,5 +126,23 @@ describe 'aodh::db' do
it { is_expected.not_to contain_package('aodh-backend-package') }
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())
end
case facts[:osfamily]
when 'Debian'
it_configures 'aodh::db on Debian'
when 'RedHat'
it_configures 'aodh::db on RedHat'
end
it_configures 'aodh::db'
end
end
end

View File

@ -85,29 +85,31 @@ describe 'aodh::evaluator' 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',
:processorcount => 2,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
let :platform_params do
{ :evaluator_package_name => 'aodh-evaluator',
:evaluator_service_name => 'aodh-evaluator' }
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :evaluator_package_name => 'aodh-evaluator',
:evaluator_service_name => 'aodh-evaluator' }
when 'RedHat'
{ :evaluator_package_name => 'openstack-aodh-evaluator',
:evaluator_service_name => 'openstack-aodh-evaluator' }
end
end
it_configures 'aodh-evaluator'
end
it_configures 'aodh-evaluator'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :evaluator_package_name => 'openstack-aodh-evaluator',
:evaluator_service_name => 'openstack-aodh-evaluator' }
end
it_configures 'aodh-evaluator'
end
end

View File

@ -212,31 +212,25 @@ describe 'aodh' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => '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())
end
let :platform_params do
{ :aodh_common_package => 'aodh-common' }
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :aodh_common_package => 'aodh-common' }
when 'RedHat'
{ :aodh_common_package => 'openstack-aodh-common' }
end
end
it_behaves_like 'aodh'
end
it_behaves_like 'aodh'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :aodh_common_package => 'openstack-aodh-common' }
end
it_behaves_like 'aodh'
end
end

View File

@ -71,29 +71,27 @@ describe 'aodh::listener' 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())
end
let :platform_params do
{ :listener_package_name => 'aodh-listener',
:listener_service_name => 'aodh-listener' }
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :listener_package_name => 'aodh-listener',
:listener_service_name => 'aodh-listener' }
when 'RedHat'
{ :listener_package_name => 'openstack-aodh-listener',
:listener_service_name => 'openstack-aodh-listener' }
end
end
it_configures 'aodh-listener'
end
it_configures 'aodh-listener'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :listener_package_name => 'openstack-aodh-listener',
:listener_service_name => 'openstack-aodh-listener' }
end
it_configures 'aodh-listener'
end
end

View File

@ -125,20 +125,16 @@ describe 'aodh::logging' 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())
end
it_configures 'aodh-logging'
end
it_configures 'aodh-logging'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'aodh-logging'
end
end

View File

@ -71,29 +71,26 @@ describe 'aodh::notifier' 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())
end
let :platform_params do
{ :notifier_package_name => 'aodh-notifier',
:notifier_service_name => 'aodh-notifier' }
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :notifier_package_name => 'aodh-notifier',
:notifier_service_name => 'aodh-notifier' }
when 'RedHat'
{ :notifier_package_name => 'openstack-aodh-notifier',
:notifier_service_name => 'openstack-aodh-notifier' }
end
end
it_configures 'aodh-notifier'
end
it_configures 'aodh-notifier'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :notifier_package_name => 'openstack-aodh-notifier',
:notifier_service_name => 'openstack-aodh-notifier' }
end
it_configures 'aodh-notifier'
end
end

View File

@ -23,19 +23,16 @@ describe 'aodh::policy' do
end
end
context 'on Debian platforms' do
let :facts do
{ :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())
end
it_configures 'aodh policies'
it_configures 'aodh policies'
end
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'aodh policies'
end
end

View File

@ -2,14 +2,6 @@ require 'spec_helper'
describe 'aodh::wsgi::apache' do
let :global_facts do
{
:processorcount => 42,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld'
}
end
shared_examples_for 'apache serving aodh with mod_wsgi' do
it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
it { is_expected.to contain_class('aodh::params') }
@ -81,44 +73,39 @@ describe 'aodh::wsgi::apache' do
end
end
context 'on RedHat platforms' do
let :facts do
global_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0'
})
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({
:processorcount => 42,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld'
}))
end
let :platform_parameters do
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/aodh',
:wsgi_script_source => '/usr/lib/python2.7/site-packages/aodh/api/app.wsgi'
}
end
let(:platform_parameters) do
case facts[:osfamily]
when 'Debian'
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/aodh',
:wsgi_script_source => '/usr/share/aodh-common/app.wsgi'
}
when 'RedHat'
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/aodh',
:wsgi_script_source => '/usr/lib/python2.7/site-packages/aodh/api/app.wsgi'
}
it_configures 'apache serving aodh with mod_wsgi'
end
end
it_configures 'apache serving aodh with mod_wsgi'
end
end
context 'on Debian platforms' do
let :facts do
global_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '7.0'
})
end
let :platform_parameters do
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/aodh',
:wsgi_script_source => '/usr/share/aodh-common/app.wsgi'
}
end
it_configures 'apache serving aodh with mod_wsgi'
end
end