Switch gnocchi to rspec-puppet-facts

This change updates the gnocchi tests to use rspec-puppet-facts to test
multiple operating systems.

Change-Id: I56545ff69c2db76be5db5ee6dca36ec9cbc6e801
changes/28/298528/2
Alex Schultz 7 years ago
parent f997b6e6a7
commit 2c8c0dcc19
  1. 3
      releasenotes/notes/rspec-puppet-facts-ee600fc22f33e93f.yaml
  2. 127
      spec/classes/gnocchi_api_spec.rb
  3. 21
      spec/classes/gnocchi_client_spec.rb
  4. 31
      spec/classes/gnocchi_config_spec.rb
  5. 128
      spec/classes/gnocchi_db_mysql_spec.rb
  6. 47
      spec/classes/gnocchi_db_postgresql_spec.rb
  7. 32
      spec/classes/gnocchi_db_sync_spec.rb
  8. 39
      spec/classes/gnocchi_init_spec.rb
  9. 185
      spec/classes/gnocchi_keystone_auth_spec.rb
  10. 23
      spec/classes/gnocchi_logging_spec.rb
  11. 46
      spec/classes/gnocchi_metricd_spec.rb
  12. 21
      spec/classes/gnocchi_policy_spec.rb
  13. 46
      spec/classes/gnocchi_statsd_spec.rb
  14. 21
      spec/classes/gnocchi_storage_ceph_spec.rb
  15. 28
      spec/classes/gnocchi_storage_file_spec.rb
  16. 24
      spec/classes/gnocchi_storage_influxdb_spec.rb
  17. 43
      spec/classes/gnocchi_storage_spec.rb
  18. 21
      spec/classes/gnocchi_storage_swift_spec.rb
  19. 96
      spec/classes/gnocchi_wsgi_apache_spec.rb

@ -0,0 +1,3 @@
---
other:
- Switch spec tests to leverage rspec-puppet-facts

@ -122,91 +122,68 @@ describe 'gnocchi::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 => 'gnocchi-api',
:api_service_name => 'gnocchi-api' }
context 'with custom auth_uri' do
before do
params.merge!({
:keystone_auth_uri => 'https://foo.bar:1234/',
})
end
it 'should configure custom auth_uri correctly' do
is_expected.to contain_gnocchi_config('keystone_authtoken/auth_uri').with_value( 'https://foo.bar:1234/' )
end
end
it_configures 'gnocchi-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,
})
context "with custom keystone identity_uri" do
before do
params.merge!({
:keystone_identity_uri => 'https://foo.bar:1234/',
})
end
it 'configures identity_uri' do
is_expected.to contain_gnocchi_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
is_expected.to contain_gnocchi_api_paste_ini('pipeline:main/pipeline').with_value('gnocchi+auth');
end
end
let :platform_params do
{ :api_package_name => 'openstack-gnocchi-api',
:api_service_name => 'openstack-gnocchi-api' }
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_gnocchi_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
is_expected.to contain_gnocchi_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
is_expected.to contain_gnocchi_api_paste_ini('pipeline:main/pipeline').with_value('gnocchi+auth');
end
end
it_configures 'gnocchi-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_gnocchi_config('keystone_authtoken/auth_uri').with_value( 'https://foo.bar:1234/' )
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_gnocchi_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
is_expected.to contain_gnocchi_api_paste_ini('pipeline:main/pipeline').with_value('gnocchi+auth');
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({
:concat_basedir => '/var/lib/puppet/concat',
:processorcount => 2
}))
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_gnocchi_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
is_expected.to contain_gnocchi_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
is_expected.to contain_gnocchi_api_paste_ini('pipeline:main/pipeline').with_value('gnocchi+auth');
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :api_package_name => 'gnocchi-api',
:api_service_name => 'gnocchi-api' }
when 'RedHat'
{ :api_package_name => 'openstack-gnocchi-api',
:api_service_name => 'openstack-gnocchi-api' }
end
end
it_behaves_like 'gnocchi-api'
end
end

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

@ -16,16 +16,29 @@ describe 'gnocchi::config' do
}
end
it 'configures arbitrary gnocchi configurations' do
is_expected.to contain_gnocchi_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_gnocchi_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_gnocchi_config('DEFAULT/baz').with_ensure('absent')
end
shared_examples_for 'gnocchi-config' do
it 'configures arbitrary gnocchi configurations' do
is_expected.to contain_gnocchi_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_gnocchi_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_gnocchi_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary gnocchi-api-paste configurations' do
is_expected.to contain_gnocchi_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_gnocchi_api_paste_ini('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_gnocchi_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
it 'configures arbitrary gnocchi-api-paste configurations' do
is_expected.to contain_gnocchi_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_gnocchi_api_paste_ini('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_gnocchi_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
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
it_behaves_like 'gnocchi-config'
end
end
end

@ -1,62 +1,102 @@
require 'spec_helper'
describe 'gnocchi::db::mysql' do
shared_examples_for 'gnocchi::db::mysql' do
let :pre_condition do
'include mysql::server'
end
let :pre_condition do
[
'include mysql::server',
'include gnocchi::db::sync'
]
end
describe "with default params" do
let :params do
{
:password => 'gnocchipass1',
}
end
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it { is_expected.to contain_openstacklib__db__mysql('gnocchi').with(
:password_hash => '*C13FFB03C3674F278DF1673D0DA7FB1EF58899F0',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
let :params do
{
'password' => 'fooboozoo_default_password',
}
end
end
describe 'with only required params' do
it { is_expected.to contain_openstacklib__db__mysql('gnocchi').with(
'user' => 'gnocchi',
'password_hash' => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
'dbname' => 'gnocchi',
'host' => '127.0.0.1',
'charset' => 'utf8',
:collate => 'utf8_general_ci',
)}
end
describe "overriding default params" do
let :params do
{
:password => 'gnocchipass2',
:dbname => 'gnocchidb2',
:charset => 'utf8',
}
end
it { is_expected.to contain_openstacklib__db__mysql('gnocchi').with(
:password_hash => '*CE931F98EEC20A712654BF67B17E413F3FE69089',
:dbname => 'gnocchidb2',
:charset => 'utf8'
)}
describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'gnocchipass',
:allowed_hosts => ['127.0.0.1','%']
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'gnocchipass2',
:allowed_hosts => '192.168.1.1'
}
describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'gnocchipass2',
:dbname => 'gnocchidb2',
:allowed_hosts => ['127.0.0.1','%']
}
end
it { is_expected.to contain_openstacklib__db__mysql('gnocchi').with(
:password_hash => '*CE931F98EEC20A712654BF67B17E413F3FE69089',
:dbname => 'gnocchidb2',
:allowed_hosts => ['127.0.0.1','%']
)}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'gnocchipass2',
:dbname => 'gnocchidb2',
:allowed_hosts => '192.168.1.1'
}
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'gnocchipass2',
:allowed_hosts => '127.0.0.1'
}
it { is_expected.to contain_openstacklib__db__mysql('gnocchi').with(
:password_hash => '*CE931F98EEC20A712654BF67B17E413F3FE69089',
:dbname => 'gnocchidb2',
:allowed_hosts => '192.168.1.1'
)}
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'gnocchipass2',
:dbname => 'gnocchidb2',
:allowed_hosts => '127.0.0.1'
}
end
it { is_expected.to contain_openstacklib__db__mysql('gnocchi').with(
:password_hash => '*CE931F98EEC20A712654BF67B17E413F3FE69089',
:dbname => 'gnocchidb2',
:allowed_hosts => '127.0.0.1'
)}
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
it_configures 'gnocchi::db::mysql'
end
end
end

@ -2,21 +2,13 @@ require 'spec_helper'
describe 'gnocchi::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
let :pre_condition do
'include postgresql::server'
end
shared_examples_for 'gnocchi::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
context 'on a RedHat osfamily' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat',
})
let :pre_condition do
'include postgresql::server'
end
context 'with only required parameters' do
@ -29,30 +21,17 @@ describe 'gnocchi::db::postgresql' do
:password => 'md590440288cb225f56d585b88ad270cd37'
)}
end
end
context 'on a Debian osfamily' do
let :facts do
@default_facts.merge({
: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('gnocchi').with(
:user => 'gnocchi',
:password => 'md590440288cb225f56d585b88ad270cd37'
)}
it_configures 'gnocchi::db::postgresql'
end
end
end

@ -30,27 +30,19 @@ describe 'gnocchi::db::sync' do
end
end
context 'on a RedHat osfamily' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
}
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 => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
it_configures 'gnocchi-dbsync'
end
it_configures 'gnocchi-dbsync'
end
context 'on a Debian osfamily' do
let :facts do
{
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
}
end
it_configures 'gnocchi-dbsync'
end
end

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

@ -6,115 +6,124 @@ require 'spec_helper'
describe 'gnocchi::keystone::auth' do
let :facts do
{ :osfamily => 'Debian' }
end
describe 'with default class parameters' do
let :params do
{ :password => 'gnocchi_password',
:tenant => 'foobar' }
shared_examples 'gnocchi-keystone-auth' do
context 'with default class parameters' do
let :params do
{ :password => 'gnocchi_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_user('gnocchi').with(
:ensure => 'present',
:password => 'gnocchi_password',
) }
it { is_expected.to contain_keystone_user_role('gnocchi@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('gnocchi::metric').with(
:ensure => 'present',
:description => 'OpenStack Metric Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi::metric').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8041',
:admin_url => 'http://127.0.0.1:8041',
:internal_url => 'http://127.0.0.1:8041',
) }
end
it { is_expected.to contain_keystone_user('gnocchi').with(
:ensure => 'present',
:password => 'gnocchi_password',
) }
it { is_expected.to contain_keystone_user_role('gnocchi@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('gnocchi::metric').with(
:ensure => 'present',
:description => 'OpenStack Metric Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi::metric').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8041',
:admin_url => 'http://127.0.0.1:8041',
:internal_url => 'http://127.0.0.1:8041',
) }
end
context 'when overriding URL parameters' do
let :params do
{ :password => 'gnocchi_password',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81' }
end
describe 'when overriding URL parameters' do
let :params do
{ :password => 'gnocchi_password',
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi::metric').with(
:ensure => 'present',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81' }
:admin_url => 'http://10.10.10.12:81'
) }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi::metric').with(
:ensure => 'present',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81'
) }
end
context 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'gnocchiany' }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'gnocchiany' }
it { is_expected.to contain_keystone_user('gnocchiany') }
it { is_expected.to contain_keystone_user_role('gnocchiany@services') }
it { is_expected.to contain_keystone_service('gnocchiany::metric') }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchiany::metric') }
end
it { is_expected.to contain_keystone_user('gnocchiany') }
it { is_expected.to contain_keystone_user_role('gnocchiany@services') }
it { is_expected.to contain_keystone_service('gnocchiany::metric') }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchiany::metric') }
end
describe 'when overriding service name' do
let :params do
{ :service_name => 'gnocchi_service',
:auth_name => 'gnocchi',
:password => 'gnocchi_password' }
context 'when overriding service name' do
let :params do
{ :service_name => 'gnocchi_service',
:auth_name => 'gnocchi',
:password => 'gnocchi_password' }
end
it { is_expected.to contain_keystone_user('gnocchi') }
it { is_expected.to contain_keystone_user_role('gnocchi@services') }
it { is_expected.to contain_keystone_service('gnocchi_service::metric') }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi_service::metric') }
end
it { is_expected.to contain_keystone_user('gnocchi') }
it { is_expected.to contain_keystone_user_role('gnocchi@services') }
it { is_expected.to contain_keystone_service('gnocchi_service::metric') }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi_service::metric') }
end
context 'when disabling user configuration' do
let :params do
{
:password => 'gnocchi_password',
:configure_user => false
}
end
describe 'when disabling user configuration' do
it { is_expected.not_to contain_keystone_user('gnocchi') }
it { is_expected.to contain_keystone_user_role('gnocchi@services') }
it { is_expected.to contain_keystone_service('gnocchi::metric').with(
:ensure => 'present',
:description => 'OpenStack Metric Service'
) }
let :params do
{
:password => 'gnocchi_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('gnocchi') }
it { is_expected.to contain_keystone_user_role('gnocchi@services') }
it { is_expected.to contain_keystone_service('gnocchi::metric').with(
:ensure => 'present',
:description => 'OpenStack Metric Service'
) }
context 'when disabling user and user role configuration' do
end
let :params do
{
:password => 'gnocchi_password',
:configure_user => false,
:configure_user_role => false
}
end
describe 'when disabling user and user role configuration' do
it { is_expected.not_to contain_keystone_user('gnocchi') }
it { is_expected.not_to contain_keystone_user_role('gnocchi@services') }
it { is_expected.to contain_keystone_service('gnocchi::metric').with(
:ensure => 'present',
:description => 'OpenStack Metric Service'
) }
let :params do
{
:password => 'gnocchi_password',
:configure_user => false,
:configure_user_role => false
}
end
end
it { is_expected.not_to contain_keystone_user('gnocchi') }
it { is_expected.not_to contain_keystone_user_role('gnocchi@services') }
it { is_expected.to contain_keystone_service('gnocchi::metric').with(
:ensure => 'present',
:description => 'OpenStack Metric Service'
) }
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_behaves_like 'gnocchi-keystone-auth'
end
end
end

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

@ -56,36 +56,26 @@ describe 'gnocchi::metricd' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
})
end
let :platform_params do
{ :metricd_package_name => 'gnocchi-metricd',
:metricd_service_name => 'gnocchi-metricd' }
end
it_configures 'gnocchi-metricd'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
})
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
{ :metricd_package_name => 'openstack-gnocchi-metricd',
:metricd_service_name => 'openstack-gnocchi-metricd' }
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :metricd_package_name => 'gnocchi-metricd',
:metricd_service_name => 'gnocchi-metricd' }
when 'RedHat'
{ :metricd_package_name => 'openstack-gnocchi-metricd',
:metricd_service_name => 'openstack-gnocchi-metricd' }
end
end
it_behaves_like 'gnocchi-metricd'
end
it_configures 'gnocchi-metricd'
end
end

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

@ -72,36 +72,26 @@ describe 'gnocchi::statsd' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
})
end
let :platform_params do
{ :statsd_package_name => 'gnocchi-statsd',
:statsd_service_name => 'gnocchi-statsd' }
end
it_configures 'gnocchi-statsd'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
})
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
{ :statsd_package_name => 'openstack-gnocchi-statsd',
:statsd_service_name => 'openstack-gnocchi-statsd' }
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :statsd_package_name => 'gnocchi-statsd',
:statsd_service_name => 'gnocchi-statsd' }
when 'RedHat'
{ :statsd_package_name => 'openstack-gnocchi-statsd',
:statsd_service_name => 'openstack-gnocchi-statsd' }
end
end
it_behaves_like 'gnocchi-statsd'
end
it_configures 'gnocchi-statsd'
end
end

@ -25,20 +25,15 @@ describe 'gnocchi::storage::ceph' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'gnocchi storage ceph'
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
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
it_behaves_like 'gnocchi storage ceph'
end
it_configures 'gnocchi storage ceph'
end
end

@ -19,20 +19,24 @@ describe 'gnocchi::storage::file' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'gnocchi storage file'
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
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
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 'gnocchi storage file'
end
it_configures 'gnocchi storage file'
end
end

@ -44,24 +44,16 @@ describe 'gnocchi::storage::influxdb' do
end
end
context 'on Debian platforms' do
let :facts do
{
:osfamily => 'Debian'
}
end
it_configures 'gnocchi storage influxdb'
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
context 'on RedHat platforms' do
let :facts do
{
:osfamily => 'RedHat'
}
it_behaves_like 'gnocchi storage influxdb'
end
it_configures 'gnocchi storage influxdb'
end
end

@ -19,33 +19,24 @@ describe 'gnocchi::storage' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => '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
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :carbonara_package_name => 'gnocchi-carbonara' }
when 'RedHat'
{ :carbonara_package_name => 'openstack-gnocchi-carbonara' }
end
end
it_behaves_like 'gnocchi-storage'
end
let :platform_params do
{ :carbonara_package_name => 'gnocchi-carbonara' }
end
it_configures 'gnocchi-storage'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
})
end
let :platform_params do
{ :carbonara_package_name => 'openstack-gnocchi-carbonara' }
end
it_configures 'gnocchi-storage'
end
end

@ -22,20 +22,15 @@ describe 'gnocchi::storage::swift' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'gnocchi storage swift'
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
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
it_behaves_like 'gnocchi storage swift'
end
it_configures 'gnocchi storage swift'
end
end

@ -2,23 +2,15 @@ require 'spec_helper'
describe 'gnocchi::wsgi::apache' do
let :global_facts do
@default_facts.merge({
:processorcount => 42,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
})
end
shared_examples_for 'apache serving gnocchi with mod_wsgi' do
it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
it { is_expected.to contain_service('httpd').with_name(platform_params[:httpd_service_name]) }
it { is_expected.to contain_class('gnocchi::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
describe 'with default parameters' do
it { is_expected.to contain_file("#{platform_parameters[:wsgi_script_path]}").with(
it { is_expected.to contain_file("#{platform_params[:wsgi_script_path]}").with(
'ensure' => 'directory',
'owner' => 'gnocchi',
'group' => 'gnocchi',
@ -28,28 +20,28 @@ describe 'gnocchi::wsgi::apache' do
it { is_expected.to contain_file('gnocchi_wsgi').with(
'ensure' => 'file',
'path' => "#{platform_parameters[:wsgi_script_path]}/app",
'source' => platform_parameters[:wsgi_script_source],
'path' => "#{platform_params[:wsgi_script_path]}/app",
'source' => platform_params[:wsgi_script_source],
'owner' => 'gnocchi',
'group' => 'gnocchi',
'mode' => '0644'
)}
it { is_expected.to contain_file('gnocchi_wsgi').that_requires("File[#{platform_parameters[:wsgi_script_path]}]") }
it { is_expected.to contain_file('gnocchi_wsgi').that_requires("File[#{platform_params[:wsgi_script_path]}]") }
it { is_expected.to contain_apache__vhost('gnocchi_wsgi').with(
'servername' => 'some.host.tld',
'ip' => nil,
'port' => '8041',
'docroot' => "#{platform_parameters[:wsgi_script_path]}",
'docroot' => "#{platform_params[:wsgi_script_path]}",
'docroot_owner' => 'gnocchi',
'docroot_group' => 'gnocchi',
'ssl' => 'true',
'wsgi_daemon_process' => 'gnocchi',
'wsgi_process_group' => 'gnocchi',
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'wsgi_script_aliases' => { '/' => "#{platform_params[:wsgi_script_path]}/app" },
'require' => 'File[gnocchi_wsgi]'
)}
it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
it { is_expected.to contain_file("#{platform_params[:httpd_ports_file]}") }
end
describe 'when overriding parameters using different ports' do
@ -67,58 +59,52 @@ describe 'gnocchi::wsgi::apache' do
'servername' => 'dummy.host',
'ip' => '10.42.51.1',
'port' => '12345',
'docroot' => "#{platform_parameters[:wsgi_script_path]}",
'docroot' => "#{platform_params[:wsgi_script_path]}",
'docroot_owner' => 'gnocchi',
'docroot_group' => 'gnocchi',
'ssl' => 'false',
'wsgi_daemon_process' => 'gnocchi',
'wsgi_process_group' => 'gnocchi',
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'wsgi_script_aliases' => { '/' => "#{platform_params[:wsgi_script_path]}/app" },
'require' => 'File[gnocchi_wsgi]'
)}
it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
it { is_expected.to contain_file("#{platform_params[:httpd_ports_file]}") }
end
end
context 'on RedHat platforms' do
let :facts do
global_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0'
})
end
let :platform_parameters do
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/gnocchi',
:wsgi_script_source => '/usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi'
}
end
it_configures 'apache serving gnocchi with mod_wsgi'
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
context 'on Debian platforms' do
let :facts do
global_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '7.0'
})
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/gnocchi',
:wsgi_script_source => '/usr/share/gnocchi-common/app.wsgi'
}
when 'RedHat'
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/gnocchi',
:wsgi_script_source => '/usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi'
}
end
end
let :platform_parameters do
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/gnocchi',
:wsgi_script_source => '/usr/share/gnocchi-common/app.wsgi'
}
it_behaves_like 'apache serving gnocchi with mod_wsgi'
end
it_configures 'apache serving gnocchi with mod_wsgi'
end
end

Loading…
Cancel
Save