Merge "Switch zaqar to use rspec-puppet-facts"

This commit is contained in:
Jenkins 2016-02-24 04:32:16 +00:00 committed by Gerrit Code Review
commit 4d8c83ee55
14 changed files with 497 additions and 407 deletions

View File

@ -30,13 +30,13 @@ define zaqar::server_instance(
include ::zaqar include ::zaqar
include ::zaqar::params include ::zaqar::params
service { "openstack-zaqar@${name}": service { "${::zaqar::params::service_name}@${name}":
ensure => $service_ensure, ensure => $service_ensure,
enable => $enabled, enable => $enabled,
} }
Package[$::zaqar::params::package_name] ~> Service["${::zaqar::params::service_name}@${name}"] Package['zaqar-common'] ~> Service["${::zaqar::params::service_name}@${name}"]
Package[$::zaqar::params::package_name] ~> File["/etc/zaqar/${name}.conf"] Package['zaqar-common'] ~> File["/etc/zaqar/${name}.conf"]
File["/etc/zaqar/${name}.conf"] ~> Service["${::zaqar::params::service_name}@${name}"] File["/etc/zaqar/${name}.conf"] ~> Service["${::zaqar::params::service_name}@${name}"]
Zaqar_config<||> ~> Service["${::zaqar::params::service_name}@${name}"] Zaqar_config<||> ~> Service["${::zaqar::params::service_name}@${name}"]

View File

@ -2,61 +2,70 @@ require 'spec_helper'
describe 'zaqar::db::mysql' do describe 'zaqar::db::mysql' do
let :pre_condition do shared_examples_for 'zaqar::db::mysql' do
[ let :pre_condition do
'include mysql::server', [
'include zaqar::db::sync' 'include mysql::server',
] 'include zaqar::db::sync'
end ]
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('zaqar').with(
'user' => 'zaqar',
'password_hash' => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
'dbname' => 'zaqar',
'host' => '127.0.0.1',
'charset' => 'utf8',
:collate => 'utf8_general_ci',
)}
end
describe "overriding allowed_hosts param to array" do
let :params do let :params do
{ {
:password => 'zaqarpass', 'password' => 'fooboozoo_default_password',
:allowed_hosts => ['127.0.0.1','%']
} }
end end
end describe 'with only required params' do
describe "overriding allowed_hosts param to string" do it { is_expected.to contain_openstacklib__db__mysql('zaqar').with(
let :params do 'user' => 'zaqar',
{ 'password_hash' => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:password => 'zaqarpass2', 'dbname' => 'zaqar',
:allowed_hosts => '192.168.1.1' 'host' => '127.0.0.1',
} 'charset' => 'utf8',
:collate => 'utf8_general_ci',
)}
end end
end describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'zaqarpass',
:allowed_hosts => ['127.0.0.1','%']
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'zaqarpass2',
:allowed_hosts => '192.168.1.1'
}
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'zaqarpass2',
:allowed_hosts => '127.0.0.1'
}
end end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'zaqarpass2',
:allowed_hosts => '127.0.0.1'
}
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())
end
it_configures 'zaqar::db::mysql'
end
end end
end end

View File

@ -2,21 +2,13 @@ require 'spec_helper'
describe 'zaqar::db::postgresql' do describe 'zaqar::db::postgresql' do
let :req_params do shared_examples_for 'zaqar::db::postgresql' do
{ :password => 'pw' } let :req_params do
end { :password => 'pw' }
end
let :pre_condition do let :pre_condition do
'include postgresql::server' '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 end
context 'with only required parameters' do context 'with only required parameters' do
@ -32,27 +24,16 @@ describe 'zaqar::db::postgresql' do
end end
context 'on a Debian osfamily' do on_supported_os({
let :facts do :supported_os => OSDefaults.get_supported_os
{ }).each do |os,facts|
:operatingsystemrelease => '7.8', context "on #{os}" do
:operatingsystem => 'Debian', let (:facts) do
:osfamily => 'Debian', facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat' }))
:concat_basedir => '/var/lib/puppet/concat'
}
end
context 'with only required parameters' do
let :params do
req_params
end end
it { is_expected.to contain_postgresql__server__db('zaqar').with( it_configures 'zaqar::db::postgresql'
:user => 'zaqar',
:password => 'md52e9c9a1a01bb2fef7463b70dd24d4b25'
)}
end end
end end
end end

View File

@ -1,61 +1,82 @@
require 'spec_helper' require 'spec_helper'
describe 'zaqar' do describe 'zaqar' do
let :req_params do shared_examples 'zaqar' do
{ let :req_params do
:admin_password => 'foo', {
} :admin_password => 'foo',
end }
let :facts do
{ :osfamily => 'RedHat' }
end
describe 'with only required params' do
let :params do
req_params
end end
it { is_expected.to contain_package('zaqar-common').with( describe 'with only required params' do
:ensure => 'present', let :params do
:name => 'openstack-zaqar' req_params
)} end
it { is_expected.to contain_class('zaqar::params') } it { is_expected.to contain_package('zaqar-common').with(
:ensure => 'present',
:name => platform_params[:zaqar_common_package],
:tag => ['openstack', 'zaqar-package']
)}
it { is_expected.to contain_class('zaqar::params') }
it 'should contain default config' do
is_expected.to contain_zaqar_config('keystone_authtoken/auth_uri').with(
:value => 'http://localhost:5000/'
)
is_expected.to contain_zaqar_config('keystone_authtoken/identity_uri').with(
:value => 'http://localhost:35357/'
)
is_expected.to contain_zaqar_config('keystone_authtoken/admin_tenant_name').with(
:value => 'services'
)
is_expected.to contain_zaqar_config('keystone_authtoken/admin_user').with(
:value => 'zaqar'
)
is_expected.to contain_zaqar_config('keystone_authtoken/admin_password').with(
:value => 'foo'
)
is_expected.to contain_zaqar_config('DEFAULT/auth_strategy').with(
:value => 'keystone'
)
end
it 'should contain default config' do
is_expected.to contain_zaqar_config('keystone_authtoken/auth_uri').with(
:value => 'http://localhost:5000/'
)
is_expected.to contain_zaqar_config('keystone_authtoken/identity_uri').with(
:value => 'http://localhost:35357/'
)
is_expected.to contain_zaqar_config('keystone_authtoken/admin_tenant_name').with(
:value => 'services'
)
is_expected.to contain_zaqar_config('keystone_authtoken/admin_user').with(
:value => 'zaqar'
)
is_expected.to contain_zaqar_config('keystone_authtoken/admin_password').with(
:value => 'foo'
)
end end
end describe 'with custom values' do
let :params do
req_params.merge!({
:admin_mode => true,
:unreliable => true,
:pooling => true
})
end
describe 'with custom values' do it do
let :params do is_expected.to contain_zaqar_config('DEFAULT/admin_mode').with_value(true)
req_params.merge!({ is_expected.to contain_zaqar_config('DEFAULT/unreliable').with_value(true)
:admin_mode => true, is_expected.to contain_zaqar_config('DEFAULT/pooling').with_value(true)
:unreliable => true, end
:pooling => true
})
end
it do
is_expected.to contain_zaqar_config('DEFAULT/admin_mode').with_value(true)
is_expected.to contain_zaqar_config('DEFAULT/unreliable').with_value(true)
is_expected.to contain_zaqar_config('DEFAULT/pooling').with_value(true)
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())
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :zaqar_common_package => 'zaqar' }
when 'RedHat'
{ :zaqar_common_package => 'openstack-zaqar' }
end
end
it_behaves_like 'zaqar'
end
end
end end

View File

@ -6,116 +6,127 @@ require 'spec_helper'
describe 'zaqar::keystone::auth' do describe 'zaqar::keystone::auth' do
let :facts do
{ :osfamily => 'Debian' }
end
describe 'with default class parameters' do shared_examples_for 'zaqar::keystone::auth' do
let :params do describe 'with default class parameters' do
{ :password => 'zaqar_password', let :params do
:tenant => 'foobar' } { :password => 'zaqar_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_user('zaqar').with(
:ensure => 'present',
:password => 'zaqar_password',
) }
it { is_expected.to contain_keystone_user_role('zaqar@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:8888",
:admin_url => "http://127.0.0.1:8888",
:internal_url => "http://127.0.0.1:8888"
) }
end end
it { is_expected.to contain_keystone_user('zaqar').with( describe 'when overriding public_url, internal_url and admin_url' do
:ensure => 'present', let :params do
:password => 'zaqar_password', { :password => 'zaqar_password',
) } :public_url => 'https://10.10.10.10:8080',
:admin_url => 'http://10.10.10.10:8080',
:internal_url => 'http://10.10.10.10:8080'
}
end
it { is_expected.to contain_keystone_user_role('zaqar@foobar').with( it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with(
:ensure => 'present', :ensure => 'present',
:roles => ['admin'] :public_url => "https://10.10.10.10:8080",
)} :internal_url => "http://10.10.10.10:8080",
:admin_url => "http://10.10.10.10:8080"
it { is_expected.to contain_keystone_service('zaqar::messaging').with( ) }
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:8888",
:admin_url => "http://127.0.0.1:8888",
:internal_url => "http://127.0.0.1:8888"
) }
end
describe 'when overriding public_url, internal_url and admin_url' do
let :params do
{ :password => 'zaqar_password',
:public_url => 'https://10.10.10.10:8080',
:admin_url => 'http://10.10.10.10:8080',
:internal_url => 'http://10.10.10.10:8080'
}
end end
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with( describe 'when overriding auth name' do
:ensure => 'present', let :params do
:public_url => "https://10.10.10.10:8080", { :password => 'foo',
:internal_url => "http://10.10.10.10:8080", :auth_name => 'zaqary' }
:admin_url => "http://10.10.10.10:8080" end
) }
end
describe 'when overriding auth name' do it { is_expected.to contain_keystone_user('zaqary') }
let :params do it { is_expected.to contain_keystone_user_role('zaqary@services') }
{ :password => 'foo', it { is_expected.to contain_keystone_service('zaqary::messaging') }
:auth_name => 'zaqary' } it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::messaging') }
end end
it { is_expected.to contain_keystone_user('zaqary') } describe 'when overriding service name' do
it { is_expected.to contain_keystone_user_role('zaqary@services') } let :params do
it { is_expected.to contain_keystone_service('zaqary::messaging') } { :service_name => 'zaqar_service',
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::messaging') } :auth_name => 'zaqar',
end :password => 'zaqar_password' }
end
describe 'when overriding service name' do it { is_expected.to contain_keystone_user('zaqar') }
let :params do it { is_expected.to contain_keystone_user_role('zaqar@services') }
{ :service_name => 'zaqar_service', it { is_expected.to contain_keystone_service('zaqar_service::messaging') }
:auth_name => 'zaqar', it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::messaging') }
:password => 'zaqar_password' }
end end
it { is_expected.to contain_keystone_user('zaqar') } describe 'when disabling user configuration' do
it { is_expected.to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar_service::messaging') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::messaging') }
end
describe 'when disabling user configuration' do let :params do
{
:password => 'zaqar_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('zaqar') }
it { is_expected.to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
let :params do
{
:password => 'zaqar_password',
:configure_user => false
}
end end
it { is_expected.not_to contain_keystone_user('zaqar') } describe 'when disabling user and user role configuration' do
it { is_expected.to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
let :params do
{
:password => 'zaqar_password',
:configure_user => false,
:configure_user_role => false
}
end
it { is_expected.not_to contain_keystone_user('zaqar') }
it { is_expected.not_to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
end
end end
describe 'when disabling user and user role configuration' do 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 :params do it_configures 'zaqar::keystone::auth'
{
:password => 'zaqar_password',
:configure_user => false,
:configure_user_role => false
}
end end
it { is_expected.not_to contain_keystone_user('zaqar') }
it { is_expected.not_to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
end end
end end

View File

@ -88,20 +88,15 @@ describe 'zaqar::logging' do
} }
end end
context 'on Debian platforms' do on_supported_os({
let :facts do :supported_os => OSDefaults.get_supported_os
{ :osfamily => 'Debian' } }).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'zaqar-logging'
end end
it_configures 'zaqar-logging'
end end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'zaqar-logging'
end
end end

View File

@ -2,59 +2,69 @@ require 'spec_helper'
describe 'zaqar::management::mongodb' do describe 'zaqar::management::mongodb' do
let :req_params do shared_examples_for 'zaqar::management::mongodb' do
{ let :req_params do
:uri => 'mongodb://127.0.0.1:27017', {
} :uri => 'mongodb://127.0.0.1:27017',
end }
let :facts do
{ :osfamily => 'RedHat' }
end
describe 'with only required params' do
let :params do
req_params
end end
it 'should config mongo management driver' do describe 'with only required params' do
is_expected.to contain_zaqar_config('drivers/management_store').with( let :params do
:value => 'mongodb' req_params
) end
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/uri').with(
:value => 'mongodb://127.0.0.1:27017' it 'should config mongo management driver' do
) is_expected.to contain_zaqar_config('drivers/management_store').with(
:value => 'mongodb'
)
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/uri').with(
:value => 'mongodb://127.0.0.1:27017'
)
end
end end
describe 'with custom values' do
let :params do
req_params.merge!({
:ssl_keyfile => 'keyfile',
:ssl_certfile => 'certfile',
:ssl_cert_reqs => 'cert_reqs',
:ssl_ca_certs => 'ca_certs',
:database => 'zaqar_db',
:max_attempts => '1',
:max_retry_sleep => '2',
:max_retry_jitter => '3',
:max_reconnect_attempts => '4',
:reconnect_sleep => '5',
})
end
it 'configures custom values' do
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_keyfile').with_value('keyfile')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_certfile').with_value('certfile')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_cert_reqs').with_value('cert_reqs')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_ca_certs').with_value('ca_certs')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/database').with_value('zaqar_db')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_attempts').with_value('1')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_retry_sleep').with_value('2')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_retry_jitter').with_value('3')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_reconnect_attempts').with_value('4')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/reconnect_sleep').with_value('5')
end
end
end end
describe 'with custom values' do on_supported_os({
let :params do :supported_os => OSDefaults.get_supported_os
req_params.merge!({ }).each do |os,facts|
:ssl_keyfile => 'keyfile', context "on #{os}" do
:ssl_certfile => 'certfile', let (:facts) do
:ssl_cert_reqs => 'cert_reqs', facts.merge!(OSDefaults.get_facts())
:ssl_ca_certs => 'ca_certs', end
:database => 'zaqar_db',
:max_attempts => '1',
:max_retry_sleep => '2',
:max_retry_jitter => '3',
:max_reconnect_attempts => '4',
:reconnect_sleep => '5',
})
end
it 'configures custom values' do it_configures 'zaqar::management::mongodb'
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_keyfile').with_value('keyfile')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_certfile').with_value('certfile')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_cert_reqs').with_value('cert_reqs')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/ssl_ca_certs').with_value('ca_certs')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/database').with_value('zaqar_db')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_attempts').with_value('1')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_retry_sleep').with_value('2')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_retry_jitter').with_value('3')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/max_reconnect_attempts').with_value('4')
is_expected.to contain_zaqar_config('drivers:management_store:mongodb/reconnect_sleep').with_value('5')
end end
end end

View File

@ -2,62 +2,71 @@ require 'spec_helper'
describe 'zaqar::messaging::mongodb' do describe 'zaqar::messaging::mongodb' do
let :req_params do shared_examples_for 'zaqar::messaging::mongodb' do
{ let :req_params do
:uri => 'mongodb://127.0.0.1:27017', {
} :uri => 'mongodb://127.0.0.1:27017',
end }
let :facts do
{ :osfamily => 'RedHat' }
end
describe 'with only required params' do
let :params do
req_params
end end
it 'should config mongo messaging driver' do describe 'with only required params' do
is_expected.to contain_zaqar_config('drivers/message_store').with( let :params do
:value => 'mongodb' req_params
) end
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/uri').with(
:value => 'mongodb://127.0.0.1:27017' it 'should config mongo messaging driver' do
) is_expected.to contain_zaqar_config('drivers/message_store').with(
:value => 'mongodb'
)
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/uri').with(
:value => 'mongodb://127.0.0.1:27017'
)
end
end end
end describe 'with custom values' do
let :params do
req_params.merge!({
:ssl_keyfile => 'keyfile',
:ssl_certfile => 'certfile',
:ssl_cert_reqs => 'cert_reqs',
:ssl_ca_certs => 'ca_certs',
:database => 'zaqar_db',
:max_attempts => '1',
:max_retry_sleep => '2',
:max_retry_jitter => '3',
:max_reconnect_attempts => '4',
:reconnect_sleep => '5',
:partitions => '6',
})
end
describe 'with custom values' do it 'configures custom values' do
let :params do is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_keyfile').with_value('keyfile')
req_params.merge!({ is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_certfile').with_value('certfile')
:ssl_keyfile => 'keyfile', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_cert_reqs').with_value('cert_reqs')
:ssl_certfile => 'certfile', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_ca_certs').with_value('ca_certs')
:ssl_cert_reqs => 'cert_reqs', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/database').with_value('zaqar_db')
:ssl_ca_certs => 'ca_certs', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_attempts').with_value('1')
:database => 'zaqar_db', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_retry_sleep').with_value('2')
:max_attempts => '1', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_retry_jitter').with_value('3')
:max_retry_sleep => '2', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_reconnect_attempts').with_value('4')
:max_retry_jitter => '3', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/reconnect_sleep').with_value('5')
:max_reconnect_attempts => '4', is_expected.to contain_zaqar_config('drivers:message_store:mongodb/partitions').with_value('6')
:reconnect_sleep => '5', end
:partitions => '6',
})
end
it 'configures custom values' do
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_keyfile').with_value('keyfile')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_certfile').with_value('certfile')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_cert_reqs').with_value('cert_reqs')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/ssl_ca_certs').with_value('ca_certs')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/database').with_value('zaqar_db')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_attempts').with_value('1')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_retry_sleep').with_value('2')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_retry_jitter').with_value('3')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/max_reconnect_attempts').with_value('4')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/reconnect_sleep').with_value('5')
is_expected.to contain_zaqar_config('drivers:message_store:mongodb/partitions').with_value('6')
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())
end
it_configures 'zaqar::messaging::mongodb'
end
end
end end

View File

@ -23,19 +23,15 @@ describe 'zaqar::policy' do
end end
end end
context 'on Debian platforms' do on_supported_os({
let :facts do :supported_os => OSDefaults.get_supported_os
{ :osfamily => 'Debian' } }).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'zaqar policies'
end end
it_configures 'zaqar policies'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'zaqar policies'
end end
end end

View File

@ -1,26 +0,0 @@
require 'spec_helper'
describe 'zaqar' do
let :pre_condition do
"zaqar::server_instance{ '1': transport => 'websocket' }"
end
let :facts do
{ :osfamily => 'RedHat' }
end
let :params do
{ :admin_password => 'foo' }
end
describe 'with a websocket server instance 1' do
it { is_expected.to contain_service('openstack-zaqar@1').with(
:ensure => 'running',
:enable => true
)}
it {is_expected.to contain_file('/etc/zaqar/1.conf') }
end
end

View File

@ -1,20 +1,38 @@
require 'spec_helper' require 'spec_helper'
describe 'zaqar::server' do describe 'zaqar::server' do
let :facts do shared_examples_for 'zaqar::server' do
{ :osfamily => 'RedHat' } describe 'with a zaqar server enabled' do
end let :pre_condition do
"class {'::zaqar': admin_password => 'foo'}"
end
it { is_expected.to contain_service(platform_params[:zaqar_service_name]).with(
:ensure => 'running',
:enable => true
)}
describe 'with a zaqar server enabled' do
let :pre_condition do
"class {'::zaqar': admin_password => 'foo'}"
end end
it { is_expected.to contain_service('openstack-zaqar').with(
:ensure => 'running',
:enable => true
)}
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
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :zaqar_service_name => 'zaqar' }
when 'RedHat'
{ :zaqar_service_name => 'openstack-zaqar' }
end
end
it_configures 'zaqar::server'
end
end
end end

View File

@ -2,24 +2,33 @@ require 'spec_helper'
describe 'zaqar::transport::websocket' do describe 'zaqar::transport::websocket' do
let :facts do shared_examples_for 'zaqar::transport::websocket' do
{ :osfamily => 'RedHat' } describe 'with custom values' do
end let :params do
{
:bind => '1',
:port => '2',
:external_port => '3',
}
end
describe 'with custom values' do it 'configures custom values' do
let :params do is_expected.to contain_zaqar_config('drivers:transport:websocket/bind').with_value('1')
{ is_expected.to contain_zaqar_config('drivers:transport:websocket/port').with_value('2')
:bind => '1', is_expected.to contain_zaqar_config('drivers:transport:websocket/external-port').with_value('3')
:port => '2', end
:external_port => '3',
}
end
it 'configures custom values' do
is_expected.to contain_zaqar_config('drivers:transport:websocket/bind').with_value('1')
is_expected.to contain_zaqar_config('drivers:transport:websocket/port').with_value('2')
is_expected.to contain_zaqar_config('drivers:transport:websocket/external-port').with_value('3')
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())
end
it_configures 'zaqar::transport::websocket'
end
end
end end

View File

@ -2,22 +2,31 @@ require 'spec_helper'
describe 'zaqar::transport::wsgi' do describe 'zaqar::transport::wsgi' do
let :facts do shared_examples_for 'zaqar::transport::wsgi' do
{ :osfamily => 'RedHat' } describe 'with custom values' do
end let :params do
{
:bind => '1',
:port => '2',
}
end
describe 'with custom values' do it 'configures custom values' do
let :params do is_expected.to contain_zaqar_config('drivers:transport:wsgi/bind').with_value('1')
{ is_expected.to contain_zaqar_config('drivers:transport:wsgi/port').with_value('2')
:bind => '1', end
:port => '2',
}
end
it 'configures custom values' do
is_expected.to contain_zaqar_config('drivers:transport:wsgi/bind').with_value('1')
is_expected.to contain_zaqar_config('drivers:transport:wsgi/port').with_value('2')
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())
end
it_configures 'zaqar::transport::wsgi'
end
end
end end

View File

@ -0,0 +1,48 @@
require 'spec_helper'
describe 'zaqar::server_instance' do
shared_examples_for 'zaqar::server_instance' do
let(:title) { '1' }
let :pre_condition do
"class { 'zaqar': admin_password => 'foo' }"
end
let :params do
{
:transport => 'websocket'
}
end
describe 'with a websocket server instance 1' do
it { is_expected.to contain_service("#{platform_params[:zaqar_service_name]}@1").with(
:ensure => 'running',
:enable => true
)}
it { is_expected.to contain_file('/etc/zaqar/1.conf') }
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
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :zaqar_service_name => 'zaqar' }
when 'RedHat'
{ :zaqar_service_name => 'openstack-zaqar' }
end
end
it_configures 'zaqar::server_instance'
end
end
end