Convert spec testing to use rspec-puppet-facts

Change-Id: I6e1450a9546676533dd6c055e4efd42658b86bf1
This commit is contained in:
Tobias Urdin 2018-11-04 15:41:48 +01:00
parent 38eda71263
commit 90738b97ae
26 changed files with 1064 additions and 1162 deletions

View File

@ -18,7 +18,6 @@
require 'spec_helper'
describe 'ceph::conf' do
let :params do
{
:args => {
@ -33,17 +32,24 @@ describe 'ceph::conf' do
}
end
it {
is_expected.to contain_ceph_config('A').with('value' => "AA VALUE")
is_expected.to contain_ceph_config('B').with('value' => "DEFAULT")
}
shared_examples 'ceph::conf' do
context 'with specified parameters' do
it {
should contain_ceph_config('A').with_value('AA VALUE')
should contain_ceph_config('B').with_value('DEFAULT')
}
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 'ceph::conf'
end
end
end
# Local Variables:
# compile-command: "cd ../.. ;
# export BUNDLE_PATH=/tmp/vendor ;
# bundle install ;
# bundle exec rake spec
# "
# End:

View File

@ -18,7 +18,7 @@ require 'spec_helper'
describe 'ceph' do
shared_examples_for 'ceph' do
shared_examples 'ceph' do
describe "with default params and specified fsid" do
let :params do
{
@ -26,40 +26,40 @@ describe 'ceph' do
}
end
it { is_expected.to contain_package('ceph').with(
it { should contain_package('ceph').with(
'name' => 'ceph',
'ensure' => 'present') }
it { is_expected.to contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') }
it { is_expected.to_not contain_ceph_config('global/keyring').with_value('/etc/ceph/keyring') }
it { is_expected.to_not contain_ceph_config('global/osd_pool_default_pg_num').with_value('128') }
it { is_expected.to_not contain_ceph_config('global/osd_pool_default_pgp_num').with_value('128') }
it { is_expected.to_not contain_ceph_config('global/osd_pool_default_size').with_value('3') }
it { is_expected.to_not contain_ceph_config('global/osd_pool_default_min_size').with_value('2') }
it { is_expected.to_not contain_ceph_config('global/osd_pool_default_crush_rule').with_value('0') }
it { is_expected.to_not contain_ceph_config('global/osd_crush_update_on_start').with_value(false) }
it { is_expected.to_not contain_ceph_config('global/mon_osd_full_ratio').with_value('90') }
it { is_expected.to_not contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('85') }
it { is_expected.to_not contain_ceph_config('global/mon_initial_members').with_value('mon.01') }
it { is_expected.to_not contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') }
it { is_expected.to_not contain_ceph_config('global/ms_bind_ipv6').with_value('false') }
it { is_expected.to_not contain_ceph_config('global/require_signatures').with_value('false') }
it { is_expected.to_not contain_ceph_config('global/cluster_require_signatures').with_value('false') }
it { is_expected.to_not contain_ceph_config('global/service_require_signatures').with_value('false') }
it { is_expected.to_not contain_ceph_config('global/sign_messages').with_value('true') }
it { is_expected.to_not contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') }
it { is_expected.to_not contain_ceph_config('global/public_network').with_value('192.168.0.0/24') }
it { is_expected.to_not contain_ceph_config('global/public_addr').with_value('192.168.0.2') }
it { is_expected.to_not contain_ceph_config('osd/osd_journal_size').with_value('4096') }
it { is_expected.to_not contain_ceph_config('client/rbd_default_features').with_value('15') }
it { is_expected.to contain_ceph_config('global/auth_cluster_required').with_value('cephx') }
it { is_expected.to contain_ceph_config('global/auth_service_required').with_value('cephx') }
it { is_expected.to contain_ceph_config('global/auth_client_required').with_value('cephx') }
it { is_expected.to contain_ceph_config('global/auth_supported').with_value('cephx') }
it { is_expected.to_not contain_ceph_config('global/auth_cluster_required').with_value('none') }
it { is_expected.to_not contain_ceph_config('global/auth_service_required').with_value('none') }
it { is_expected.to_not contain_ceph_config('global/auth_client_required').with_value('none') }
it { is_expected.to_not contain_ceph_config('global/auth_supported').with_value('none') }
it { should contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') }
it { should_not contain_ceph_config('global/keyring').with_value('/etc/ceph/keyring') }
it { should_not contain_ceph_config('global/osd_pool_default_pg_num').with_value('128') }
it { should_not contain_ceph_config('global/osd_pool_default_pgp_num').with_value('128') }
it { should_not contain_ceph_config('global/osd_pool_default_size').with_value('3') }
it { should_not contain_ceph_config('global/osd_pool_default_min_size').with_value('2') }
it { should_not contain_ceph_config('global/osd_pool_default_crush_rule').with_value('0') }
it { should_not contain_ceph_config('global/osd_crush_update_on_start').with_value(false) }
it { should_not contain_ceph_config('global/mon_osd_full_ratio').with_value('90') }
it { should_not contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('85') }
it { should_not contain_ceph_config('global/mon_initial_members').with_value('mon.01') }
it { should_not contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') }
it { should_not contain_ceph_config('global/ms_bind_ipv6').with_value('false') }
it { should_not contain_ceph_config('global/require_signatures').with_value('false') }
it { should_not contain_ceph_config('global/cluster_require_signatures').with_value('false') }
it { should_not contain_ceph_config('global/service_require_signatures').with_value('false') }
it { should_not contain_ceph_config('global/sign_messages').with_value('true') }
it { should_not contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') }
it { should_not contain_ceph_config('global/public_network').with_value('192.168.0.0/24') }
it { should_not contain_ceph_config('global/public_addr').with_value('192.168.0.2') }
it { should_not contain_ceph_config('osd/osd_journal_size').with_value('4096') }
it { should_not contain_ceph_config('client/rbd_default_features').with_value('15') }
it { should contain_ceph_config('global/auth_cluster_required').with_value('cephx') }
it { should contain_ceph_config('global/auth_service_required').with_value('cephx') }
it { should contain_ceph_config('global/auth_client_required').with_value('cephx') }
it { should contain_ceph_config('global/auth_supported').with_value('cephx') }
it { should_not contain_ceph_config('global/auth_cluster_required').with_value('none') }
it { should_not contain_ceph_config('global/auth_service_required').with_value('none') }
it { should_not contain_ceph_config('global/auth_client_required').with_value('none') }
it { should_not contain_ceph_config('global/auth_supported').with_value('none') }
end
describe "with custom params and specified fsid" do
@ -100,48 +100,48 @@ describe 'ceph' do
}
end
it { is_expected.to contain_package('ceph').with(
it { should contain_package('ceph').with(
'name' => 'ceph',
'ensure' => 'present') }
it { is_expected.to contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') }
it { is_expected.to contain_ceph_config('global/keyring').with_value('/usr/local/ceph/etc/keyring') }
it { is_expected.to contain_ceph_config('global/osd_max_object_name_len').with_value('1024') }
it { is_expected.to contain_ceph_config('global/osd_max_object_namespace_len').with_value('256') }
it { is_expected.to contain_ceph_config('global/osd_pool_default_pg_num').with_value('256') }
it { is_expected.to contain_ceph_config('global/osd_pool_default_pgp_num').with_value('256') }
it { is_expected.to contain_ceph_config('global/osd_pool_default_size').with_value('2') }
it { is_expected.to contain_ceph_config('global/osd_pool_default_min_size').with_value('1') }
it { is_expected.to contain_ceph_config('global/osd_pool_default_crush_rule').with_value('10') }
it { is_expected.to contain_ceph_config('global/osd_crush_update_on_start').with_value(false) }
it { is_expected.to contain_ceph_config('global/mon_osd_full_ratio').with_value('95') }
it { is_expected.to contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('90') }
it { is_expected.to contain_ceph_config('global/mon_initial_members').with_value('mon.01') }
it { is_expected.to contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') }
it { is_expected.to contain_ceph_config('global/ms_bind_ipv6').with_value('true') }
it { is_expected.to contain_ceph_config('global/require_signatures').with_value('true') }
it { is_expected.to contain_ceph_config('global/cluster_require_signatures').with_value('true') }
it { is_expected.to contain_ceph_config('global/service_require_signatures').with_value('true') }
it { is_expected.to contain_ceph_config('global/sign_messages').with_value('false') }
it { is_expected.to contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') }
it { is_expected.to contain_ceph_config('global/public_network').with_value('192.168.0.0/24') }
it { is_expected.to contain_ceph_config('global/public_addr').with_value('192.168.0.2') }
it { is_expected.to contain_ceph_config('osd/osd_journal_size').with_value('1024') }
it { is_expected.to contain_ceph_config('client/rbd_default_features').with_value('12') }
it { is_expected.to_not contain_ceph_config('global/auth_cluster_required').with_value('cephx') }
it { is_expected.to_not contain_ceph_config('global/auth_service_required').with_value('cephx') }
it { is_expected.to_not contain_ceph_config('global/auth_client_required').with_value('cephx') }
it { is_expected.to_not contain_ceph_config('global/auth_supported').with_value('cephx') }
it { is_expected.to contain_ceph_config('global/auth_cluster_required').with_value('none') }
it { is_expected.to contain_ceph_config('global/auth_service_required').with_value('none') }
it { is_expected.to contain_ceph_config('global/auth_client_required').with_value('none') }
it { is_expected.to contain_ceph_config('global/auth_supported').with_value('none') }
it { is_expected.to contain_ceph_config('osd/osd_max_backfills').with_value('1') }
it { is_expected.to contain_ceph_config('osd/osd_recovery_max_active').with_value('1') }
it { is_expected.to contain_ceph_config('osd/osd_recovery_op_priority').with_value('1') }
it { is_expected.to contain_ceph_config('osd/osd_recovery_max_single_start').with_value('1') }
it { is_expected.to contain_ceph_config('osd/osd_max_scrubs').with_value('1') }
it { is_expected.to contain_ceph_config('osd/osd_op_threads').with_value('2') }
it { should contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') }
it { should contain_ceph_config('global/keyring').with_value('/usr/local/ceph/etc/keyring') }
it { should contain_ceph_config('global/osd_max_object_name_len').with_value('1024') }
it { should contain_ceph_config('global/osd_max_object_namespace_len').with_value('256') }
it { should contain_ceph_config('global/osd_pool_default_pg_num').with_value('256') }
it { should contain_ceph_config('global/osd_pool_default_pgp_num').with_value('256') }
it { should contain_ceph_config('global/osd_pool_default_size').with_value('2') }
it { should contain_ceph_config('global/osd_pool_default_min_size').with_value('1') }
it { should contain_ceph_config('global/osd_pool_default_crush_rule').with_value('10') }
it { should contain_ceph_config('global/osd_crush_update_on_start').with_value(false) }
it { should contain_ceph_config('global/mon_osd_full_ratio').with_value('95') }
it { should contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('90') }
it { should contain_ceph_config('global/mon_initial_members').with_value('mon.01') }
it { should contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') }
it { should contain_ceph_config('global/ms_bind_ipv6').with_value('true') }
it { should contain_ceph_config('global/require_signatures').with_value('true') }
it { should contain_ceph_config('global/cluster_require_signatures').with_value('true') }
it { should contain_ceph_config('global/service_require_signatures').with_value('true') }
it { should contain_ceph_config('global/sign_messages').with_value('false') }
it { should contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') }
it { should contain_ceph_config('global/public_network').with_value('192.168.0.0/24') }
it { should contain_ceph_config('global/public_addr').with_value('192.168.0.2') }
it { should contain_ceph_config('osd/osd_journal_size').with_value('1024') }
it { should contain_ceph_config('client/rbd_default_features').with_value('12') }
it { should_not contain_ceph_config('global/auth_cluster_required').with_value('cephx') }
it { should_not contain_ceph_config('global/auth_service_required').with_value('cephx') }
it { should_not contain_ceph_config('global/auth_client_required').with_value('cephx') }
it { should_not contain_ceph_config('global/auth_supported').with_value('cephx') }
it { should contain_ceph_config('global/auth_cluster_required').with_value('none') }
it { should contain_ceph_config('global/auth_service_required').with_value('none') }
it { should contain_ceph_config('global/auth_client_required').with_value('none') }
it { should contain_ceph_config('global/auth_supported').with_value('none') }
it { should contain_ceph_config('osd/osd_max_backfills').with_value('1') }
it { should contain_ceph_config('osd/osd_recovery_max_active').with_value('1') }
it { should contain_ceph_config('osd/osd_recovery_op_priority').with_value('1') }
it { should contain_ceph_config('osd/osd_recovery_max_single_start').with_value('1') }
it { should contain_ceph_config('osd/osd_max_scrubs').with_value('1') }
it { should contain_ceph_config('osd/osd_op_threads').with_value('2') }
end
end

View File

@ -18,12 +18,12 @@ require 'spec_helper'
describe 'ceph::mds' do
shared_examples_for 'ceph mds' do
shared_examples 'ceph mds' do
describe "activated with default params" do
it { is_expected.to contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/ceph-myhostname') }
it { is_expected.to contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/ceph-myhostname/keyring') }
it { is_expected.to contain_package('ceph-mds').with('ensure' => 'present') }
it { should contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/ceph-myhostname') }
it { should contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/ceph-myhostname/keyring') }
it { should contain_package('ceph-mds').with('ensure' => 'present') }
end
describe "activated with custom params" do
@ -36,14 +36,14 @@ describe 'ceph::mds' do
}
end
it { is_expected.to contain_ceph_config('mds/mds_data').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id') }
it { is_expected.to contain_ceph_config('mds/keyring').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id/keyring') }
it { is_expected.to contain_package('ceph-mds').with('ensure' => 'present') }
it { should contain_ceph_config('mds/mds_data').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id') }
it { should contain_ceph_config('mds/keyring').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id/keyring') }
it { should contain_package('ceph-mds').with('ensure' => 'present') }
it {
is_expected.to contain_service('ceph-mds@mymds').with('ensure' => 'running')
should contain_service('ceph-mds@mymds').with('ensure' => 'running')
}
it { is_expected.to contain_ceph_config('mds.mymds/public_addr').with_value('1.2.3.4') }
it { is_expected.to contain_file('/usr/local/ceph/var/lib/mds/_cluster-_id').with( {
it { should contain_ceph_config('mds.mymds/public_addr').with_value('1.2.3.4') }
it { should contain_file('/usr/local/ceph/var/lib/mds/_cluster-_id').with( {
'ensure' => 'directory',
'owner' => 'ceph',
'group' => 'ceph',
@ -59,8 +59,8 @@ describe 'ceph::mds' do
}
end
it { is_expected.to contain_ceph_config('mds/mds_data').with_ensure('absent') }
it { is_expected.to contain_ceph_config('mds/keyring').with_ensure('absent') }
it { should contain_ceph_config('mds/mds_data').with_ensure('absent') }
it { should contain_ceph_config('mds/keyring').with_ensure('absent') }
end
end

View File

@ -21,7 +21,7 @@ require 'spec_helper'
describe 'ceph::mons' do
shared_examples_for 'ceph mons' do
shared_examples 'ceph mons' do
let :params do
{
:args => {
@ -41,8 +41,8 @@ describe 'ceph::mons' do
end
it {
is_expected.to contain_service('ceph-mon-A').with('ensure' => "running")
is_expected.to contain_service('ceph-mon-B').with('ensure' => "running")
should contain_service('ceph-mon-A').with('ensure' => "running")
should contain_service('ceph-mon-B').with('ensure' => "running")
}
end
@ -59,11 +59,3 @@ describe 'ceph::mons' do
end
end
# Local Variables:
# compile-command: "cd ../.. ;
# export BUNDLE_PATH=/tmp/vendor ;
# bundle install ;
# bundle exec rake spec
# "
# End:

View File

@ -19,7 +19,7 @@ require 'spec_helper'
describe 'ceph::osds' do
shared_examples_for 'ceph osds' do
shared_examples 'ceph osds' do
let :params do
{
:args => {
@ -36,14 +36,14 @@ describe 'ceph::osds' do
end
it {
is_expected.to contain_ceph__osd('/dev/sdb').with(
should contain_ceph__osd('/dev/sdb').with(
:ensure => 'present',
:journal => '/srv/journal',
:cluster => 'CLUSTER')
is_expected.to contain_ceph__osd('/srv/data').with(
should contain_ceph__osd('/srv/data').with(
:ensure => 'present',
:cluster => 'CLUSTER')
is_expected.not_to contain_sysctl__value('kernel.pid_max')
should_not contain_sysctl__value('kernel.pid_max')
}
end
@ -54,7 +54,7 @@ describe 'ceph::osds' do
}
end
it do
is_expected.to contain_sysctl__value('kernel.pid_max').with_value(123456)
should contain_sysctl__value('kernel.pid_max').with_value(123456)
end
end
@ -71,10 +71,3 @@ describe 'ceph::osds' do
end
end
# Local Variables:
# compile-command: "cd ../..;
# bundle install --path=vendor;
# bundle exec rake spec
# "
# End:

View File

@ -19,20 +19,20 @@ require 'spec_helper'
describe 'ceph::profile::base' do
shared_examples_for 'ceph profile base' do
shared_examples 'ceph profile base' do
describe "with default params" do
it { is_expected.to contain_class('ceph::profile::params') }
it { is_expected.to contain_class('ceph::repo') }
it { is_expected.to contain_class('ceph') }
it { should contain_class('ceph::profile::params') }
it { should contain_class('ceph::repo') }
it { should contain_class('ceph') }
end
describe "with custom param manage_repo false" do
let :pre_condition do
"class { 'ceph::profile::params': manage_repo => false }"
end
it { is_expected.to contain_class('ceph::profile::params') }
it { is_expected.to_not contain_class('ceph::repo') }
it { is_expected.to contain_class('ceph') }
it { should contain_class('ceph::profile::params') }
it { should_not contain_class('ceph::repo') }
it { should contain_class('ceph') }
end
end

View File

@ -20,11 +20,11 @@ require 'spec_helper'
describe 'ceph::profile::client' do
shared_examples_for 'ceph profile client' do
shared_examples 'ceph profile client' do
context 'with the default client keys defined in common.yaml' do
it { is_expected.to contain_class('ceph::profile::base') }
it { is_expected.to contain_class('ceph::keys').with(
it { should contain_class('ceph::profile::base') }
it { should contain_class('ceph::keys').with(
'args' => {
'client.admin' => {
'secret' => 'AQBMGHJTkC8HKhAAJ7NH255wYypgm1oVuV41MA==',
@ -61,8 +61,8 @@ describe 'ceph::profile::client' do
facts.merge!( :hostname => 'client')
end
it { is_expected.to contain_class('ceph::profile::base') }
it { is_expected.to contain_class('ceph::keys').with(
it { should contain_class('ceph::profile::base') }
it { should contain_class('ceph::keys').with(
'args' => {
'client.volumes' => {
'secret' => 'AQA4MPZTOGU0ARAAXH9a0fXxVq0X25n2yPREDw==',
@ -84,8 +84,8 @@ describe 'ceph::profile::client' do
}"
end
it { is_expected.to contain_class('ceph::profile::base') }
it { is_expected.to_not contain_class('ceph::keys') }
it { should contain_class('ceph::profile::base') }
it { should_not contain_class('ceph::keys') }
end
end

View File

@ -17,9 +17,9 @@ require 'spec_helper'
describe 'ceph::profile::fs' do
shared_examples_for 'ceph profile fs' do
shared_examples 'ceph profile fs' do
it { is_expected.to contain_ceph__fs('fs_name').with(
it { should contain_ceph__fs('fs_name').with(
'metadata_pool' => 'metadata_pool',
'data_pool' => 'data_pool'
)}

View File

@ -19,12 +19,12 @@ require 'spec_helper'
describe 'ceph::profile::mds' do
shared_examples_for 'ceph profile mds' do
shared_examples 'ceph profile mds' do
it { is_expected.to contain_class('ceph::mds').with(
it { should contain_class('ceph::mds').with(
'public_addr' => '10.11.12.2',
)}
it { is_expected.to contain_ceph__key('mds.myhostname').with(
it { should contain_ceph__key('mds.myhostname').with(
:cap_mon => 'allow profile mds',
:cap_osd => 'allow rwx',
:cap_mds => 'allow',

View File

@ -19,8 +19,8 @@ require 'spec_helper'
describe 'ceph::profile::mgr' do
shared_examples_for 'ceph profile mgr' do
it { is_expected.to contain_ceph__mgr('first').with(
shared_examples 'ceph profile mgr' do
it { should contain_ceph__mgr('first').with(
:authentication_type => 'cephx',
:key => 'AQASGFDFUHBHDG9SDdsyffV1xgsn1pgr3GcKPg==',
:inject_key => true)

View File

@ -19,14 +19,14 @@ require 'spec_helper'
describe 'ceph::profile::mon' do
shared_examples_for 'ceph profile mon' do
shared_examples 'ceph profile mon' do
it { is_expected.to contain_ceph__mon('first').with(
it { should contain_ceph__mon('first').with(
:authentication_type => 'cephx',
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
:public_addr => '10.11.12.2')
}
it { is_expected.to contain_class('ceph::keys').with(
it { should contain_class('ceph::keys').with(
'args' => {
'client.admin' => {
'secret' => 'AQBMGHJTkC8HKhAAJ7NH255wYypgm1oVuV41MA==',

View File

@ -19,16 +19,16 @@ require 'spec_helper'
describe 'ceph::profile::osd' do
shared_examples_for 'ceph profile osd' do
shared_examples 'ceph profile osd' do
context 'with the default osd defined in common.yaml' do
before :each do
facts.merge!( :hostname => 'osd')
end
it { is_expected.to contain_class('ceph::profile::client') }
it { is_expected.to contain_ceph__osd('/dev/sdc').with(:journal => '/dev/sdb') }
it { is_expected.to contain_ceph__osd('/dev/sdd').with(:journal => '/dev/sdb') }
it { should contain_class('ceph::profile::client') }
it { should contain_ceph__osd('/dev/sdc').with(:journal => '/dev/sdb') }
it { should contain_ceph__osd('/dev/sdd').with(:journal => '/dev/sdb') }
end
context 'with the host specific first.yaml' do
@ -37,8 +37,8 @@ describe 'ceph::profile::osd' do
facts.merge!( :hostname => 'first')
end
it { is_expected.to contain_class('ceph::profile::client') }
it { is_expected.to contain_ceph__osd('/dev/sdb').with( :journal => '/srv/journal') }
it { should contain_class('ceph::profile::client') }
it { should contain_ceph__osd('/dev/sdb').with( :journal => '/srv/journal') }
end
end

View File

@ -19,7 +19,7 @@ require 'spec_helper'
describe 'ceph::profile::params' do
shared_examples_for 'ceph profile params' do
shared_examples 'ceph profile params' do
describe "should fail when client_keys is not a hash" do
let :pre_condition do
@ -28,7 +28,7 @@ describe 'ceph::profile::params' do
}"
end
it { is_expected.to raise_error Puppet::Error, /is not a Hash/ }
it { should raise_error Puppet::Error, /is not a Hash/ }
end
describe "should fail when using cephx without client_keys" do
@ -40,7 +40,7 @@ describe 'ceph::profile::params' do
}"
end
it { is_expected.to raise_error Puppet::Error,
it { should raise_error Puppet::Error,
/client_keys must be provided when using authentication_type = 'cephx'/
}
end

View File

@ -20,128 +20,115 @@
require 'spec_helper'
describe 'ceph::repo' do
describe 'Debian' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistid => 'Debian',
:lsbdistcodename => 'jessie',
:lsbdistrelease => '8',
}
shared_examples 'ceph::repo on Debian' do
before do
facts.merge!( :osfamily => 'Debian',
:lsbdistid => 'Debian',
:lsbdistcodename => 'jessie',
:lsbdistrelease => '8' )
end
describe "with default params" do
it { is_expected.to contain_apt__key('ceph').with(
context 'with default params' do
it { should contain_apt__key('ceph').with(
:id => '08B73419AC32B4E966C1A330E84AC2C0460F3994',
:source => 'https://download.ceph.com/keys/release.asc',
:before => 'Apt::Source[ceph]',
) }
)}
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-mimic/',
:release => 'jessie',
) }
)}
end
describe "when overriding ceph mirror" do
context 'when overriding ceph mirror' do
let :params do
{
:ceph_mirror => 'http://myserver.com/debian-mimic/'
:ceph_mirror => 'http://myserver.com/debian-mimic/'
}
end
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:location => 'http://myserver.com/debian-mimic/',
:release => 'jessie',
) }
)}
end
describe "when overriding ceph release" do
context 'when overriding ceph release' do
let :params do
{
:release => 'firefly'
:release => 'firefly'
}
end
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-firefly/',
:release => 'jessie',
) }
)}
end
end
describe 'Ubuntu' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistcodename => 'trusty',
:lsbdistrelease => '14.04',
:hardwaremodel => 'x86_64',
}
shared_examples 'ceph::repo on Ubuntu' do
before do
facts.merge!( :osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistcodename => 'trusty',
:lsbdistrelease => '14.04',
:hardwaremodel => 'x86_64' )
end
describe "with default params" do
it { is_expected.to contain_apt__key('ceph').with(
context 'with default params' do
it { should contain_apt__key('ceph').with(
:id => '08B73419AC32B4E966C1A330E84AC2C0460F3994',
:source => 'https://download.ceph.com/keys/release.asc',
:before => 'Apt::Source[ceph]',
) }
)}
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-mimic/',
:release => 'trusty',
) }
)}
end
describe "when overriding ceph release" do
context 'when overriding ceph release' do
let :params do
{
:release => 'firefly'
:release => 'firefly'
}
end
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-firefly/',
:release => 'trusty',
) }
)}
end
describe "when wanting fast-cgi" do
context 'when wanting fast-cgi' do
let :params do
{
:fastcgi => true
:fastcgi => true
}
end
it { is_expected.to contain_apt__key('ceph-gitbuilder').with(
it { should contain_apt__key('ceph-gitbuilder').with(
:id => 'FCC5CB2ED8E6F6FB79D5B3316EAEAE2203C3951A',
:server => 'keyserver.ubuntu.com',
) }
)}
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-mimic/',
:release => 'trusty',
) }
)}
it { is_expected.to contain_apt__source('ceph-fastcgi').with(
it { should contain_apt__source('ceph-fastcgi').with(
:ensure => 'present',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-trusty-x86_64-basic/ref/master',
:release => 'trusty',
:require => 'Apt::Key[ceph-gitbuilder]'
) }
)}
end
describe "with ensure => absent to disable" do
context 'with ensure => absent to disable' do
let :params do
{
:ensure => 'absent',
@ -149,38 +136,32 @@ describe 'ceph::repo' do
}
end
it { is_expected.to contain_apt__source('ceph').with(
it { should contain_apt__source('ceph').with(
:ensure => 'absent',
:location => 'http://download.ceph.com/debian-mimic/',
:release => 'trusty',
) }
)}
it { is_expected.to contain_apt__source('ceph-fastcgi').with(
it { should contain_apt__source('ceph-fastcgi').with(
:ensure => 'absent',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-trusty-x86_64-basic/ref/master',
:release => 'trusty',
:require => 'Apt::Key[ceph-gitbuilder]'
) }
)}
end
end
describe 'RHEL7' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '7',
}
shared_examples 'ceph::repo on RHEL' do
before do
facts.merge!( :osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '7' )
end
describe "with default params" do
context 'with default params' do
it { should_not contain_file_line('exclude base') }
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -190,9 +171,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -201,9 +182,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -212,19 +193,19 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
end
describe "when overriding ceph release" do
context 'when overriding ceph release' do
let :params do
{
:release => 'firefly'
:release => 'firefly'
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { should_not contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -234,9 +215,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph firefly',
:name => 'ext-ceph-firefly',
@ -245,9 +226,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-firefly-noarch',
@ -256,31 +237,31 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
end
describe "when disabling EPEL" do
context 'when disabling EPEL' do
let :params do
{
:enable_epel => false,
:enable_epel => false,
}
end
it { is_expected.to_not contain_yumrepo('ext-epel-7') }
it { should_not contain_yumrepo('ext-epel-7') }
end
describe "when using a proxy for yum repositories" do
context 'when using a proxy for yum repositories' do
let :params do
{
:proxy => 'http://someproxy.com:8080/',
:proxy_username => 'proxyuser',
:proxy_password => 'proxypassword'
:proxy => 'http://someproxy.com:8080/',
:proxy_username => 'proxyuser',
:proxy_password => 'proxypassword'
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { should_not contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -293,9 +274,9 @@ describe 'ceph::repo' do
:proxy => 'http://someproxy.com:8080/',
:proxy_username => 'proxyuser',
:proxy_password => 'proxypassword',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -307,9 +288,9 @@ describe 'ceph::repo' do
:proxy => 'http://someproxy.com:8080/',
:proxy_username => 'proxyuser',
:proxy_password => 'proxypassword',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -321,10 +302,10 @@ describe 'ceph::repo' do
:proxy => 'http://someproxy.com:8080/',
:proxy_username => 'proxyuser',
:proxy_password => 'proxypassword',
) }
)}
end
describe "with ensure => absent to disable" do
context 'with ensure => absent to disable' do
let :params do
{
:ensure => 'absent',
@ -332,9 +313,9 @@ describe 'ceph::repo' do
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { should_not contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '0',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -344,9 +325,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '0',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -355,9 +336,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '0',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -366,9 +347,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
it { should contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '0',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
@ -377,20 +358,19 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
)}
end
describe "with ceph fast-cgi" do
context 'with ceph fast-cgi' do
let :params do
{
:fastcgi => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { should_not contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -400,9 +380,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -411,9 +391,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -422,9 +402,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
it { should contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '1',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
@ -433,26 +413,21 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
)}
end
end
describe 'CentOS7' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemmajrelease => '7',
}
shared_examples 'ceph::repo on CentOS' do
before do
facts.merge!( :osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemmajrelease => '7' )
end
describe "with default params" do
context 'with default params' do
it { should_not contain_file_line('exclude base') }
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -462,9 +437,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -473,9 +448,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -484,24 +459,24 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
end
describe "when overriding ceph release" do
context 'when overriding ceph release' do
let :params do
{
:release => 'firefly'
:release => 'firefly'
}
end
it { is_expected.to contain_file_line('exclude base').with(
it { should contain_file_line('exclude base').with(
:ensure => 'present',
:path => '/etc/yum.repos.d/CentOS-Base.repo',
:after => '^\[base\]$',
:line => 'exclude=python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -511,9 +486,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph firefly',
:name => 'ext-ceph-firefly',
@ -522,9 +497,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-firefly-noarch',
@ -533,45 +508,47 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
end
describe "when using CentOS SIG repository" do
context 'when using CentOS SIG repository' do
let :params do
{
:enable_sig => true,
:enable_sig => true,
}
end
it { is_expected.to_not contain_file_line('exclude base') }
it { is_expected.to_not contain_yumrepo('ext-epel-7') }
it { is_expected.to_not contain_yumrepo('ext-ceph') }
it { is_expected.to_not contain_yumrepo('ext-ceph-noarch') }
it { is_expected.to contain_yumrepo('ceph-luminous-sig').with_ensure('absent') }
it { is_expected.to contain_yumrepo('ceph-storage-sig').with(
it { should_not contain_file_line('exclude base') }
it { should_not contain_yumrepo('ext-epel-7') }
it { should_not contain_yumrepo('ext-ceph') }
it { should_not contain_yumrepo('ext-ceph-noarch') }
it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') }
it { should contain_yumrepo('ceph-storage-sig').with(
:baseurl => 'https://buildlogs.centos.org/centos/7/storage/x86_64/ceph-mimic/',
) }
)}
end
describe "when using CentOS SIG repository from a mirror" do
context 'when using CentOS SIG repository from a mirror' do
let :params do
{
:enable_sig => true,
:ceph_mirror => 'https://mymirror/luminous/',
:enable_sig => true,
:ceph_mirror => 'https://mymirror/luminous/',
}
end
it { is_expected.to_not contain_file_line('exclude base') }
it { is_expected.to_not contain_yumrepo('ext-epel-7') }
it { is_expected.to_not contain_yumrepo('ext-ceph') }
it { is_expected.to_not contain_yumrepo('ext-ceph-noarch') }
it { is_expected.to contain_yumrepo('ceph-luminous-sig').with_ensure('absent') }
it { is_expected.to contain_yumrepo('ceph-storage-sig').with(
it { should_not contain_file_line('exclude base') }
it { should_not contain_yumrepo('ext-epel-7') }
it { should_not contain_yumrepo('ext-ceph') }
it { should_not contain_yumrepo('ext-ceph-noarch') }
it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') }
it { should contain_yumrepo('ceph-storage-sig').with(
:baseurl => 'https://mymirror/luminous/',
) }
)}
end
describe "with ensure => absent to disable" do
context 'with ensure => absent to disable' do
let :params do
{
:ensure => 'absent',
@ -579,9 +556,9 @@ describe 'ceph::repo' do
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { should_not contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '0',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -591,9 +568,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '0',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -602,9 +579,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '0',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -613,9 +590,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
it { should contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '0',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
@ -624,20 +601,19 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
)}
end
describe "with ceph fast-cgi" do
context 'with ceph fast-cgi' do
let :params do
{
:fastcgi => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { should_not contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-7').with(
it { should contain_yumrepo('ext-epel-7').with(
:enabled => '1',
:descr => 'External EPEL 7',
:name => 'ext-epel-7',
@ -647,9 +623,9 @@ describe 'ceph::repo' do
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph').with(
it { should contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph mimic',
:name => 'ext-ceph-mimic',
@ -658,9 +634,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
it { should contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-mimic-noarch',
@ -669,9 +645,9 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
)}
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
it { should contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '1',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
@ -680,9 +656,23 @@ describe 'ceph::repo' do
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
)}
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 "ceph::repo on #{facts[:operatingsystem]}"
if facts[:operatingsystem] == 'CentOS'
it_behaves_like 'ceph::repo on RHEL'
end
end
end
end

View File

@ -16,8 +16,7 @@
require 'spec_helper'
describe 'ceph::fs' do
shared_examples_for 'ceph fs' do
shared_examples 'ceph fs' do
describe "activated with custom params" do
let :title do
'fsa'
@ -30,7 +29,7 @@ describe 'ceph::fs' do
}
end
it { is_expected.to contain_exec('create-fs-fsa').with(
it { should contain_exec('create-fs-fsa').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph fs new fsa metadata_pool data_pool",
:unless => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph fs ls | grep 'name: fsa,'"
)}
@ -48,5 +47,4 @@ describe 'ceph::fs' do
it_behaves_like 'ceph fs'
end
end
end

View File

@ -19,14 +19,12 @@
require 'spec_helper'
describe 'ceph::key' do
let (:pre_condition) do
"class { '::ceph': fsid => 'foo' }"
end
shared_examples_for 'ceph key' do
shared_examples 'ceph key' do
describe "with custom params" do
let :title do
'client.admin'
end
@ -44,20 +42,19 @@ describe 'ceph::key' do
end
it {
is_expected.to contain_exec('ceph-key-client.admin').with(
should contain_exec('ceph-key-client.admin').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph-authtool /etc/ceph/ceph.client.admin.keyring --name 'client.admin' --add-key 'supersecret' --cap mon 'allow *' --cap osd 'allow rw' --cap mgr 'allow *' "
)
is_expected.to contain_file('/etc/ceph/ceph.client.admin.keyring').with(
should contain_file('/etc/ceph/ceph.client.admin.keyring').with(
'owner' => 'nobody',
'group' => 'nogroup',
'mode' => '0600',
'selinux_ignore_defaults' => true,
)
is_expected.to contain_exec('ceph-injectkey-client.admin').with(
should contain_exec('ceph-injectkey-client.admin').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph auth import -i /etc/ceph/ceph.client.admin.keyring"
)
}
end
end
@ -73,10 +70,3 @@ describe 'ceph::key' do
end
end
end
# Local Variables:
# compile-command: "cd ../.. ;
# bundle install ;
# bundle exec rake spec
# "
# End:

View File

@ -19,61 +19,65 @@ require 'spec_helper'
describe 'ceph::mgr' do
let (:title) { 'foo' }
describe 'with cephx configured but no key specified' do
let :params do
{
:authentication_type => 'cephx'
}
shared_examples 'ceph::mgr' do
context 'with cephx configured but no key specified' do
let :params do
{
:authentication_type => 'cephx'
}
end
it { should raise_error(Puppet::Error, /cephx requires a specified key for the manager daemon/) }
end
it {
is_expected.to raise_error(Puppet::Error, /cephx requires a specified key for the manager daemon/)
}
end
context 'cephx authentication_type' do
let :params do
{
:authentication_type => 'cephx',
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
}
end
describe 'cephx authentication_type' do
let :params do
{
:authentication_type => 'cephx',
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
}
end
it {
is_expected.to contain_file('/var/lib/ceph/mgr').with(
it { should contain_file('/var/lib/ceph/mgr').with(
:ensure => 'directory',
:owner => 'ceph',
:group => 'ceph'
)
}
)}
it {
is_expected.to contain_file('/var/lib/ceph/mgr/ceph-foo').with(
it { should contain_file('/var/lib/ceph/mgr/ceph-foo').with(
:ensure => 'directory',
:owner => 'ceph',
:group => 'ceph'
)
}
)}
it {
is_expected.to contain_ceph__key('mgr.foo').with(
it { should contain_ceph__key('mgr.foo').with(
:secret => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
:cluster => 'ceph',
:keyring_path => "/var/lib/ceph/mgr/ceph-foo/keyring",
:keyring_path => '/var/lib/ceph/mgr/ceph-foo/keyring',
:cap_mon => 'allow profile mgr',
:cap_osd => 'allow *',
:cap_mds => 'allow *',
:user => 'ceph',
:group => 'ceph',
:inject => false,
)
}
)}
it {
is_expected.to contain_service('ceph-mgr@foo').with(
it { should contain_service('ceph-mgr@foo').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
it_behaves_like 'ceph::mgr'
end
end
end

View File

@ -21,33 +21,23 @@
require 'spec_helper'
describe 'ceph::mon' do
context 'Ubuntu 14.04' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:service_provider => 'upstart',
}
shared_examples 'ceph::mon on Ubuntu 14.04' do
before do
facts.merge!( :osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:service_provider => 'upstart' )
end
describe 'with default params' do
context 'with default params' do
let :title do
'A'
end
it {
expect {
is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running')
}.to raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/)
}
it { should raise raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/) }
end
describe 'with key' do
context 'with key' do
let :title do
'A'
end
@ -58,9 +48,10 @@ describe 'ceph::mon' do
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_exec('create-keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_exec('create-keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
cat > /tmp/ceph-mon-keyring-A << EOF
[mon.]
@ -70,19 +61,21 @@ EOF
chmod 0444 /tmp/ceph-mon-keyring-A
',
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
:unless => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1
# if ceph-mon fails then the mon is probably not configured yet
test -e $mon_data/done
') }
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -111,12 +104,12 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
it { is_expected.to contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') }
:logoutput => true )}
it { should contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') }
end
describe 'with keyring' do
context 'with keyring' do
let :title do
'A'
end
@ -127,14 +120,16 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -163,11 +158,10 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
:logoutput => true )}
end
describe 'with custom params' do
context 'with custom params' do
let :title do
'A'
end
@ -180,15 +174,17 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { is_expected.to contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { should contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/testcluster.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -217,11 +213,10 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
:logoutput => true )}
end
describe 'with ensure absent' do
context 'with ensure absent' do
let :title do
'A'
end
@ -235,49 +230,41 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'stopped') }
it { is_expected.to contain_exec('remove-mon-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'stopped') }
it { should contain_exec('remove-mon-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
rm -fr \$mon_data
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
:unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
which ceph-mon || exit 0 # if ceph-mon is not available we already uninstalled ceph and there is nothing to do
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
test ! -d \$mon_data
",
'logoutput' => true) }
:logoutput => true )}
end
end
context 'Ubuntu 16.04' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd',
}
shared_examples 'ceph::mon on Ubuntu 16.04' do
before do
facts.merge!( :osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd' )
end
describe 'with default params' do
context 'with default params' do
let :title do
'A'
end
it {
expect {
is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running')
}.to raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/)
}
it { should raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/) }
end
describe 'with key' do
context 'with key' do
let :title do
'A'
end
@ -288,9 +275,10 @@ test ! -d \$mon_data
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_exec('create-keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_exec('create-keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
cat > /tmp/ceph-mon-keyring-A << EOF
[mon.]
@ -300,19 +288,21 @@ EOF
chmod 0444 /tmp/ceph-mon-keyring-A
',
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
:unless => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1
# if ceph-mon fails then the mon is probably not configured yet
test -e $mon_data/done
') }
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
')}
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -341,12 +331,12 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
it { is_expected.to contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') }
:logoutput => true )}
it { should contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') }
end
describe 'with keyring' do
context 'with keyring' do
let :title do
'A'
end
@ -357,14 +347,16 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -393,11 +385,10 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
:logoutput => true )}
end
describe 'with custom params' do
context 'with custom params' do
let :title do
'A'
end
@ -410,15 +401,17 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { is_expected.to contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { should contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/testcluster.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -447,11 +440,10 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
:logoutput => true )}
end
describe 'with ensure absent' do
context 'with ensure absent' do
let :title do
'A'
end
@ -465,48 +457,40 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'stopped') }
it { is_expected.to contain_exec('remove-mon-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'stopped') }
it { should contain_exec('remove-mon-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
rm -fr \$mon_data
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
:unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
which ceph-mon || exit 0 # if ceph-mon is not available we already uninstalled ceph and there is nothing to do
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
test ! -d \$mon_data
",
'logoutput' => true) }
:logoutput => true )}
end
end
context 'RHEL7' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RHEL7',
:service_provider => 'systemd',
}
shared_examples 'ceph::mon on RHEL7' do
before do
facts.merge!( :osfamily => 'RedHat',
:operatingsystem => 'RHEL7',
:service_provider => 'systemd' )
end
describe 'with default params' do
context 'with default params' do
let :title do
'A'
end
it {
expect {
is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running')
}.to raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/)
}
it { should raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/) }
end
describe 'with key' do
context 'with key' do
let :title do
'A'
end
@ -517,9 +501,10 @@ test ! -d \$mon_data
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_exec('create-keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_exec('create-keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
cat > /tmp/ceph-mon-keyring-A << EOF
[mon.]
@ -529,22 +514,24 @@ EOF
chmod 0444 /tmp/ceph-mon-keyring-A
',
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
:unless => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1
# if ceph-mon fails then the mon is probably not configured yet
test -e $mon_data/done
') }
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
')}
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring',
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
:unless => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
test -e /etc/ceph/ceph.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -573,17 +560,17 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
it { is_expected.to contain_exec('rm-keyring-A').with(
'command' => '/bin/rm /tmp/ceph-mon-keyring-A',
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
:logoutput => true )}
it { should contain_exec('rm-keyring-A').with(
:command => '/bin/rm /tmp/ceph-mon-keyring-A',
:unless => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
test ! -e /tmp/ceph-mon-keyring-A
') }
')}
end
describe 'with keyring' do
context 'with keyring' do
let :title do
'A'
end
@ -594,14 +581,16 @@ test ! -e /tmp/ceph-mon-keyring-A
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -630,11 +619,10 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
:logoutput => true )}
end
describe 'with custom params' do
context 'with custom params' do
let :title do
'A'
end
@ -647,15 +635,17 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { is_expected.to contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'running') }
it { should contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { should contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
:command => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/testcluster.client.admin.keyring'
) }
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
)}
it { should contain_exec('ceph-mon-mkfs-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
@ -684,11 +674,10 @@ if [ ! -d \$mon_data ] ; then
fi
fi
",
'logoutput' => true) }
:logoutput => true )}
end
describe 'with ensure absent' do
context 'with ensure absent' do
let :title do
'A'
end
@ -702,24 +691,24 @@ fi
}
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'stopped') }
it { is_expected.to contain_exec('remove-mon-A').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_service('ceph-mon-A').with('ensure' => 'stopped') }
it { should contain_exec('remove-mon-A').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
rm -fr \$mon_data
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
:unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
which ceph-mon || exit 0 # if ceph-mon is not available we already uninstalled ceph and there is nothing to do
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
test ! -d \$mon_data
",
'logoutput' => true) }
:logoutput => true )}
end
describe "with ensure set with bad value" do
context 'with ensure set with bad value' do
let :title do
'A'
end
@ -730,15 +719,24 @@ test ! -d \$mon_data
}
end
it { is_expected.to raise_error(Puppet::Error, /Ensure on MON must be either present or absent/) }
it { should raise_error(Puppet::Error, /Ensure on MON must be either present or 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
# if facts[:operatingsystem] == 'Ubuntu'
# it_behaves_like 'ceph::mon on Ubuntu 14.04'
# it_behaves_like 'ceph::mon on Ubuntu 16.04'
# elsif facts[:operatingsystem] == 'CentOS'
# it_behaves_like 'ceph::mon on RHEL7'
# end
end
end
end
# Local Variables:
# compile-command: "cd ../.. ;
# export BUNDLE_PATH=/tmp/vendor ;
# bundle install ;
# bundle exec rake spec
# "
# End:

View File

@ -20,16 +20,13 @@
require 'spec_helper'
describe 'ceph::osd' do
shared_examples_for 'ceph osd' do
shared_examples 'ceph osd' do
describe "with default params" do
let :title do
'/srv'
end
it { is_expected.to contain_exec('ceph-osd-check-udev-/srv').with(
it { should contain_exec('ceph-osd-check-udev-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
# Before Infernalis the udev rules race causing the activation to fail so we
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
@ -42,7 +39,7 @@ test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
",
'logoutput' => true,
) }
it { is_expected.to contain_exec('ceph-osd-prepare-/srv').with(
it { should contain_exec('ceph-osd-prepare-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /srv)
@ -64,7 +61,7 @@ ceph-disk list | egrep \" *(${disk}1?|${disk}p1?) .*ceph data, (prepared|active)
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-activate-/srv').with(
it { should contain_exec('ceph-osd-activate-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /srv)
@ -93,7 +90,6 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /srv)\$\"
end
describe "with custom params" do
let :title do
'/srv/data'
end
@ -106,7 +102,7 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /srv)\$\"
}
end
it { is_expected.to contain_exec('ceph-osd-check-udev-/srv/data').with(
it { should contain_exec('ceph-osd-check-udev-/srv/data').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
# Before Infernalis the udev rules race causing the activation to fail so we
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
@ -119,7 +115,7 @@ test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
",
'logoutput' => true,
) }
it { is_expected.to contain_exec('ceph-osd-check-fsid-mismatch-/srv/data').with(
it { should contain_exec('ceph-osd-check-fsid-mismatch-/srv/data').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
test f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 = $(ceph-disk list $(readlink -f /srv/data) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
@ -130,7 +126,7 @@ test -z $(ceph-disk list $(readlink -f /srv/data) | egrep -o '[0-9a-f]{8}-([0-9a
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-prepare-/srv/data').with(
it { should contain_exec('ceph-osd-prepare-/srv/data').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /srv/data)
@ -152,7 +148,7 @@ ceph-disk list | egrep \" *(${disk}1?|${disk}p1?) .*ceph data, (prepared|active)
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-activate-/srv/data').with(
it { should contain_exec('ceph-osd-activate-/srv/data').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /srv/data)
@ -186,7 +182,7 @@ ls -ld /var/lib/ceph/osd/testcluster-* | grep \" $(readlink -f /srv/data)\$\"
'/dev/nvme0n1'
end
it { is_expected.to contain_exec('ceph-osd-check-udev-/dev/nvme0n1').with(
it { should contain_exec('ceph-osd-check-udev-/dev/nvme0n1').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
# Before Infernalis the udev rules race causing the activation to fail so we
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
@ -199,7 +195,7 @@ test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
",
'logoutput' => true,
) }
it { is_expected.to contain_exec('ceph-osd-prepare-/dev/nvme0n1').with(
it { should contain_exec('ceph-osd-prepare-/dev/nvme0n1').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /dev/nvme0n1)
@ -221,7 +217,7 @@ ceph-disk list | egrep \" *(${disk}1?|${disk}p1?) .*ceph data, (prepared|active)
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-activate-/dev/nvme0n1').with(
it { should contain_exec('ceph-osd-activate-/dev/nvme0n1').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /dev/nvme0n1)
@ -255,7 +251,7 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/nvme0n1)\$\"
'/dev/cciss/c0d0'
end
it { is_expected.to contain_exec('ceph-osd-check-udev-/dev/cciss/c0d0').with(
it { should contain_exec('ceph-osd-check-udev-/dev/cciss/c0d0').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
# Before Infernalis the udev rules race causing the activation to fail so we
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
@ -268,7 +264,7 @@ test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
",
'logoutput' => true,
) }
it { is_expected.to contain_exec('ceph-osd-prepare-/dev/cciss/c0d0').with(
it { should contain_exec('ceph-osd-prepare-/dev/cciss/c0d0').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /dev/cciss/c0d0)
@ -290,7 +286,7 @@ ceph-disk list | egrep \" *(${disk}1?|${disk}p1?) .*ceph data, (prepared|active)
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-activate-/dev/cciss/c0d0').with(
it { should contain_exec('ceph-osd-activate-/dev/cciss/c0d0').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /dev/cciss/c0d0)
@ -330,7 +326,7 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/cciss/c0d0)\$\"
}
end
it { is_expected.to contain_exec('remove-osd-/srv').with(
it { should contain_exec('remove-osd-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f /srv)
@ -372,7 +368,6 @@ fi
end
describe "with ensure set to bad value" do
let :title do
'/srv'
end
@ -383,7 +378,7 @@ fi
}
end
it { is_expected.to raise_error(Puppet::Error, /Ensure on OSD must be either present or absent/) }
it { should raise_error(Puppet::Error, /Ensure on OSD must be either present or absent/) }
end
end
@ -399,10 +394,3 @@ fi
end
end
end
# Local Variables:
# compile-command: "cd ../.. ;
# bundle install ;
# bundle exec rake spec
# "
# End:

View File

@ -19,10 +19,8 @@
require 'spec_helper'
describe 'ceph::pool' do
shared_examples_for 'ceph pool' do
shared_examples 'ceph pool' do
describe "create with custom params" do
let :title do
'volumes'
end
@ -38,28 +36,26 @@ describe 'ceph::pool' do
end
it {
is_expected.to contain_exec('create-volumes').with(
should contain_exec('create-volumes').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool create volumes 3"
)
is_expected.to contain_exec('set-volumes-pg_num').with(
should contain_exec('set-volumes-pg_num').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes pg_num 3"
)
is_expected.to contain_exec('set-volumes-pgp_num').with(
should contain_exec('set-volumes-pgp_num').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes pgp_num 4"
).that_requires('Exec[set-volumes-pg_num]')
is_expected.to contain_exec('set-volumes-size').with(
should contain_exec('set-volumes-size').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes size 2"
)
is_expected.to contain_exec('set-volumes-tag').with(
should contain_exec('set-volumes-tag').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool application enable volumes rbd"
)
is_expected.not_to contain_exec('delete-volumes')
should_not contain_exec('delete-volumes')
}
end
describe "delete with custom params" do
let :title do
'volumes'
end
@ -71,12 +67,11 @@ describe 'ceph::pool' do
end
it {
is_expected.not_to contain_exec('create-volumes')
is_expected.to contain_exec('delete-volumes').with(
should_not contain_exec('create-volumes')
should contain_exec('delete-volumes').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool delete volumes volumes --yes-i-really-really-mean-it"
)
}
end
end
@ -92,10 +87,3 @@ describe 'ceph::pool' do
end
end
end
# Local Variables:
# compile-command: "cd ../.. ;
# bundle install ;
# bundle exec rake spec
# "
# End:

View File

@ -17,48 +17,48 @@
require 'spec_helper'
describe 'ceph::mirror' do
context 'Ubuntu 16.04' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd',
}
shared_examples 'ceph::mirror on Debian' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd' )
end
describe 'with default params' do
context 'with default params' do
let :title do
'A'
end
it { is_expected.to contain_service('ceph-rbd-mirror@A').with('ensure' => 'running') }
it { should contain_service('ceph-rbd-mirror@A').with('ensure' => 'running') }
end
end
context 'RHEL 7' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
:service_provider => 'systemd',
}
shared_examples 'ceph::mirror on RedHat' do
before do
facts.merge!( :operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
:service_provider => 'systemd' )
end
describe 'with default params' do
context 'with default params' do
let :title do
'A'
end
it { is_expected.to contain_service('ceph-rbd-mirror@A').with('ensure' => 'running') }
it { should contain_service('ceph-rbd-mirror@A').with('ensure' => 'running') }
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 "ceph::mirror on #{facts[:osfamily]}"
end
end
end

View File

@ -20,57 +20,47 @@
require 'spec_helper'
describe 'ceph::rgw::apache_proxy_fcgi' do
describe 'Debian Family' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:operatingsystemrelease => '14.04',
:lsbdistcodename => 'trusty',
}
shared_examples 'ceph::rgw::apache_proxy_fcgi on Debian' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:operatingsystemrelease => '14.04',
:lsbdistcodename => 'trusty' )
end
describe 'activated with default params' do
context 'activated with default params' do
let :title do
'radosgw.gateway'
end
it { is_expected.to contain_apache__vhost('myhost.domain-radosgw').with( {
'servername' => 'myhost.domain',
'serveradmin' => 'root@localhost',
'port' => 80,
'docroot' => '/var/www',
'access_log' => true,
'error_log' => true,
'rewrite_rule' => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
'setenv' => 'proxy-nokeepalive 1',
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
})}
it { is_expected.to contain_class('apache').with(
'default_mods' => false,
'default_vhost' => false,
'purge_configs' => true,
'purge_vhost_dir' => true,
it { should contain_apache__vhost('myhost.domain-radosgw').with(
:servername => 'myhost.domain',
:serveradmin => 'root@localhost',
:port => 80,
:docroot => '/var/www',
:access_log => true,
:error_log => true,
:rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
:setenv => 'proxy-nokeepalive 1',
:proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
)}
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::env') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }
it { should contain_class('apache').with(
:default_mods => false,
:default_vhost => false,
:purge_configs => true,
:purge_vhost_dir => true,
)}
it { should contain_class('apache::mod::alias') }
it { should contain_class('apache::mod::auth_basic') }
it { should contain_class('apache::mod::env') }
it { should contain_class('apache::mod::proxy') }
it { should contain_class('apache::mod::mime') }
it { should contain_class('apache::mod::rewrite') }
end
describe "activated with custom params" do
context 'activated with custom params' do
let :title do
'myid'
end
@ -90,82 +80,74 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
}
end
it { is_expected.to contain_class('apache').with(
'default_mods' => true,
'default_vhost' => true,
'purge_configs' => false,
'purge_vhost_dir' => false,
it { should contain_class('apache').with(
:default_mods => true,
:default_vhost => true,
:purge_configs => false,
:purge_vhost_dir => false,
)}
it { is_expected.to contain_apache__listen('8888') }
it { is_expected.to contain_apache__vhost('mydns.hostname-radosgw').with( {
'servername' => 'mydns.hostname',
'serveradmin' => 'admin@hostname',
'port' => 1111,
'docroot' => '/var/www',
'access_log' => false,
'error_log' => false,
'rewrite_rule' => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
'setenv' => 'proxy-nokeepalive 1',
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
} ) }
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }
it { should contain_apache__listen('8888') }
it { should contain_apache__vhost('mydns.hostname-radosgw').with(
:servername => 'mydns.hostname',
:serveradmin => 'admin@hostname',
:port => 1111,
:docroot => '/var/www',
:access_log => false,
:error_log => false,
:rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
:setenv => 'proxy-nokeepalive 1',
:proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
)}
it { should contain_class('apache::mod::alias') }
it { should contain_class('apache::mod::proxy') }
it { should contain_class('apache::mod::mime') }
it { should contain_class('apache::mod::rewrite') }
end
end
describe 'RedHat Family' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
}
shared_examples 'ceph::rgw::apache_proxy_fcgi on RedHat' do
before do
facts.merge!( :operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7' )
end
describe 'activated with default params' do
context 'activated with default params' do
let :title do
'radosgw.gateway'
end
it { is_expected.to contain_apache__vhost('myhost.domain-radosgw').with( {
'servername' => 'myhost.domain',
'serveradmin' => 'root@localhost',
'port' => 80,
'docroot' => '/var/www',
'access_log' => true,
'error_log' => true,
'rewrite_rule' => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
'setenv' => 'proxy-nokeepalive 1',
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
})}
it { is_expected.to contain_class('apache').with(
'default_mods' => false,
'default_vhost' => false,
'purge_configs' => true,
'purge_vhost_dir' => true,
it { should contain_apache__vhost('myhost.domain-radosgw').with(
:servername => 'myhost.domain',
:serveradmin => 'root@localhost',
:port => 80,
:docroot => '/var/www',
:access_log => true,
:error_log => true,
:rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
:setenv => 'proxy-nokeepalive 1',
:proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
)}
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::env') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }
it { should contain_class('apache').with(
:default_mods => false,
:default_vhost => false,
:purge_configs => true,
:purge_vhost_dir => true,
)}
it { should contain_class('apache::mod::alias') }
it { should contain_class('apache::mod::auth_basic') }
it { should contain_class('apache::mod::env') }
it { should contain_class('apache::mod::proxy') }
it { should contain_class('apache::mod::mime') }
it { should contain_class('apache::mod::rewrite') }
end
describe "activated with custom params" do
context 'activated with custom params' do
let :title do
'myid'
end
@ -185,31 +167,45 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
}
end
it { is_expected.to contain_class('apache').with(
'default_mods' => true,
'default_vhost' => true,
'purge_configs' => false,
'purge_vhost_dir' => false,
it { should contain_class('apache').with(
:default_mods => true,
:default_vhost => true,
:purge_configs => false,
:purge_vhost_dir => false,
)}
it { is_expected.to contain_apache__listen('8888') }
it { is_expected.to contain_apache__vhost('mydns.hostname-radosgw').with( {
'servername' => 'mydns.hostname',
'serveradmin' => 'admin@hostname',
'port' => 1111,
'docroot' => '/var/www',
'access_log' => false,
'error_log' => false,
'rewrite_rule' => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
'setenv' => 'proxy-nokeepalive 1',
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
} ) }
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }
it { should contain_apache__listen('8888') }
it { should contain_apache__vhost('mydns.hostname-radosgw').with(
:servername => 'mydns.hostname',
:serveradmin => 'admin@hostname',
:port => 1111,
:docroot => '/var/www',
:access_log => false,
:error_log => false,
:rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
:setenv => 'proxy-nokeepalive 1',
:proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
)}
it { should contain_class('apache::mod::alias') }
it { should contain_class('apache::mod::proxy') }
it { should contain_class('apache::mod::mime') }
it { should contain_class('apache::mod::rewrite') }
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',
:fqdn => 'myhost.domain',
:hostname => 'myhost' ))
end
it_behaves_like "ceph::rgw::apache_proxy_fcgi on #{facts[:osfamily]}"
end
end
end

View File

@ -18,33 +18,34 @@
require 'spec_helper'
describe 'ceph::rgw' do
let :pre_condition do
'include ceph::params'
end
shared_examples_for 'ceph rgw civetweb' do
shared_examples 'ceph rgw civetweb' do
describe "activated with civetweb params" do
let :title do
'radosgw.civetweb'
end
let :params do
{
:frontend_type => 'civetweb',
}
end
it { is_expected.to contain_ceph_config('client.radosgw.civetweb/user').with_value("#{platform_params[:user]}") }
it { is_expected.to contain_ceph_config('client.radosgw.civetweb/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.civetweb/keyring').with_value('/etc/ceph/ceph.client.radosgw.civetweb.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.civetweb/log_file').with_value('/var/log/ceph/radosgw.log') }
it { is_expected.to contain_ceph_config('client.radosgw.civetweb/rgw_frontends').with_value('civetweb port=7480') }
it { should contain_ceph_config('client.radosgw.civetweb/user').with_value("#{platform_params[:user]}") }
it { should contain_ceph_config('client.radosgw.civetweb/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.civetweb/keyring').with_value('/etc/ceph/ceph.client.radosgw.civetweb.keyring') }
it { should contain_ceph_config('client.radosgw.civetweb/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_ceph_config('client.radosgw.civetweb/rgw_frontends').with_value('civetweb port=7480') }
end
describe "activated with custom civetweb params" do
let :title do
'radosgw.custom'
end
let :params do
{
:frontend_type => 'civetweb',
@ -52,13 +53,13 @@ describe 'ceph::rgw' do
:user => 'root',
}
end
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_frontends').with_value('civetweb port=7481') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/user').with_value('root') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') }
end
it { should contain_ceph_config('client.radosgw.custom/rgw_frontends').with_value('civetweb port=7481') }
it { should contain_ceph_config('client.radosgw.custom/user').with_value('root') }
it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') }
it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') }
end
end
on_supported_os({
@ -91,5 +92,4 @@ describe 'ceph::rgw' do
it_behaves_like 'ceph rgw civetweb'
end
end
end

View File

@ -19,34 +19,23 @@
require 'spec_helper'
describe 'ceph::rgw::keystone' do
describe 'Debian Family' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:lsbdistid => 'Ubuntu',
:lsbdistcodename => 'trusty',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:lsbdistrelease => '14.04',
}
shared_examples 'ceph::rgw::keystone on Debian' do
before do
facts.merge!( :lsbdistid => 'Ubuntu',
:lsbdistcodename => 'trusty',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:lsbdistrelease => '14.04' )
end
describe "create with default params" do
context 'create with default params' do
let :pre_condition do
"
include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
class { 'ceph::repo': fastcgi => true, }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_fastcgi { 'radosgw.gateway': }
"
"include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
class { 'ceph::repo': fastcgi => true, }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_fastcgi { 'radosgw.gateway': }"
end
let :title do
@ -60,44 +49,40 @@ describe 'ceph::rgw::keystone' do
}
end
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_value('defaulttoken') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_accepted_roles').with_value('Member') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_token_cache_size').with_value(500) }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_s3_auth_use_keystone').with_value(true) }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_revocation_interval').with_value(600) }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/nss_db_path').with_value('/var/lib/ceph/nss') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_implicit_tenants').with_value(true) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_value('defaulttoken') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_accepted_roles').with_value('Member') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_token_cache_size').with_value(500) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_s3_auth_use_keystone').with_value(true) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_revocation_interval').with_value(600) }
it { should contain_ceph_config('client.radosgw.gateway/nss_db_path').with_value('/var/lib/ceph/nss') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_implicit_tenants').with_value(true) }
it { is_expected.to contain_exec('radosgw.gateway-nssdb-ca').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_exec('radosgw.gateway-nssdb-ca').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/ca -O - |
openssl x509 -pubkey | certutil -A -d /var/lib/ceph/nss -n ca -t \"TCu,Cu,Tuw\"
",
'user' => 'www-data',
:user => 'www-data',
) }
it { is_expected.to contain_exec('radosgw.gateway-nssdb-signing').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_exec('radosgw.gateway-nssdb-signing').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/signing -O - |
openssl x509 -pubkey | certutil -A -d /var/lib/ceph/nss -n signing_cert -t \"P,P,P\"
",
'user' => 'www-data',
) }
:user => 'www-data',
)}
end
describe "create with custom params" do
context 'create with custom params' do
let :pre_condition do
"
include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
class { 'ceph::repo': fastcgi => true, }
ceph::rgw { 'radosgw.custom': }
ceph::rgw::apache_fastcgi { 'radosgw.custom': }
"
"include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
class { 'ceph::repo': fastcgi => true, }
ceph::rgw { 'radosgw.custom': }
ceph::rgw::apache_fastcgi { 'radosgw.custom': }"
end
let :title do
@ -118,45 +103,42 @@ wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/signi
}
end
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_url').with_value('http://keystone.custom:5000') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_token').with_value('mytoken') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_accepted_roles').with_value('_role1_,role2') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_token_cache_size').with_value(100) }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_s3_auth_use_keystone').with_value(false) }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_revocation_interval').with_value(0) }
it { is_expected.to contain_ceph_config('client.radosgw.custom/nss_db_path').with_ensure('absent') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_implicit_tenants').with_value(false) }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_url').with_value('http://keystone.custom:5000') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_token').with_value('mytoken') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_accepted_roles').with_value('_role1_,role2') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_token_cache_size').with_value(100) }
it { should contain_ceph_config('client.radosgw.custom/rgw_s3_auth_use_keystone').with_value(false) }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_revocation_interval').with_value(0) }
it { should contain_ceph_config('client.radosgw.custom/nss_db_path').with_ensure('absent') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_implicit_tenants').with_value(false) }
it { is_expected.to_not contain_exec('radosgw.custom-nssdb-ca').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should_not contain_exec('radosgw.custom-nssdb-ca').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/ca -O - |
openssl x509 -pubkey | certutil -A -d /some/path/to/nss -n ca -t \"TCu,Cu,Tuw\"
",
'user' => 'www-data',
:user => 'www-data',
) }
it { is_expected.to_not contain_exec('radosgw.custom-nssdb-signing').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should_not contain_exec('radosgw.custom-nssdb-signing').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/signing -O - |
openssl x509 -pubkey | certutil -A -d /some/path/to/nss -n signing_cert -t \"P,P,P\"
",
'user' => 'www-data',
) }
:user => 'www-data',
)}
end
describe "create with keystone v3 and no pki params" do
context 'create with keystone v3 and no pki params' do
let :pre_condition do
"
include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
class { 'ceph::repo': fastcgi => true, }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_fastcgi { 'radosgw.gateway': }
"
"include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
class { 'ceph::repo': fastcgi => true, }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_fastcgi { 'radosgw.gateway': }"
end
let :title do
@ -174,42 +156,31 @@ wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/signin
}
end
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_domain').with_value('default') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_project').with_value('openstack') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_user').with_value('rgwuser') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_password').with_value('123456') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_ensure('absent') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_domain').with_value('default') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_project').with_value('openstack') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_user').with_value('rgwuser') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_password').with_value('123456') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_ensure('absent') }
end
end
describe 'RedHat Family' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:lsbdistcodename => 'Maipo',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
}
shared_examples 'ceph::rgw::keystone on RedHat' do
before do
facts.merge!( :lsbdistcodename => 'Maipo',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7' )
end
describe "create with default params" do
context 'create with default params' do
let :pre_condition do
"
include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_proxy_fcgi { 'radosgw.gateway': }
"
"include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_proxy_fcgi { 'radosgw.gateway': }"
end
let :title do
@ -223,43 +194,40 @@ wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/signin
}
end
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_value('defaulttoken') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_accepted_roles').with_value('Member') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_token_cache_size').with_value(500) }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_s3_auth_use_keystone').with_value(true) }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_revocation_interval').with_value(600) }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/nss_db_path').with_value('/var/lib/ceph/nss') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_implicit_tenants').with_value(true) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_value('defaulttoken') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_accepted_roles').with_value('Member') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_token_cache_size').with_value(500) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_s3_auth_use_keystone').with_value(true) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_revocation_interval').with_value(600) }
it { should contain_ceph_config('client.radosgw.gateway/nss_db_path').with_value('/var/lib/ceph/nss') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_implicit_tenants').with_value(true) }
it { is_expected.to contain_exec('radosgw.gateway-nssdb-ca').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_exec('radosgw.gateway-nssdb-ca').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/ca -O - |
openssl x509 -pubkey | certutil -A -d /var/lib/ceph/nss -n ca -t \"TCu,Cu,Tuw\"
",
'user' => 'apache',
:user => 'apache',
) }
it { is_expected.to contain_exec('radosgw.gateway-nssdb-signing').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should contain_exec('radosgw.gateway-nssdb-signing').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/signing -O - |
openssl x509 -pubkey | certutil -A -d /var/lib/ceph/nss -n signing_cert -t \"P,P,P\"
",
'user' => 'apache',
:user => 'apache',
) }
end
describe "create with custom params" do
context 'create with custom params' do
let :pre_condition do
"
include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
ceph::rgw { 'radosgw.custom': }
ceph::rgw::apache_proxy_fcgi { 'radosgw.gateway': }
"
"include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
ceph::rgw { 'radosgw.custom': }
ceph::rgw::apache_proxy_fcgi { 'radosgw.gateway': }"
end
let :title do
@ -280,44 +248,41 @@ wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/signi
}
end
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_url').with_value('http://keystone.custom:5000') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_token').with_value('mytoken') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_accepted_roles').with_value('_role1_,role2') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_token_cache_size').with_value(100) }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_s3_auth_use_keystone').with_value(false) }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_revocation_interval').with_value(0) }
it { is_expected.to contain_ceph_config('client.radosgw.custom/nss_db_path').with_ensure('absent') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_keystone_implicit_tenants').with_value(false) }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_url').with_value('http://keystone.custom:5000') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_token').with_value('mytoken') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_accepted_roles').with_value('_role1_,role2') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_token_cache_size').with_value(100) }
it { should contain_ceph_config('client.radosgw.custom/rgw_s3_auth_use_keystone').with_value(false) }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_revocation_interval').with_value(0) }
it { should contain_ceph_config('client.radosgw.custom/nss_db_path').with_ensure('absent') }
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_implicit_tenants').with_value(false) }
it { is_expected.to_not contain_exec('radosgw.custom-nssdb-ca').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
it { should_not contain_exec('radosgw.custom-nssdb-ca').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/ca -O - |
openssl x509 -pubkey | certutil -A -d /some/path/to/nss -n ca -t \"TCu,Cu,Tuw\"
",
'user' => 'apache',
) }
it { is_expected.to_not contain_exec('radosgw.custom-nssdb-signing').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
:user => 'apache',
)}
it { should_not contain_exec('radosgw.custom-nssdb-signing').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/signing -O - |
openssl x509 -pubkey | certutil -A -d /some/path/to/nss -n signing_cert -t \"P,P,P\"
",
'user' => 'apache',
) }
:user => 'apache',
)}
end
describe "create with keystone v3 and no pki params" do
context 'create with keystone v3 and no pki params' do
let :pre_condition do
"
include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_proxy_fcgi { 'radosgw.gateway': }
"
"include ceph::params
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
include ceph
ceph::rgw { 'radosgw.gateway': }
ceph::rgw::apache_proxy_fcgi { 'radosgw.gateway': }"
end
let :title do
@ -335,15 +300,26 @@ wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/signin
}
end
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_domain').with_value('default') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_project').with_value('openstack') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_user').with_value('rgwuser') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_password').with_value('123456') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').with_ensure('absent') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://keystone.default:5000') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_domain').with_value('default') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_project').with_value('openstack') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_user').with_value('rgwuser') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_password').with_value('123456') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_token').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( :concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost' ))
end
it_behaves_like "ceph::rgw::keystone on #{facts[:osfamily]}"
end
end
end

View File

@ -18,59 +18,191 @@
require 'spec_helper'
describe 'ceph::rgw' do
let :pre_condition do
'include ceph::params'
end
describe 'Ubuntu 14.04' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:service_provider => 'upstart',
}
shared_examples 'ceph::rgw on Ubuntu 14.04' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:service_provider => 'upstart' )
end
describe "activated with default params" do
context 'activated with default params' do
let :title do
'radosgw.gateway'
end
it { is_expected.to contain_package('radosgw').with('ensure' => 'installed') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_package('radosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') }
it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { is_expected.to contain_file('/var/lib/ceph/radosgw').with({
'ensure' => 'directory',
'mode' => '0755',
'selinux_ignore_defaults' => true,
})}
it { should contain_file('/var/lib/ceph/radosgw').with(
:ensure => 'directory',
:mode => '0755',
:selinux_ignore_defaults => true,
)}
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with({
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0750',
'selinux_ignore_defaults' => true,
})}
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
it { is_expected.to contain_service('radosgw-radosgw.gateway') }
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with(
:ensure => 'directory',
:owner => 'root',
:group => 'root',
:mode => '0750',
:selinux_ignore_defaults => true,
)}
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
it { should contain_service('radosgw-radosgw.gateway') }
end
describe "activated with custom params" do
context 'activated with custom params' do
let :title do
'radosgw.custom'
end
let :params do
{
:pkg_radosgw => 'pkgradosgw',
:rgw_ensure => 'stopped',
:rgw_enable => false,
:rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom",
:user => 'wwwuser',
:keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring",
:log_file => '/var/log/ceph/mylogfile.log',
}
end
it { should contain_package('pkgradosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with(
:ensure => 'directory',
:owner => 'root',
:group => 'root',
:mode => '0750',
:selinux_ignore_defaults => true,
)}
it { should_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
it { should contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
end
end
shared_examples 'ceph::rgw on Ubuntu 16.04' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd' )
end
context 'activated with default params' do
let :title do
'radosgw.gateway'
end
it { should contain_package('radosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') }
it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_file('/var/lib/ceph/radosgw').with(
:ensure => 'directory',
:mode => '0755',
:selinux_ignore_defaults => true,
)}
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with(
:ensure => 'directory',
:owner => 'root',
:group => 'root',
:mode => '0750',
:selinux_ignore_defaults => true,
)}
it { should contain_service('radosgw-radosgw.gateway') }
end
context 'activated with custom params' do
let :title do
'radosgw.custom'
end
let :params do
{
:pkg_radosgw => 'pkgradosgw',
:rgw_ensure => 'stopped',
:rgw_enable => false,
:rgw_data => '/var/lib/ceph/radosgw/ceph-radosgw.custom',
:user => 'wwwuser',
:keyring_path => '/etc/ceph/ceph.radosgw.custom.keyring',
:log_file => '/var/log/ceph/mylogfile.log',
}
end
it { should contain_package('pkgradosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with(
:ensure => 'directory',
:owner => 'root',
:group => 'root',
:mode => '0750',
:selinux_ignore_defaults => true,
)}
it { should_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
it { should contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
end
end
shared_examples 'ceph::rgw on RedHat' do
before do
facts.merge!( :operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7' )
end
context 'activated with default params' do
let :title do
'radosgw.gateway'
end
it { should contain_package('ceph-radosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.gateway/user').with_value('apache') }
it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_file('/var/lib/ceph/radosgw').with(
:ensure => 'directory',
:mode => '0755',
:selinux_ignore_defaults => true,
)}
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with(
:ensure => 'directory',
:owner => 'root',
:group => 'root',
:mode => '0750',
:selinux_ignore_defaults => true,
)}
it { should contain_service('radosgw-radosgw.gateway') }
end
context 'activated with custom params' do
let :title do
'radosgw.custom'
end
@ -87,192 +219,43 @@ describe 'ceph::rgw' do
}
end
it { is_expected.to contain_package('pkgradosgw').with('ensure' => 'installed') }
it { should contain_package('pkgradosgw').with('ensure' => 'installed') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( {
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0750',
'selinux_ignore_defaults' => true,
} ) }
it { is_expected.to_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
it { is_expected.to contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with(
:ensure => 'directory',
:owner => 'root',
:group => 'root',
:mode => '0750',
:selinux_ignore_defaults => true,
)}
it { should contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
end
end
describe 'Ubuntu 16.04' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd',
}
end
describe "activated with default params" do
let :title do
'radosgw.gateway'
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',
:fqdn => 'myhost.domain',
:hostname => 'myhost' ))
end
it { is_expected.to contain_package('radosgw').with('ensure' => 'installed') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { is_expected.to contain_file('/var/lib/ceph/radosgw').with({
'ensure' => 'directory',
'mode' => '0755',
'selinux_ignore_defaults' => true,
})}
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with({
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0750',
'selinux_ignore_defaults' => true,
})}
it { is_expected.to contain_service('radosgw-radosgw.gateway') }
end
describe "activated with custom params" do
let :title do
'radosgw.custom'
if facts[:operatingsystem] == 'Ubuntu'
it_behaves_like 'ceph::rgw on Ubuntu 14.04'
it_behaves_like 'ceph::rgw on Ubuntu 16.04'
end
let :params do
{
:pkg_radosgw => 'pkgradosgw',
:rgw_ensure => 'stopped',
:rgw_enable => false,
:rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom",
:user => 'wwwuser',
:keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring",
:log_file => '/var/log/ceph/mylogfile.log',
}
if facts[:osfamily] == 'RedHat'
it_behaves_like 'ceph::rgw on RedHat'
end
it { is_expected.to contain_package('pkgradosgw').with('ensure' => 'installed') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( {
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0750',
'selinux_ignore_defaults' => true,
} ) }
it { is_expected.to_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
it { is_expected.to contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
end
end
describe 'RedHat Family' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
}
end
describe "activated with default params" do
let :title do
'radosgw.gateway'
end
it { is_expected.to contain_package('ceph-radosgw').with('ensure' => 'installed') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/user').with_value('apache') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { is_expected.to contain_file('/var/lib/ceph/radosgw').with({
'ensure' => 'directory',
'mode' => '0755',
'selinux_ignore_defaults' => true,
})}
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with({
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0750',
'selinux_ignore_defaults' => true,
})}
it { is_expected.to contain_service('radosgw-radosgw.gateway') }
end
describe "activated with custom params" do
let :title do
'radosgw.custom'
end
let :params do
{
:pkg_radosgw => 'pkgradosgw',
:rgw_ensure => 'stopped',
:rgw_enable => false,
:rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom",
:user => 'wwwuser',
:keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring",
:log_file => '/var/log/ceph/mylogfile.log',
}
end
it { is_expected.to contain_package('pkgradosgw').with('ensure' => 'installed') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { is_expected.to contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( {
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0750',
'selinux_ignore_defaults' => true,
} ) }
it { is_expected.to contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
end
end
end