Switch zaqar to use rspec-puppet-facts

This change updates the tests to use rspec-puppet-facts. Additionally
this change fixes the relationship in zaqar::server_instance for Debian
based systems.

Change-Id: I03ce4ee17feec1f0ea7012ea116c9c12cf3bde5f
This commit is contained in:
Alex Schultz 2016-02-18 21:32:17 -07:00
parent 6c05509bcc
commit 366deb93cb
14 changed files with 497 additions and 407 deletions

View File

@ -30,13 +30,13 @@ define zaqar::server_instance(
include ::zaqar
include ::zaqar::params
service { "openstack-zaqar@${name}":
service { "${::zaqar::params::service_name}@${name}":
ensure => $service_ensure,
enable => $enabled,
}
Package[$::zaqar::params::package_name] ~> Service["${::zaqar::params::service_name}@${name}"]
Package[$::zaqar::params::package_name] ~> File["/etc/zaqar/${name}.conf"]
Package['zaqar-common'] ~> Service["${::zaqar::params::service_name}@${name}"]
Package['zaqar-common'] ~> File["/etc/zaqar/${name}.conf"]
File["/etc/zaqar/${name}.conf"] ~> 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
let :pre_condition do
[
'include mysql::server',
'include zaqar::db::sync'
]
end
shared_examples_for 'zaqar::db::mysql' do
let :pre_condition do
[
'include mysql::server',
'include zaqar::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('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
{
:password => 'zaqarpass',
:allowed_hosts => ['127.0.0.1','%']
'password' => 'fooboozoo_default_password',
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'zaqarpass2',
:allowed_hosts => '192.168.1.1'
}
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
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
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

View File

@ -2,21 +2,13 @@ require 'spec_helper'
describe 'zaqar::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
shared_examples_for 'zaqar::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'
}
let :pre_condition do
'include postgresql::server'
end
context 'with only required parameters' do
@ -32,27 +24,16 @@ describe 'zaqar::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('zaqar').with(
:user => 'zaqar',
:password => 'md52e9c9a1a01bb2fef7463b70dd24d4b25'
)}
it_configures 'zaqar::db::postgresql'
end
end
end

View File

@ -1,61 +1,82 @@
require 'spec_helper'
describe 'zaqar' do
let :req_params do
{
:admin_password => 'foo',
}
end
let :facts do
{ :osfamily => 'RedHat' }
end
describe 'with only required params' do
let :params do
req_params
shared_examples 'zaqar' do
let :req_params do
{
:admin_password => 'foo',
}
end
it { is_expected.to contain_package('zaqar-common').with(
:ensure => 'present',
:name => 'openstack-zaqar'
)}
describe 'with only required params' do
let :params do
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
describe 'with custom values' do
let :params do
req_params.merge!({
:admin_mode => true,
:unreliable => true,
:pooling => true
})
end
describe 'with custom values' do
let :params do
req_params.merge!({
:admin_mode => true,
:unreliable => true,
: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)
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
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

View File

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

View File

@ -88,20 +88,15 @@ describe 'zaqar::logging' 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 'zaqar-logging'
end
it_configures 'zaqar-logging'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'zaqar-logging'
end
end

View File

@ -2,59 +2,69 @@ require 'spec_helper'
describe 'zaqar::management::mongodb' do
let :req_params do
{
: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
shared_examples_for 'zaqar::management::mongodb' do
let :req_params do
{
:uri => 'mongodb://127.0.0.1:27017',
}
end
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'
)
describe 'with only required params' do
let :params do
req_params
end
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
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
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
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 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')
it_configures 'zaqar::management::mongodb'
end
end

View File

@ -2,62 +2,71 @@ require 'spec_helper'
describe 'zaqar::messaging::mongodb' do
let :req_params do
{
: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
shared_examples_for 'zaqar::messaging::mongodb' do
let :req_params do
{
:uri => 'mongodb://127.0.0.1:27017',
}
end
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'
)
describe 'with only required params' do
let :params do
req_params
end
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
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
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
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')
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
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

View File

@ -23,19 +23,15 @@ describe 'zaqar::policy' do
end
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 'zaqar policies'
end
it_configures 'zaqar policies'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'zaqar policies'
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'
describe 'zaqar::server' do
let :facts do
{ :osfamily => 'RedHat' }
end
shared_examples_for 'zaqar::server' do
describe 'with a zaqar server enabled' do
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
it { is_expected.to contain_service('openstack-zaqar').with(
:ensure => 'running',
:enable => true
)}
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

View File

@ -2,24 +2,33 @@ require 'spec_helper'
describe 'zaqar::transport::websocket' do
let :facts do
{ :osfamily => 'RedHat' }
end
shared_examples_for 'zaqar::transport::websocket' do
describe 'with custom values' do
let :params do
{
:bind => '1',
:port => '2',
:external_port => '3',
}
end
describe 'with custom values' do
let :params do
{
:bind => '1',
:port => '2',
: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')
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
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

View File

@ -2,22 +2,31 @@ require 'spec_helper'
describe 'zaqar::transport::wsgi' do
let :facts do
{ :osfamily => 'RedHat' }
end
shared_examples_for 'zaqar::transport::wsgi' do
describe 'with custom values' do
let :params do
{
:bind => '1',
:port => '2',
}
end
describe 'with custom values' do
let :params do
{
:bind => '1',
: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')
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
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

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