Clean up unused rspec test
These rspec class tests are automatically generated by cookiecutter, but actually they are not used in puppet-oslo.
This commit is contained in:
parent
f0c8632c52
commit
919d8fa329
|
@ -1,60 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::db::mysql' do
|
||||
|
||||
let :pre_condition do
|
||||
[
|
||||
'include mysql::server',
|
||||
'include oslo::db::sync'
|
||||
]
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
'password' => 'fooboozoo_default_password',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
it { is_expected.to contain_openstacklib__db__mysql('oslo').with(
|
||||
:user => 'oslo',
|
||||
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
|
||||
:dbname => 'oslo',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
)}
|
||||
end
|
||||
|
||||
describe "overriding allowed_hosts param to array" do
|
||||
before { params.merge!( :allowed_hosts => ['127.0.0.1','%'] ) }
|
||||
|
||||
it { is_expected.to contain_openstacklib__db__mysql('oslo').with(
|
||||
:user => 'oslo',
|
||||
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
|
||||
:dbname => 'oslo',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
:allowed_hosts => ['127.0.0.1','%']
|
||||
)}
|
||||
end
|
||||
describe "overriding allowed_hosts param to string" do
|
||||
before { params.merge!( :allowed_hosts => '192.168.1.1' ) }
|
||||
|
||||
it { is_expected.to contain_openstacklib__db__mysql('oslo').with(
|
||||
:user => 'oslo',
|
||||
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
|
||||
:dbname => 'oslo',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
:allowed_hosts => '192.168.1.1'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
|
@ -1,58 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::db::postgresql' do
|
||||
|
||||
let :req_params do
|
||||
{ :password => 'pw' }
|
||||
end
|
||||
|
||||
let :pre_condition 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
|
||||
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_postgresql__server__db('oslo').with(
|
||||
:user => 'oslo',
|
||||
:password => 'md5c530c33636c58ae83ca933f39319273e'
|
||||
)}
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
it { is_expected.to contain_postgresql__server__db('oslo').with(
|
||||
:user => 'oslo',
|
||||
:password => 'md5c530c33636c58ae83ca933f39319273e'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,120 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::db' do
|
||||
|
||||
shared_examples 'oslo::db' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_oslo_config('database/connection').with_value('sqlite:////var/lib/oslo/oslo.sqlite') }
|
||||
it { is_expected.to contain_oslo_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo_config('database/max_overflow').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://oslo:oslo@localhost/oslo',
|
||||
:database_idle_timeout => '3601',
|
||||
:database_min_pool_size => '2',
|
||||
:database_max_retries => '11',
|
||||
:database_retry_interval => '11',
|
||||
:database_max_pool_size => '11',
|
||||
:database_max_overflow => '21',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_oslo_config('database/connection').with_value('mysql+pymysql://oslo:oslo@localhost/oslo') }
|
||||
it { is_expected.to contain_oslo_config('database/idle_timeout').with_value('3601') }
|
||||
it { is_expected.to contain_oslo_config('database/min_pool_size').with_value('2') }
|
||||
it { is_expected.to contain_oslo_config('database/max_retries').with_value('11') }
|
||||
it { is_expected.to contain_oslo_config('database/retry_interval').with_value('11') }
|
||||
it { is_expected.to contain_oslo_config('database/max_pool_size').with_value('11') }
|
||||
it { is_expected.to contain_oslo_config('database/max_overflow').with_value('21') }
|
||||
end
|
||||
|
||||
context 'with postgresql backend' do
|
||||
let :params do
|
||||
{ :database_connection => 'postgresql://oslo:oslo@localhost/oslo', }
|
||||
end
|
||||
|
||||
it 'install the proper backend package' do
|
||||
is_expected.to contain_package('python-psycopg2').with(:ensure => 'present')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with MySQL-python library as backend package' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql://oslo:oslo@localhost/oslo', }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('python-mysqldb').with(:ensure => 'present') }
|
||||
end
|
||||
|
||||
context 'with incorrect database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foodb://oslo:oslo@localhost/oslo', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
end
|
||||
|
||||
context 'with incorrect pymysql database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foo+pymysql://oslo:oslo@localhost/oslo', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => 'jessie',
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'oslo::db'
|
||||
|
||||
context 'using pymysql driver' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://oslo:oslo@localhost/oslo', }
|
||||
end
|
||||
|
||||
it 'install the proper backend package' do
|
||||
is_expected.to contain_package('oslo-backend-package').with(
|
||||
:ensure => 'present',
|
||||
:name => 'python-pymysql',
|
||||
:tag => 'openstack'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Redhat platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystemrelease => '7.1',
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'oslo::db'
|
||||
|
||||
context 'using pymysql driver' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://oslo:oslo@localhost/oslo', }
|
||||
end
|
||||
|
||||
it 'install the proper backend package' do
|
||||
is_expected.not_to contain_package('oslo-backend-package')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'oslo' do
|
||||
|
||||
shared_examples 'oslo' do
|
||||
|
||||
context 'with default parameters' do
|
||||
it 'contains the logging class' do
|
||||
is_expected.to contain_class('oslo::params')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,120 +0,0 @@
|
|||
#
|
||||
# Unit tests for oslo::keystone::auth
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::keystone::auth' do
|
||||
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
describe 'with default class parameters' do
|
||||
let :params do
|
||||
{ :password => 'oslo_password',
|
||||
:tenant => 'foobar' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('oslo').with(
|
||||
:ensure => 'present',
|
||||
:password => 'oslo_password',
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('oslo@foobar').with(
|
||||
:ensure => 'present',
|
||||
:roles => ['admin']
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_service('oslo::FIXME').with(
|
||||
:ensure => 'present',
|
||||
:description => 'oslo FIXME Service'
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/oslo::FIXME').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://127.0.0.1:FIXME',
|
||||
:admin_url => 'http://127.0.0.1:FIXME',
|
||||
:internal_url => 'http://127.0.0.1:FIXME',
|
||||
) }
|
||||
end
|
||||
|
||||
describe 'when overriding URL parameters' do
|
||||
let :params do
|
||||
{ :password => 'oslo_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
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/oslo::FIXME').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
|
||||
|
||||
describe 'when overriding auth name' do
|
||||
let :params do
|
||||
{ :password => 'foo',
|
||||
:auth_name => 'osloy' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('osloy') }
|
||||
it { is_expected.to contain_keystone_user_role('osloy@services') }
|
||||
it { is_expected.to contain_keystone_service('osloy::FIXME') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/osloy::FIXME') }
|
||||
end
|
||||
|
||||
describe 'when overriding service name' do
|
||||
let :params do
|
||||
{ :service_name => 'oslo_service',
|
||||
:auth_name => 'oslo',
|
||||
:password => 'oslo_password' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('oslo') }
|
||||
it { is_expected.to contain_keystone_user_role('oslo@services') }
|
||||
it { is_expected.to contain_keystone_service('oslo_service::FIXME') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/oslo_service::FIXME') }
|
||||
end
|
||||
|
||||
describe 'when disabling user configuration' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'oslo_password',
|
||||
:configure_user => false
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.not_to contain_keystone_user('oslo') }
|
||||
it { is_expected.to contain_keystone_user_role('oslo@services') }
|
||||
it { is_expected.to contain_keystone_service('oslo::FIXME').with(
|
||||
:ensure => 'present',
|
||||
:description => 'oslo FIXME Service'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
describe 'when disabling user and user role configuration' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'oslo_password',
|
||||
:configure_user => false,
|
||||
:configure_user_role => false
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.not_to contain_keystone_user('oslo') }
|
||||
it { is_expected.not_to contain_keystone_user_role('oslo@services') }
|
||||
it { is_expected.to contain_keystone_service('oslo::FIXME').with(
|
||||
:ensure => 'present',
|
||||
:description => 'oslo FIXME Service'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,144 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::logging' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
}
|
||||
end
|
||||
|
||||
let :log_params do
|
||||
{
|
||||
:logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
|
||||
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
|
||||
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
|
||||
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
|
||||
:log_config_append => '/etc/oslo/logging.conf',
|
||||
:publish_errors => true,
|
||||
:default_log_levels => {
|
||||
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
||||
'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
|
||||
'iso8601' => 'WARN',
|
||||
'requests.packages.urllib3.connectionpool' => 'WARN' },
|
||||
:fatal_deprecations => true,
|
||||
:instance_format => '[instance: %(uuid)s] ',
|
||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
||||
:log_date_format => '%Y-%m-%d %H:%M:%S',
|
||||
:use_syslog => true,
|
||||
:use_stderr => false,
|
||||
:log_facility => 'LOG_FOO',
|
||||
:log_dir => '/var/log',
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'oslo-logging' do
|
||||
|
||||
context 'with basic logging options and default settings' do
|
||||
it_configures 'basic default logging settings'
|
||||
end
|
||||
|
||||
context 'with basic logging options and non-default settings' do
|
||||
before { params.merge!( log_params ) }
|
||||
it_configures 'basic non-default logging settings'
|
||||
end
|
||||
|
||||
context 'with extended logging options' do
|
||||
before { params.merge!( log_params ) }
|
||||
it_configures 'logging params set'
|
||||
end
|
||||
|
||||
context 'without extended logging options' do
|
||||
it_configures 'logging params unset'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
shared_examples 'basic default logging settings' do
|
||||
it 'configures oslo logging settins with default values' do
|
||||
is_expected.to contain_oslo_config('DEFAULT/use_syslog').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo_config('DEFAULT/use_stderr').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo_config('DEFAULT/syslog_log_facility').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo_config('DEFAULT/log_dir').with(:value => '/var/log/oslo')
|
||||
is_expected.to contain_oslo_config('DEFAULT/verbose').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'basic non-default logging settings' do
|
||||
it 'configures oslo logging settins with non-default values' do
|
||||
is_expected.to contain_oslo_config('DEFAULT/use_syslog').with(:value => 'true')
|
||||
is_expected.to contain_oslo_config('DEFAULT/use_stderr').with(:value => 'false')
|
||||
is_expected.to contain_oslo_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO')
|
||||
is_expected.to contain_oslo_config('DEFAULT/log_dir').with(:value => '/var/log')
|
||||
is_expected.to contain_oslo_config('DEFAULT/verbose').with(:value => 'true')
|
||||
is_expected.to contain_oslo_config('DEFAULT/debug').with(:value => 'true')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'logging params set' do
|
||||
it 'enables logging params' do
|
||||
is_expected.to contain_oslo_config('DEFAULT/logging_context_format_string').with_value(
|
||||
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/logging_default_format_string').with_value(
|
||||
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/logging_debug_format_suffix').with_value(
|
||||
'%(funcName)s %(pathname)s:%(lineno)d')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/logging_exception_prefix').with_value(
|
||||
'%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/log_config_append').with_value(
|
||||
'/etc/oslo/logging.conf')
|
||||
is_expected.to contain_oslo_config('DEFAULT/publish_errors').with_value(
|
||||
true)
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/default_log_levels').with_value(
|
||||
'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/fatal_deprecations').with_value(
|
||||
true)
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/instance_format').with_value(
|
||||
'[instance: %(uuid)s] ')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/instance_uuid_format').with_value(
|
||||
'[instance: %(uuid)s] ')
|
||||
|
||||
is_expected.to contain_oslo_config('DEFAULT/log_date_format').with_value(
|
||||
'%Y-%m-%d %H:%M:%S')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
shared_examples_for 'logging params unset' do
|
||||
[ :logging_context_format_string, :logging_default_format_string,
|
||||
:logging_debug_format_suffix, :logging_exception_prefix,
|
||||
:log_config_append, :publish_errors,
|
||||
:default_log_levels, :fatal_deprecations,
|
||||
:instance_format, :instance_uuid_format,
|
||||
:log_date_format, ].each { |param|
|
||||
it { is_expected.to contain_oslo_config("DEFAULT/#{param}").with_value('<SERVICE DEFAULT>') }
|
||||
}
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'Debian' })
|
||||
end
|
||||
|
||||
it_configures 'oslo-logging'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'RedHait' })
|
||||
end
|
||||
|
||||
it_configures 'oslo-logging'
|
||||
end
|
||||
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::policy' do
|
||||
|
||||
shared_examples_for 'oslo policies' do
|
||||
let :params do
|
||||
{
|
||||
:policy_path => '/etc/oslo/policy.json',
|
||||
:policies => {
|
||||
'context_is_admin' => {
|
||||
'key' => 'context_is_admin',
|
||||
'value' => 'foo:bar'
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it 'set up the policies' do
|
||||
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
|
||||
:key => 'context_is_admin',
|
||||
:value => 'foo:bar'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'oslo policies'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it_configures 'oslo policies'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue