Do not override supported OS

The puppet-ceph modules follows the independent release modeal and
its supported operating systems are not same as the ones for the other
OpenStack modules following OpenStack's release cycle.

This change removes override of operating systems being tested in unit
tests so that we test all operating systems supported by this module.

Change-Id: Icb910ed73999eded6c73905c4ae2f39404a8bfdd
This commit is contained in:
Takashi Kajinami 2022-08-22 01:11:43 +09:00
parent fa2d4ea8e4
commit b0b0727015
21 changed files with 140 additions and 694 deletions

View File

@ -41,9 +41,7 @@ describe 'ceph::conf' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -145,9 +145,7 @@ describe 'ceph' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -65,9 +65,7 @@ describe 'ceph::mds' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'}))

View File

@ -46,9 +46,7 @@ describe 'ceph::mons' do
}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -46,9 +46,7 @@ describe 'ceph::osds' do
}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -25,9 +25,7 @@ describe 'ceph::profile::fs' do
)}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'}))

View File

@ -36,9 +36,7 @@ describe 'ceph::profile::mds' do
)}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'}))

View File

@ -21,13 +21,6 @@ require 'spec_helper'
describe 'ceph::repo' do
shared_examples 'ceph::repo on Debian' do
before do
facts.merge!( :osfamily => 'Debian',
:lsbdistid => 'Debian',
:lsbdistcodename => 'jessie',
:lsbdistrelease => '8' )
end
context 'with default params' do
it { should contain_apt__key('ceph').with(
:id => '08B73419AC32B4E966C1A330E84AC2C0460F3994',
@ -37,7 +30,7 @@ describe 'ceph::repo' do
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-nautilus/',
:release => 'jessie',
:release => facts[:lsbdistcodename],
)}
end
@ -50,56 +43,7 @@ describe 'ceph::repo' do
it { should contain_apt__source('ceph').with(
:location => 'http://myserver.com/debian-nautilus/',
:release => 'jessie',
)}
end
context 'when overriding ceph release' do
let :params do
{
:release => 'firefly'
}
end
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-firefly/',
:release => 'jessie',
)}
end
end
shared_examples 'ceph::repo on Ubuntu' do
before do
facts.merge!( :osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistcodename => 'xenial',
:lsbdistrelease => '16.04',
:hardwaremodel => 'x86_64' )
end
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 { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-nautilus/',
:release => 'xenial',
)}
end
context 'when overriding ceph release' do
let :params do
{
:release => 'firefly'
}
end
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-firefly/',
:release => 'xenial',
:release => facts[:lsbdistcodename],
)}
end
@ -117,13 +61,13 @@ describe 'ceph::repo' do
it { should contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-nautilus/',
:release => 'xenial',
:release => facts[:lsbdistcodename],
)}
it { should contain_apt__source('ceph-fastcgi').with(
:ensure => 'present',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-xenial-x86_64-basic/ref/master',
:release => 'xenial',
:location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{facts[:lsbdistcodename]}-x86_64-basic/ref/master",
:release => facts[:lsbdistcodename],
:require => 'Apt::Key[ceph-gitbuilder]'
)}
end
@ -139,34 +83,28 @@ describe 'ceph::repo' do
it { should contain_apt__source('ceph').with(
:ensure => 'absent',
:location => 'http://download.ceph.com/debian-nautilus/',
:release => 'xenial',
:release => facts[:lsbdistcodename],
)}
it { should contain_apt__source('ceph-fastcgi').with(
:ensure => 'absent',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-xenial-x86_64-basic/ref/master',
:release => 'xenial',
:location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{facts[:lsbdistcodename]}-x86_64-basic/ref/master",
:release => facts[:lsbdistcodename],
:require => 'Apt::Key[ceph-gitbuilder]'
)}
end
end
shared_examples 'ceph::repo on RHEL' do
before do
facts.merge!( :osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '8' )
end
shared_examples 'ceph::repo on RedHat' do
context 'with default params' do
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -175,7 +113,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -186,7 +124,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -201,14 +139,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -217,7 +155,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph firefly',
:name => 'ext-ceph-firefly',
:baseurl => 'http://download.ceph.com/rpm-firefly/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -228,7 +166,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-firefly-noarch',
:baseurl => 'http://download.ceph.com/rpm-firefly/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -243,7 +181,7 @@ describe 'ceph::repo' do
}
end
it { should_not contain_yumrepo('ext-epel-8') }
it { should_not contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}") }
end
context 'when using a proxy for yum repositories' do
@ -255,14 +193,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
:proxy => 'http://someproxy.com:8080/',
@ -274,7 +212,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -288,7 +226,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -307,14 +245,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '0',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -323,7 +261,7 @@ describe 'ceph::repo' do
:enabled => '0',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -334,7 +272,7 @@ describe 'ceph::repo' do
:enabled => '0',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -345,7 +283,7 @@ describe 'ceph::repo' do
:enabled => '0',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel8-x86_64-basic/ref/master',
:baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
@ -360,14 +298,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -376,7 +314,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -387,7 +325,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -398,7 +336,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel8-x86_64-basic/ref/master',
:baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
@ -408,21 +346,15 @@ describe 'ceph::repo' do
end
shared_examples 'ceph::repo on CentOS' do
before do
facts.merge!( :osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemmajrelease => '8' )
end
context 'with default params' do
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -431,7 +363,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -442,7 +374,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -457,14 +389,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -473,7 +405,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph firefly',
:name => 'ext-ceph-firefly',
:baseurl => 'http://download.ceph.com/rpm-firefly/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -484,7 +416,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-firefly-noarch',
:baseurl => 'http://download.ceph.com/rpm-firefly/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -499,13 +431,13 @@ describe 'ceph::repo' do
}
end
it { should_not contain_yumrepo('ext-epel-8') }
it { should_not contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}") }
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 => 'http://mirror.centos.org/centos/8/storage/x86_64/ceph-nautilus/',
:baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}/storage/x86_64/ceph-nautilus/",
)}
end
@ -521,9 +453,6 @@ describe 'ceph::repo' do
}
end
it { should_not contain_yumrepo('ext-epel-8') }
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(
@ -556,7 +485,7 @@ describe 'ceph::repo' do
}
end
it { should_not contain_yumrepo('ext-epel-8') }
it { should_not contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}") }
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') }
@ -574,14 +503,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '0',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -590,7 +519,7 @@ describe 'ceph::repo' do
:enabled => '0',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -601,7 +530,7 @@ describe 'ceph::repo' do
:enabled => '0',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -612,7 +541,7 @@ describe 'ceph::repo' do
:enabled => '0',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel8-x86_64-basic/ref/master',
:baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
@ -627,14 +556,14 @@ describe 'ceph::repo' do
}
end
it { should contain_yumrepo('ext-epel-8').with(
it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with(
:enabled => '1',
:descr => 'External EPEL 8',
:name => 'ext-epel-8',
:descr => "External EPEL #{facts[:operatingsystemmajrelease]}",
:name => "ext-epel-#{facts[:operatingsystemmajrelease]}",
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch',
:gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}",
:mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
)}
@ -643,7 +572,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph nautilus',
:name => 'ext-ceph-nautilus',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/$basearch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -654,7 +583,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-nautilus-noarch',
:baseurl => 'http://download.ceph.com/rpm-nautilus/el8/noarch',
:baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
@ -665,7 +594,7 @@ describe 'ceph::repo' do
:enabled => '1',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel8-x86_64-basic/ref/master',
:baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master",
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/autobuild.asc',
:mirrorlist => 'absent',
@ -682,10 +611,10 @@ describe 'ceph::repo' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like "ceph::repo on #{facts[:operatingsystem]}"
it_behaves_like "ceph::repo on #{facts[:osfamily]}"
if facts[:operatingsystem] == 'CentOS'
it_behaves_like 'ceph::repo on RHEL'
it_behaves_like 'ceph::repo on CentOS'
end
end
end

View File

@ -41,9 +41,7 @@ describe 'ceph::rgw::keystone::auth' do
}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -36,9 +36,7 @@ describe 'ceph::fs' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'}))

View File

@ -58,9 +58,7 @@ describe 'ceph::key' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -69,9 +69,7 @@ describe 'ceph::mgr' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -21,239 +21,7 @@
require 'spec_helper'
describe 'ceph::mon' do
shared_examples 'ceph::mon on Ubuntu 16.04' do
before do
facts.merge!( :osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04', )
end
context 'with default params' do
let :title do
'A'
end
it { should raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/) }
end
context 'with key' do
let :title do
'A'
end
let :params do
{
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
}
end
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.]
key = AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==
caps mon = "allow *"
EOF
chmod 0444 /tmp/ceph-mon-keyring-A
',
: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 { 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 { 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
mkdir -p \$mon_data
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph \$mon_data
if ceph-mon --cluster ceph \
--setuser ceph --setgroup ceph \
--mkfs \
--id A \
--keyring /tmp/ceph-mon-keyring-A ; then
touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring
chown -h ceph:ceph \$mon_data/done \$mon_data/systemd \$mon_data/keyring
else
rm -fr \$mon_data
fi
else
if ceph-mon --cluster ceph \
--mkfs \
--id A \
--keyring /tmp/ceph-mon-keyring-A ; then
touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring
else
rm -fr \$mon_data
fi
fi
fi
",
:logoutput => true )}
it { should contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') }
end
context 'with keyring' do
let :title do
'A'
end
let :params do
{
:keyring => '/etc/ceph/ceph.mon.keyring',
}
end
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 { 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
mkdir -p \$mon_data
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph \$mon_data
if ceph-mon --cluster ceph \
--setuser ceph --setgroup ceph \
--mkfs \
--id A \
--keyring /etc/ceph/ceph.mon.keyring ; then
touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring
chown -h ceph:ceph \$mon_data/done \$mon_data/systemd \$mon_data/keyring
else
rm -fr \$mon_data
fi
else
if ceph-mon --cluster ceph \
--mkfs \
--id A \
--keyring /etc/ceph/ceph.mon.keyring ; then
touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring
else
rm -fr \$mon_data
fi
fi
fi
",
:logoutput => true )}
end
context 'with custom params' do
let :title do
'A'
end
let :params do
{
:public_addr => '127.0.0.1',
:authentication_type => 'none',
:cluster => 'testcluster',
}
end
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 { 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
mkdir -p \$mon_data
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph \$mon_data
if ceph-mon --cluster testcluster \
--setuser ceph --setgroup ceph \
--mkfs \
--id A \
--keyring /dev/null ; then
touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring
chown -h ceph:ceph \$mon_data/done \$mon_data/systemd \$mon_data/keyring
else
rm -fr \$mon_data
fi
else
if ceph-mon --cluster testcluster \
--mkfs \
--id A \
--keyring /dev/null ; then
touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring
else
rm -fr \$mon_data
fi
fi
fi
",
:logoutput => true )}
end
context 'with ensure absent' do
let :title do
'A'
end
let :params do
{
:ensure => 'absent',
:public_addr => '127.0.0.1',
:authentication_type => 'none',
:cluster => 'testcluster',
}
end
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
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 )}
end
end
shared_examples 'ceph::mon on RHEL7' do
before do
facts.merge!( :osfamily => 'RedHat',
:operatingsystem => 'RHEL7',
:service_provider => 'systemd' )
end
shared_examples 'ceph::mon' do
context 'with default params' do
let :title do
'A'
@ -495,19 +263,13 @@ test ! -d \$mon_data
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_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 16.04'
# elsif facts[:operatingsystem] == 'CentOS'
# it_behaves_like 'ceph::mon on RHEL7'
# end
it_behaves_like 'ceph::mon'
end
end
end

View File

@ -515,9 +515,7 @@ fi
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -75,9 +75,7 @@ describe 'ceph::pool' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -17,13 +17,7 @@
require 'spec_helper'
describe 'ceph::mirror' do
shared_examples 'ceph::mirror on Debian' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:service_provider => 'systemd' )
end
shared_examples 'ceph::mirror' do
context 'with default params' do
let :title do
'A'
@ -33,32 +27,13 @@ describe 'ceph::mirror' do
end
end
shared_examples 'ceph::mirror on RedHat' do
before do
facts.merge!( :operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
:service_provider => 'systemd' )
end
context 'with default params' do
let :title do
'A'
end
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|
on_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]}"
it_behaves_like "ceph::mirror"
end
end
end

View File

@ -20,14 +20,7 @@
require 'spec_helper'
describe 'ceph::rgw::apache_proxy_fcgi' do
shared_examples 'ceph::rgw::apache_proxy_fcgi on Debian' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:operatingsystemrelease => '16.04',
:lsbdistcodename => 'xenial' )
end
shared_examples 'ceph::rgw::apache_proxy_fcgi' do
context 'activated with default params' do
let :title do
'radosgw.gateway'
@ -108,104 +101,16 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
end
end
shared_examples 'ceph::rgw::apache_proxy_fcgi 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_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 { 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
context 'activated with custom params' do
let :title do
'myid'
end
let :params do
{
:rgw_dns_name => 'mydns.hostname',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:syslog => false,
:proxy_pass => {'path'=>'/', 'url'=>'fcgi://127.0.0.1:9999/'},
:apache_mods => true,
:apache_vhost => true,
:apache_purge_configs => false,
:apache_purge_vhost => false,
:custom_apache_ports => '8888',
}
end
it { should contain_class('apache').with(
:default_mods => true,
:default_vhost => true,
:purge_configs => false,
:purge_vhost_dir => false,
)}
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|
on_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' ))
facts.merge!(OSDefaults.get_facts(
:fqdn => 'myhost.domain',
:hostname => 'myhost'
))
end
it_behaves_like "ceph::rgw::apache_proxy_fcgi on #{facts[:osfamily]}"
it_behaves_like 'ceph::rgw::apache_proxy_fcgi'
end
end
end

View File

@ -67,29 +67,24 @@ describe 'ceph::rgw' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_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',
}))
facts.merge!(OSDefaults.get_facts(
:fqdn => 'myhost.domain',
:hostname => 'myhost'
))
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{
:pkg_radosgw => 'radosgw',
:user => 'www-data',
:user => 'www-data',
}
when 'RedHat'
{
:pkg_radosgw => 'ceph-radosgw',
:user => 'apache',
:user => 'apache',
}
end
end

View File

@ -68,9 +68,7 @@ describe 'ceph::rgw' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({

View File

@ -93,9 +93,7 @@ describe 'ceph::rgw::keystone' do
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())

View File

@ -22,20 +22,15 @@ describe 'ceph::rgw' do
'include ceph::params'
end
shared_examples 'ceph::rgw on Ubuntu 16.04' do
before do
facts.merge!( :operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04' )
end
shared_examples 'ceph::rgw' do
context 'activated with default params' do
let :title do
'radosgw.gateway'
end
it { should contain_package('radosgw').with('ensure' => 'installed') }
it { should contain_package(platform_params[:pkg_radosgw]).with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_enable_apis').with_ensure('absent') }
it { should contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') }
it { should contain_ceph_config('client.radosgw.gateway/user').with_value(platform_params[:user]) }
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') }
@ -88,12 +83,11 @@ describe 'ceph::rgw' do
end
it { should contain_package('pkgradosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.custom/rgw_enable_apis').with_value('s3,swift') }
it { should 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 { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url').with_value('https://mydns.hostname:443') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url_prefix').with_value('/') }
@ -114,115 +108,31 @@ describe 'ceph::rgw' do
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/rgw_enable_apis').with_ensure('absent') }
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_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('myhost.domain') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url').with_value('http://myhost.domain:7480') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url_prefix').with_value('swift') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_account_in_url').with_value(false) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_versioning_enabled').with_value(false) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_trust_forwarded_https').with_value(false) }
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_enable_apis => ['s3', 'swift'],
: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',
:rgw_dns_name => 'mydns.hostname',
:rgw_swift_url => 'https://mydns.hostname:443',
:rgw_swift_url_prefix => '/',
:rgw_swift_account_in_url => true,
:rgw_swift_versioning_enabled => true,
:rgw_trust_forwarded_https => true,
}
end
it { should contain_package('pkgradosgw').with('ensure' => 'installed') }
it { should contain_ceph_config('client.radosgw.custom/rgw_enable_apis').with_value('s3,swift') }
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_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url').with_value('https://mydns.hostname:443') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url_prefix').with_value('/') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_account_in_url').with_value(true) }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_versioning_enabled').with_value(true) }
it { should contain_ceph_config('client.radosgw.custom/rgw_trust_forwarded_https').with_value(true) }
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
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
on_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' ))
facts.merge!(OSDefaults.get_facts(
:fqdn => 'myhost.domain',
:hostname => 'myhost'
))
end
if facts[:operatingsystem] == 'Ubuntu'
it_behaves_like 'ceph::rgw on Ubuntu 16.04'
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:pkg_radosgw => 'radosgw',
:user => 'www-data'
}
when 'RedHat'
{
:pkg_radosgw => 'ceph-radosgw',
:user => 'apache'
}
end
end
if facts[:osfamily] == 'RedHat'
it_behaves_like 'ceph::rgw on RedHat'
end
it_behaves_like 'ceph::rgw'
end
end
end