Drop deprecated rspec-system tests and releases

This drops the rspec-system tests as well as the tests for
CentOS 6 and Ubuntu Precise.

Change-Id: I99336ae9f12324e8a83f9e7c3e18ef3b0b4b1050
This commit is contained in:
David Gurtner 2016-02-02 01:29:19 +01:00
parent cba5340f8a
commit 45d9124a55
64 changed files with 41 additions and 5584 deletions

3
.gitignore vendored
View File

@ -6,6 +6,5 @@ pkg
Gemfile.lock
.bundle
vendor
.rspec_system
Gemfile-rspec-system.lock
.vagrant/*
log

View File

@ -1,27 +0,0 @@
# vim:ft=ruby
source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 2.1.0', :require => false
gem 'metadata-json-lint'
gem 'puppet-lint-param-docs'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-absolute_template_path'
gem 'puppet-lint-trailing_newline-check'
# Puppet 4.x related lint checks
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable'
gem 'rspec-system', :git => 'https://github.com/aldavud/rspec-system.git', :branch => 'master'
gem 'rspec-system-puppet', :git => 'https://github.com/aldavud/rspec-system-puppet.git', :branch => 'master'
end
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end

View File

@ -12,9 +12,6 @@ mod 'puppetlabs/inifile',
:git => 'git://github.com/puppetlabs/puppetlabs-inifile',
:ref => '1.0.3'
mod 'bodepd/scenario_node_terminus',
:git => 'git://github.com/bodepd/scenario_node_terminus'
mod 'puppetlabs/apache',
:git => 'git://github.com/puppetlabs/puppetlabs-apache',
:ref => '1.4.1'

111
README.md
View File

@ -8,10 +8,11 @@ ceph
3. [Setup - The basics of getting started with ceph](#setup)
4. [Implementation - An under-the-hood peek at what the module is doing](#implementation)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
7. [Contributors - Those with commits](#contributors)
7. [Integration - Apply the module and test restults](#integration-tests)
8. [Release Notes - Notes on the most recent updates to the module](#release-notes)
6. [Use Cases - Examples of how to use this module](#limitations)
7. [Development - Guide for contributing to the module](#development)
8. [Beaker Integration Tests - Apply the module and test restults](#integration-tests)
9. [Contributors - Those with commits](#contributors)
10. [Release Notes - Notes on the most recent updates to the module](#release-notes)
Overview
--------
@ -53,12 +54,12 @@ bundle install
The developer documentation of the puppet-openstack project is the reference:
* https://wiki.openstack.org/wiki/Puppet-openstack#Developer_documentation
* https://wiki.openstack.org/wiki/Puppet#Developer_documentation
Mailing lists:
* (puppet-openstack)[https://groups.google.com/a/puppetlabs.com/forum/#!forum/puppet-openstack]
* (ceph-devel)[http://ceph.com/resources/mailing-list-irc/]
* [puppet-openstack](https://groups.google.com/a/puppetlabs.com/forum/#!forum/puppet-openstack)
* [ceph-devel](http://ceph.com/resources/mailing-list-irc/)
IRC channels:
@ -87,10 +88,6 @@ to be run. Available values are
* centos-70-x64
* two-ubuntu-server-1404-x64
* ubuntu-server-1404-x64
* two-centos-66-x64
* centos-66-x64
* two-ubuntu-server-1204-x64
* ubuntu-server-1204-x64
The default is
@ -99,98 +96,6 @@ BEAKER_set=two-ubuntu-server-1404-x64 \
bundle exec rspec spec/acceptance
```
Deprecated Integration Tests
----------------------------
Relies on
[rspec-system-puppet](https://github.com/puppetlabs/rspec-system-puppet)
and tests are in spec/system. It runs virtual machines and requires
4GB of free memory and 10GB of free disk space.
* [Install Vagrant and Virtualbox](http://docs-v1.vagrantup.com/v1/docs/getting-started/)
* sudo apt-get install ruby-dev libxml2-dev libxslt-dev # nokogiri dependencies
* mv Gemfile-rspec-system Gemfile # because of https://bugs.launchpad.net/openstack-ci/+bug/1290710
* bundle install
* bundle exec rake lint
* bundle exec rake spec
* git clone https://github.com/bodepd/scenario_node_terminus.git ../scenario_node_terminus
* bundle exec rake spec:system
* RS_SET=two-ubuntu-server-1204-x64 bundle exec rake spec:system
* RS_SET=two-centos-66-x64 bundle exec rake spec:system
The RELEASES environment variable contains the list of ceph releases
for which integration tests are going to be run. The default is
```
RELEASES='firefly hammer' \
bundle exec rake spec:system
```
The RS_SET environment variable contains the resource set of linux
distribution configurations for which integration tests are going
to be run. Available values are
* two-ubuntu-server-12042-x64
* one-ubuntu-server-12042-x64
* two-centos-65-x64
* one-centos-65-x64
* two-centos-70-x64
* one-centos-70-x64
The default is
```
RS_SET=two-ubuntu-server-1204-x64 \
bundle exec rake spec:system
```
The MACHINES environment variable contains the list of virtual
machines that are used for integration tests. This needs to match
with the RS_SET above. I.e. for a two-* RS_SET use 2 machines.
The default is
```
MACHINES='first second' \
bundle exec rake spec:system
```
On success it should complete with
```
...
=end=============================================================
Finished in 4 minutes 1.7 seconds
1 example, 0 failures
```
Example invocation of gerritexec:
```
cat > ./ci.sh << EOF
#!/bin/bash
bundle install
export BEAKER_debug=yes
export BEAKER_destroy=yes
echo ---------------- CENTOS 7 --------------
BEAKER_set=two-centos-70-x64 bundle exec rspec spec/acceptance
rc=$?
echo ---------- UBUNTU 14.04 --------------
BEAKER_set=two-ubuntu-server-1404-x64 bundle exec rspec spec/acceptance
exit $(( $? | $rc))
EOF
chmod +x ./ci.sh
GEM_HOME=~/.gems screen -dmS puppet-ceph gerritexec \
--timeout 14400 --hostname review.openstack.org \
--verbose --username puppetceph --script "../ci.sh > /tmp/out$$ 2>&1 ; r=$? ; pastebinit /tmp/out$$ ; exit $r #" \
--project openstack/puppet-ceph
```
Contributors
------------

View File

@ -95,8 +95,7 @@
# Optional. Defaults to true
#
class ceph::profile::params (
# puppet 2.7 compatibiliy hack. TODO: change to undef once 2.7 is deprecated
$fsid = '4b5c8c0a-ff60-454b-a1b4-9747aa737d19',
$fsid = undef,
$release = undef,
$authentication_type = undef,
$mon_initial_members = undef,

View File

@ -1,15 +0,0 @@
HOSTS:
first:
roles:
- master
- mon
- osd
- client
platform: el-6-x86_64
box: puppetlabs/centos-6.6-64-nocm
box_url: https://atlas.hashicorp.com/puppetlabs/boxes/centos-6.6-64-nocm
hypervisor: vagrant
ip: 10.11.12.2
CONFIG:
type: foss
set_env: false

View File

@ -1,22 +0,0 @@
HOSTS:
first:
roles:
- master
- mon
platform: el-6-x86_64
box: puppetlabs/centos-6.6-64-nocm
box_url: https://atlas.hashicorp.com/puppetlabs/boxes/centos-6.6-64-nocm
hypervisor: vagrant
ip: 10.11.12.2
second:
roles:
- osd
- client
platform: el-6-x86_64
box: puppetlabs/centos-6.6-64-nocm
box_url: https://atlas.hashicorp.com/puppetlabs/boxes/centos-6.6-64-nocm
hypervisor: vagrant
ip: 10.11.12.3
CONFIG:
type: foss
set_env: false

View File

@ -1,22 +0,0 @@
HOSTS:
first:
roles:
- master
- mon
platform: ubuntu-1204-amd64
box: puppetlabs/ubuntu-12.04-64-nocm
box_url: https://atlas.hashicorp.com/puppetlabs/boxes/ubuntu-12.04-64-nocm
hypervisor: vagrant
ip: 10.11.12.2
second:
roles:
- osd
- client
platform: ubuntu-1204-amd64
box: puppetlabs/ubuntu-12.04-64-nocm
box_url: https://atlas.hashicorp.com/puppetlabs/boxes/ubuntu-12.04-64-nocm
hypervisor: vagrant
ip: 10.11.12.3
CONFIG:
type: foss
set_env: false

View File

@ -1,15 +0,0 @@
HOSTS:
first:
roles:
- master
- mon
- osd
- client
platform: ubuntu-1204-amd64
box: puppetlabs/ubuntu-12.04-64-nocm
box_url: https://atlas.hashicorp.com/puppetlabs/boxes/ubuntu-12.04-64-nocm
hypervisor: vagrant
ip: 10.11.12.2
CONFIG:
type: foss
set_env: false

View File

@ -68,17 +68,6 @@ describe 'ceph::mons' do
it_configures 'ceph mons'
end
describe 'RHEL6' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemmajrelease => '6',
}
end
it_configures 'ceph mons'
end
describe 'RHEL7' do
let :facts do
{

View File

@ -53,23 +53,13 @@ describe 'ceph::profile::base' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistcodename => 'Precise'
:lsbdistcodename => 'trusty'
}
end
it_configures 'ceph profile base'
end
context 'on RHEL6' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemmajrelease => '6' }
end
it_configures 'ceph profile base'
end
context 'on RHEL7' do
let :facts do

View File

@ -107,7 +107,7 @@ describe 'ceph::profile::client' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistcodename => 'trusty',
:operatingsystem => 'Ubuntu',
}
end
@ -115,17 +115,6 @@ describe 'ceph::profile::client' do
it_configures 'ceph profile client'
end
context 'on RHEL6' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemmajrelease => '6' }
end
it_configures 'ceph profile client'
end
context 'on RHEL7' do
let :facts do

View File

@ -80,7 +80,7 @@ describe 'ceph::profile::mon' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistcodename => 'trusty',
:operatingsystem => 'Ubuntu',
:hostname => 'first',
}
@ -89,17 +89,6 @@ describe 'ceph::profile::mon' do
it_configures 'ceph profile mon'
end
context 'on RHEL6' do
let :facts do
{ :osfamily => 'RedHat',
:hostname => 'first',
:operatingsystemmajrelease => '6' }
end
it_configures 'ceph profile mon'
end
context 'on RHEL7' do
let :facts do

View File

@ -60,7 +60,7 @@ describe 'ceph::profile::osd' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistcodename => 'trusty',
:operatingsystem => 'Ubuntu',
}
end
@ -68,16 +68,6 @@ describe 'ceph::profile::osd' do
it_configures 'ceph profile osd'
end
describe 'on RHEL6' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemmajrelease => '6' }
end
it_configures 'ceph profile osd'
end
describe 'on RHEL7' do
let :facts do

View File

@ -63,17 +63,20 @@ describe 'ceph::profile::params' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistcodename => 'Precise'
:lsbdistcodename => 'trusty'
}
end
it_configures 'ceph profile params'
end
context 'on RHEL6' do
context 'on RHEL7' do
let :facts do
{ :osfamily => 'RedHat', }
{
:osfamily => 'RedHat',
:operatingsystemmajrelease => '7'
}
end
it_configures 'ceph profile params'

View File

@ -66,7 +66,7 @@ describe 'ceph::repo' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistcodename => 'trusty',
:hardwaremodel => 'x86_64',
}
end
@ -80,7 +80,7 @@ describe 'ceph::repo' do
it { is_expected.to contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-hammer/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
@ -95,7 +95,7 @@ describe 'ceph::repo' do
it { is_expected.to contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-firefly/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
end
@ -109,14 +109,14 @@ describe 'ceph::repo' do
it { is_expected.to contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-hammer/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
it { is_expected.to contain_apt__source('ceph-extras').with(
:ensure => 'present',
:location => 'http://ceph.com/packages/ceph-extras/debian/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
@ -136,14 +136,14 @@ describe 'ceph::repo' do
it { is_expected.to contain_apt__source('ceph').with(
:location => 'http://download.ceph.com/debian-hammer/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
it { is_expected.to contain_apt__source('ceph-fastcgi').with(
:ensure => 'present',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-precise-x86_64-basic/ref/master',
:release => 'precise',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-trusty-x86_64-basic/ref/master',
:release => 'trusty',
:require => 'Apt::Key[ceph-gitbuilder]'
) }
@ -161,21 +161,21 @@ describe 'ceph::repo' do
it { is_expected.to contain_apt__source('ceph').with(
:ensure => 'absent',
:location => 'http://download.ceph.com/debian-hammer/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
it { is_expected.to contain_apt__source('ceph-extras').with(
:ensure => 'absent',
:location => 'http://ceph.com/packages/ceph-extras/debian/',
:release => 'precise',
:release => 'trusty',
:require => 'Apt::Key[ceph]'
) }
it { is_expected.to contain_apt__source('ceph-fastcgi').with(
:ensure => 'absent',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-precise-x86_64-basic/ref/master',
:release => 'precise',
:location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-trusty-x86_64-basic/ref/master',
:release => 'trusty',
:require => 'Apt::Key[ceph-gitbuilder]'
) }
@ -183,281 +183,6 @@ describe 'ceph::repo' do
end
describe 'RHEL6' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '6',
}
end
describe "with default params" do
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10',
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10',
) }
end
describe "when overriding ceph release" do
let :params do
{
:release => 'firefly'
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph firefly',
:name => 'ext-ceph-firefly',
:baseurl => 'http://download.ceph.com/rpm-firefly/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-firefly-noarch',
:baseurl => 'http://download.ceph.com/rpm-firefly/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
end
describe "with ensure => absent to disable" do
let :params do
{
:ensure => 'absent',
:extras => true,
:fastcgi => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '0',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '0',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '0',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-extras').with(
:enabled => '0',
:descr => 'External Ceph Extras',
:name => 'ext-ceph-extras',
:baseurl => 'http://ceph.com/packages/ceph-extras/rpm/rhel6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '0',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel6-x86_64-basic/ref/master',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
end
describe "with ceph extras" do
let :params do
{
:extras => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-extras').with(
:enabled => '1',
:descr => 'External Ceph Extras',
:name => 'ext-ceph-extras',
:baseurl => 'http://ceph.com/packages/ceph-extras/rpm/rhel6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
end
describe "with ceph fast-cgi" do
let :params do
{
:fastcgi => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '1',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel6-x86_64-basic/ref/master',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
end
end
describe 'RHEL7' do
let :facts do
@ -714,282 +439,6 @@ describe 'ceph::repo' do
end
end
describe 'CentOS6' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemmajrelease => '6',
}
end
describe "with default params" do
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
end
describe "when overriding ceph release" do
let :params do
{
:release => 'firefly'
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph firefly',
:name => 'ext-ceph-firefly',
:baseurl => 'http://download.ceph.com/rpm-firefly/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-firefly-noarch',
:baseurl => 'http://download.ceph.com/rpm-firefly/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
end
describe "with ensure => absent to disable" do
let :params do
{
:ensure => 'absent',
:extras => true,
:fastcgi => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '0',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '0',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '0',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-extras').with(
:enabled => '0',
:descr => 'External Ceph Extras',
:name => 'ext-ceph-extras',
:baseurl => 'http://ceph.com/packages/ceph-extras/rpm/rhel6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '0',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel6-x86_64-basic/ref/master',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
end
describe "with ceph extras" do
let :params do
{
:extras => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-extras').with(
:enabled => '1',
:descr => 'External Ceph Extras',
:name => 'ext-ceph-extras',
:baseurl => 'http://ceph.com/packages/ceph-extras/rpm/rhel6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
end
describe "with ceph fast-cgi" do
let :params do
{
:fastcgi => true
}
end
it { is_expected.not_to contain_file_line('exclude base') }
it { is_expected.to contain_yumrepo('ext-epel-6').with(
:enabled => '1',
:descr => 'External EPEL 6',
:name => 'ext-epel-6',
:baseurl => 'absent',
:gpgcheck => '1',
:gpgkey => 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6',
:mirrorlist => 'http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
:priority => '20',
:exclude => 'python-ceph-compat python-rbd python-rados python-cephfs',
) }
it { is_expected.to contain_yumrepo('ext-ceph').with(
:enabled => '1',
:descr => 'External Ceph hammer',
:name => 'ext-ceph-hammer',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/$basearch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-noarch').with(
:enabled => '1',
:descr => 'External Ceph noarch',
:name => 'ext-ceph-hammer-noarch',
:baseurl => 'http://download.ceph.com/rpm-hammer/el6/noarch',
:gpgcheck => '1',
:gpgkey => 'https://download.ceph.com/keys/release.asc',
:mirrorlist => 'absent',
:priority => '10'
) }
it { is_expected.to contain_yumrepo('ext-ceph-fastcgi').with(
:enabled => '1',
:descr => 'FastCGI basearch packages for Ceph',
:name => 'ext-ceph-fastcgi',
:baseurl => 'http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel6-x86_64-basic/ref/master',
:gpgcheck => '1',
:gpgkey => 'https://git.ceph.com/autobuild.asc',
:mirrorlist => 'absent',
:priority => '20'
) }
end
end
describe 'CentOS7' do
let :facts do

View File

@ -37,8 +37,8 @@ describe 'ceph::rgw::apache' do
:hostname => 'myhost',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
:lsbdistcodename => 'precise',
:operatingsystemrelease => '14.04',
:lsbdistcodename => 'trusty',
:pkg_fastcgi => 'libapache2-mod-fastcgi',
}
end
@ -131,8 +131,8 @@ exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
:hostname => 'myhost',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemmajrelease => '6',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
:pkg_fastcgi => 'libapache2-mod-fastcgi',
}
end

View File

@ -30,7 +30,7 @@ describe 'ceph::rgw::keystone' do
:lsbdistcodename => 'precise',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
:operatingsystemrelease => '14.04',
}
end
@ -147,8 +147,8 @@ openssl x509 -in /tmp/signing -pubkey | certutil -A -d /some/path/to/nss -n sign
:lsbdistcodename => 'Final',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemmajrelease => '6',
:operatingsystemrelease => '7.2',
:operatingsystemmajrelease => '7',
}
end

View File

@ -110,7 +110,7 @@ describe 'ceph::rgw' do
:hostname => 'myhost',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
:operatingsystemrelease => '14.04',
}
end
@ -133,7 +133,7 @@ describe 'ceph::rgw' do
:hostname => 'myhost',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemrelease => '7.2',
}
end

View File

@ -1,9 +0,0 @@
---
#################
# Data Mappings #
#################
ceph::mons::defaults:
authentication_type: cephx
key: "%{hiera('mon_key')}"

View File

@ -1,4 +0,0 @@
base:
- "ceph::repo"
- "ceph"

View File

@ -1,42 +0,0 @@
---
release: firefly
fsid: '4b5c8c0a-ff60-454b-a1b4-9747aa737d19'
mon_host: '10.11.12.2, 10.11.12.3'
mon_initial_members: 'first,second'
public_network: '10.11.12.0/24'
# Global Hiera Params:
auth_type: none
ensure: present
#################
# Data Mappings #
#################
ceph::repo::release: "%{hiera('release')}"
ceph::fsid: "%{hiera('fsid')}"
ceph::mon_host: "%{hiera('mon_host')}"
ceph::mon_initial_members: "%{hiera('mon_initial_members')}"
ceph::public_network: "%{hiera('public_network')}"
ceph::mons::args:
"%{hostname}": {}
ceph::mons::defaults:
authentication_type: none
ceph::keys::defaults:
inject: true
inject_as_id: 'mon.'
inject_keyring: "/var/lib/ceph/mon/ceph-%{hostname}/keyring"
ceph::ensure: "%{hiera('ensure')}"
ceph::repo::ensure: "%{hiera('ensure')}"
ceph::authentication_type: "%{hiera('auth_type')}"

View File

@ -1,10 +0,0 @@
#################
# Data Mappings #
#################
ceph::mons::args:
"%{hostname}":
ensure: absent
ceph::keys::args: {}

View File

@ -1,12 +0,0 @@
#################
# Data Mappings #
#################
ceph::mons::args:
"%{hostname}":
ensure: absent
ceph::repo::ensure: absent
ceph::keys::args: {}

View File

@ -1,7 +0,0 @@
packages: &packages [ 'ceph', 'ceph-common', 'libcephfs1', 'librados2', 'librbd1', 'python-ceph' ]
#########################################
# Anchor mappings for non-string elements
#########################################
ceph::params::packages: *packages

View File

@ -1,7 +0,0 @@
packages: &packages [ 'ceph', 'libcephfs1', 'librados2', 'librbd1', 'python-ceph' ]
#########################################
# Anchor mappings for non-string elements
#########################################
ceph::params::packages: *packages

View File

@ -1,2 +0,0 @@
mon_host: '10.11.12.2'
mon_initial_members: 'first'

View File

@ -1,4 +0,0 @@
classes:
- "ceph::mons"
class_groups:
- "base"

View File

@ -1,2 +0,0 @@
classes:
- "ceph::keys"

View File

@ -1,15 +0,0 @@
---
:backends:
- yaml
:hierarchy:
- "ensure/%{ensure}"
- user
- "osfamily/%{osfamily}"
- "auth_type/%{auth_type}"
- "scenario/%{scenario}"
- "scenario/%{scenario}/%{role}"
- "scenario/%{auth_type}/%{role}"
- common
- class_groups
:yaml:
:datadir: /etc/puppet/data/hiera_data

View File

@ -1,4 +0,0 @@
---
classes:
- ceph::repo
- ceph

View File

@ -1,2 +0,0 @@
scenario: 2_role
#scenario: allinone

View File

@ -1,20 +0,0 @@
---
"%{auth_type}":
- ceph::authentication_type
mon_defaults:
- ceph::mons::defaults
key_defaults:
- ceph::keys::defaults
"%{ensure}":
- ceph::ensure
- ceph::repo::ensure
fsid:
- ceph::fsid
mon_host:
- ceph::mon_host
packages:
- ceph::params::packages
public_network:
- ceph::public_network
release:
- ceph::repo::release

View File

@ -1,3 +0,0 @@
---
ensure: present
auth_type: none

View File

@ -1,4 +0,0 @@
---
mon_defaults:
authentication_type: cephx
key: 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='

View File

@ -1,9 +0,0 @@
---
mon_defaults:
authentication_type: none
fsid: '4b5c8c0a-ff60-454b-a1b4-9747aa737d19'
mon_host: '10.11.12.2, 10.11.12.3'
public_network: '10.11.12.0/24'
release: firefly
ceph::osds::args:
'/dev/sdb': {}

View File

@ -1,9 +0,0 @@
ceph::mons::args:
'first':
ensure: absent
'second':
ensure: absent
ceph::keys::args: {}
ceph::osds::args:
'/dev/sdb':
ensure: absent

View File

@ -1,10 +0,0 @@
ceph::mons::args:
'first':
ensure: absent
'second':
ensure: absent
ceph::repo::ensure: absent
ceph::keys::args: {}
ceph::osds::args:
'/dev/sdb':
ensure: absent

View File

@ -1,8 +0,0 @@
---
ceph::mons::args:
'first':
public_addr: '10.11.12.2'
key_defaults:
inject: true
inject_as_id: 'mon.'
inject_keyring: "/var/lib/ceph/mon/ceph-first/keyring"

View File

@ -1,8 +0,0 @@
---
ceph::mons::args:
'second':
public_addr: '10.11.12.3'
key_defaults:
inject: true
inject_as_id: 'mon.'
inject_keyring: "/var/lib/ceph/mon/ceph-second/keyring"

View File

@ -1,7 +0,0 @@
packages:
- ceph
- 'ceph-common'
- libcephfs1
- librados2
- librbd1
- 'python-ceph'

View File

@ -1,6 +0,0 @@
packages:
- ceph
- libcephfs1
- librados2
- librbd1
- 'python-ceph'

View File

@ -1 +0,0 @@
mon_host: '10.11.12.2'

View File

@ -1 +0,0 @@
mon_host: '10.11.12.2'

View File

@ -1,2 +0,0 @@
first: mon
second: osd

View File

@ -1,11 +0,0 @@
roles:
mon:
classes:
- ceph::mons
class_groups:
- base
osd:
classes:
- ceph::osds
class_groups:
- base

View File

@ -1,17 +0,0 @@
roles:
allinone:
classes:
- ceph::mons
- ceph::osds
class_groups:
- base
mon:
classes:
- ceph::mons
class_groups:
- base
osd:
classes:
- ceph::osds
class_groups:
- base

View File

@ -1,10 +0,0 @@
roles:
mon:
classes:
- ceph::keys
osd:
classes:
- ceph::keys
allinone:
classes:
- ceph::keys

View File

@ -1,13 +0,0 @@
---
:backends:
- data_mapper
:hierarchy:
- "ensure/%{ensure}"
- user
- "osfamily/%{osfamily}"
- "auth_type/%{auth_type}"
- "hostname/%{hostname}"
- "scenario/%{scenario}"
- common
:data_mapper:
:datadir: /etc/puppet/data/data_mappings

View File

@ -1,73 +0,0 @@
#
# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'rspec-system/spec_helper'
require 'rspec-system-puppet/helpers'
include RSpecSystemPuppet::Helpers
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
# Enable color
c.tty = true
c.include RSpecSystemPuppet::Helpers
c.before :suite do
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
machines.each do |vm|
puppet_install(:node => vm)
# https://tickets.puppetlabs.com/browse/PUP-2566
shell(:command => 'sed -i "/templatedir/d" /etc/puppet/puppet.conf',
:node => vm)
puppet_module_install(:source => proj_root,
:module_name => 'ceph',
:node => vm)
puppet_module_install(:source => File.join(proj_root, '../scenario_node_terminus'),
:module_name => 'scenario_node_terminus',
:node => vm)
shell(:command => 'puppet module install --version ">=4.0.0 <5.0.0" puppetlabs/stdlib',
:node => vm)
shell(:command => 'puppet module install --version ">=1.0.0 <2.0.0" puppetlabs/inifile',
:node => vm)
shell(:command => 'puppet module install --version ">=1.4.0 <2.0.0" puppetlabs/apt',
:node => vm)
shell(:command => 'puppet module install --version ">=1.2.1 <2.0.0" puppetlabs/concat',
:node => vm)
shell(:command => 'puppet module install --version ">=1.4.1 <2.0.0" puppetlabs/apache',
:node => vm)
shell(:command => 'puppet module install --version ">=5.1.0 <6.0.0" stackforge/keystone',
:node => vm) # keystone >=5.1.0 <6.0.0 is not present in openstack/keystone
rcp(:sp => File.join(proj_root, 'spec/fixtures/hieradata/hiera.yaml'),
:dp => '/etc/puppet/hiera.yaml',
:d => node(:name => vm))
# Flush the firewall
flushfw = <<-EOS
iptables -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
EOS
shell(:node => vm, :command => flushfw)
end
end
end

View File

@ -1,244 +0,0 @@
#
# Copyright (C) 2014 Catalyst IT Limited.
# Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <aldavud@crimson.ch>
#
require 'spec_helper_system'
describe 'ceph::key' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg==' # client.admin key needs to contain a / character!
volume_key = 'AQAMTVRTSOHmHBAAH5d1ukHrAnxuSbrWSv9KGA=='
mon_host = '$::ipaddress'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
releases.each do |release|
purge = <<-EOS
ceph::mon { 'a': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/etc/ceph/ceph.client.admin.keyring',
'/etc/ceph/ceph.client.volume',
]:
ensure => absent
}
->
package { [
'python-ceph',
'ceph-common',
'librados2',
'librbd1',
'libcephfs1',
]:
ensure => purged
}
EOS
describe release do
before(:all) do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
it 'should install and not inject client.admin key' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph::key { 'client.admin':
secret => '#{admin_key}',
cap_mon => 'allow *',
cap_osd => 'allow *',
cap_mds => 'allow *',
mode => 0600,
user => 'root',
group => 'root',
inject => false,
}
# this is the dependency we want to prove to work here,
# we do not need to specify dependencies normally.
->
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph auth list' do |r|
expect(r.stdout).not_to match(/client.admin/)
expect(r.exit_code).to be_zero
end
shell 'ls -l /etc/ceph/ceph.client.admin.keyring' do |r|
expect(r.stdout).to match(/.*-rw-------.*root\sroot.*/m)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'cat /etc/ceph/ceph.client.admin.keyring' do |r|
expect(r.stdout).to match(/.*\[client.admin\].*key = #{admin_key}.*caps mds = "allow \*".*caps mon = "allow \*".*caps osd = "allow \*".*/m)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install and inject client.volumes key' do
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
nogroup = 'nogroup'
end
if osfamily == 'RedHat'
nogroup = 'nobody'
end
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
}
ceph::mon { 'a':
public_addr => #{mon_host},
key => '#{mon_key}',
}
ceph::key { 'client.admin':
secret => '#{admin_key}',
cap_mon => 'allow *',
cap_osd => 'allow *',
cap_mds => 'allow *',
inject => true,
inject_as_id => 'mon.',
inject_keyring => '/var/lib/ceph/mon/ceph-a/keyring',
}
# as we are injecting using the client.admin key we
# need this dependency
->
ceph::key { 'client.volumes':
secret => '#{volume_key}',
cluster => 'ceph',
cap_mon => 'allow *',
cap_osd => 'allow rw',
mode => 0600,
user => 'nobody',
group => '#{nogroup}',
inject => true,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
expect(r.stdout).not_to match(/Exec\[ceph-key-client\.admin\]/) # client.admin key needs to contain a / character!
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/.*client\.volumes.*key:\s#{volume_key}.*/m)
# r.stderr.should be_empty # ceph auth writes to stderr!
expect(r.exit_code).to be_zero
end
shell 'ls -l /etc/ceph/ceph.client.volumes.keyring' do |r|
expect(r.stdout).to match(/.*-rw-------.*nobody\s#{nogroup}.*/m)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'cat /etc/ceph/ceph.client.volumes.keyring' do |r|
expect(r.stdout).to match(/.*\[client.volumes\].*key = #{volume_key}.*caps mon = "allow \*".*caps osd = "allow rw".*/m)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES=first \
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_key_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,332 +0,0 @@
#
# Copyright 2013,2014 Cloudwatt <libre-licensing@cloudwatt.com>
# Copyright (C) Nine Internet Solutions AG
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph::mon' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_host = '$::ipaddress'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
releases.each do |release|
describe release do
before(:all) do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on one host' do
it 'should install one monitor' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.a/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
expect(r.stdout).to match(/mon.a not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
describe 'on one host', :cephx do
it 'should install one monitor with key' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
}
ceph::mon { 'a':
public_addr => #{mon_host},
key => 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw==',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'test -z "$(cat /etc/ceph/ceph.client.admin.keyring)"' do |r|
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.a/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
expect(r.stdout).to match(/mon.a not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
it 'should install one monitor with keyring' do
key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
keyring = "[mon.]\\n\\tkey = #{key}\\n\\tcaps mon = \"allow *\""
keyring_path = "/tmp/keyring"
shell "echo -e '#{keyring}' > #{keyring_path}"
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
}
ceph::mon { 'a':
public_addr => #{mon_host},
keyring => '#{keyring_path}',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'test -f /etc/ceph/ceph.client.admin.keyring' do |r|
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.a/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
expect(r.stdout).to match(/mon.a not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
describe 'on two hosts' do
it 'should be two hosts' do
expect(machines.size).to eq(2)
end
it 'should install two monitors' do
machines.each do |mon|
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => '10.11.12.2,10.11.12.3',
mon_initial_members => 'first,second',
public_network => '10.11.12.0/24',
authentication_type => 'none',
}
ceph::mon { '#{mon}':
authentication_type => 'none',
}
EOS
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/2 mons .* quorum 0,1/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall two monitors' do
machines.each do |mon|
pp = <<-EOS
ceph::mon { '#{mon}':
ensure => absent,
}
EOS
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell "status ceph-mon id=#{mon}" do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.#{mon}/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell "service ceph status mon.#{mon}" do |r|
expect(r.stdout).to match(/mon.#{mon} not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=two-ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system \
# SPEC=spec/system/ceph_mon_spec.rb \
# SPEC_OPTS='--tag cephx' &&
# git checkout Gemfile
# "
# End:

View File

@ -1,499 +0,0 @@
#
# Copyright (C) Nine Internet Solutions AG
#
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph::mons' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
fixture_path = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures'))
data = File.join(fixture_path, 'data/data')
snt_data = File.join(fixture_path, 'scenario_node_terminus/data')
data_path = '/etc/puppet/data'
hiera_config = File.join(fixture_path, 'data/hiera.yaml')
snt_hiera_config = File.join(fixture_path, 'scenario_node_terminus/hiera.yaml')
hiera_config_file = '/etc/puppet/hiera.yaml'
user_hiera_file = '/etc/puppet/data/hiera_data/user.yaml'
user_params_file = '/etc/puppet/data/global_hiera_params/user.yaml'
minimal_hiera_config = <<-EOS
---
:logger: noop
EOS
data_site_pp = <<-'EOS'
$role = mon
if ! $::role {
$role = regsubst($::clientcert, '([a-zA-Z]+)[^a-zA-Z].*', '\1')
}
$scenario = hiera('scenario', "")
$auth_type = hiera('auth_type', "")
$ensure = hiera('ensure', "")
node default {
notice("my scenario is ${scenario}")
notice("my role is ${role}")
# Should be defined in scenario/[name_of_scenario]/[name_of_role].yaml
$node_class_groups = hiera_array('class_groups', undef)
notice("class groups: ${node_class_groups}")
if $node_class_groups {
class_group { $node_class_groups: }
}
$node_classes = hiera_array('classes', undef)
if $node_classes {
include $node_classes
notify { " Including node classes : ${node_classes}": }
}
}
define class_group {
include hiera($name)
notice($name)
$x = hiera($name)
notice( "including ${x}" )
}
EOS
describe 'data' do
before(:all) do
machines.each do |vm|
rcp(:sp => data, :dp => data_path, :d => node(:name => vm))
rcp(:sp => hiera_config, :dp => hiera_config_file, :d => node(:name => vm))
end
end
after(:all) do
machines.each do |vm|
file = Tempfile.new('hieraconfig')
begin
file.write(minimal_hiera_config)
file.close
rcp(:sp => file.path, :dp => hiera_config_file, :d => node(:name => vm))
ensure
file.unlink
end
shell(:node => vm, :command => 'rm -rf /etc/puppet/data')
end
end
releases.each do |release|
describe release do
describe 'on one host' do
it 'should install one monitor' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
---
release: #{release}
fsid: '#{fsid}'
# Global Hiera Params:
scenario: 2_role
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
puppet_apply(data_site_pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
release: #{release}
# Global Hiera Params:
ensure: purged
scenario: 2_role
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
puppet_apply(data_site_pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/status: Unknown job: ceph-mon/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/ceph: unrecognized service/)
expect(r.exit_code).not_to be_zero
end
end
end
end
describe 'on one host', :cephx do
it 'should install one monitor' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
---
release: #{release}
fsid: '#{fsid}'
mon_key: '#{mon_key}'
# Global Hiera Params:
scenario: 2_role
auth_type: cephx
#################
# Data Mappings #
#################
ceph::keys::args:
'client.admin':
secret: '#{admin_key}'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: allow
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
puppet_apply(data_site_pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'cat /etc/ceph/ceph.client.admin.keyring' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
---
release: #{release}
# Global Hiera Params:
ensure: purged
scenario: 2_role
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
puppet_apply(data_site_pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/status: Unknown job: ceph-mon/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/ceph: unrecognized service/)
expect(r.exit_code).not_to be_zero
end
end
end
end
end
end
end
describe 'scenario_node_terminus' do
before(:all) do
pp = <<-EOS
ini_setting { 'puppetmastermodulepath':
ensure => present,
path => '/etc/puppet/puppet.conf',
section => 'main',
setting => 'node_terminus',
value => 'scenario',
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
rcp(:sp => snt_data, :dp => data_path, :d => node(:name => vm))
rcp(:sp => snt_hiera_config, :dp => hiera_config_file, :d => node(:name => vm))
end
end
after(:all) do
machines.each do |vm|
file = Tempfile.new('hieraconfig')
begin
file.write(minimal_hiera_config)
file.close
rcp(:sp => file.path, :dp => hiera_config_file, :d => node(:name => vm))
ensure
file.unlink
end
shell(:node => vm, :command => "sed -i '/^\\s*node_terminus\\s*=\\s*scenario\\s*$/d' /etc/puppet/puppet.conf")
shell(:node => vm, :command => 'rm -rf /etc/puppet/data')
end
end
releases.each do |release|
describe release do
describe 'on one host' do
it 'should install one monitor' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
fsid: '#{fsid}'
release: #{release}
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
ensure: present
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
ensure: purged
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/status: Unknown job: ceph-mon/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/ceph: unrecognized service/)
expect(r.exit_code).not_to be_zero
end
end
end
end
describe 'on one host', :cephx do
it 'should install one monitor' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
---
fsid: '#{fsid}'
release: #{release}
ceph::keys::args:
'client.admin':
secret: '#{admin_key}'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: allow
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
auth_type: cephx
ensure: present
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'cat /etc/ceph/ceph.client.admin.keyring' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
ensure: purged
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/status: Unknown job: ceph-mon/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/ceph: unrecognized service/)
expect(r.exit_code).not_to be_zero
end
end
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES=hammer \
# MACHINES=first \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system \
# SPEC=spec/system/ceph_mons_spec.rb \
# SPEC_OPTS='--tag cephx' | tee /tmp/puppet.log &&
# git checkout Gemfile
# "
# End:

View File

@ -1,435 +0,0 @@
#
# Copyright 2014 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph::osd' do
datas = ENV['DATAS'] ? ENV['DATAS'].split : [ '/dev/sdb', '/srv/data' ]
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
mon_host = '$::ipaddress'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
purge = <<-EOS
ceph::mon { 'a': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/etc/ceph/ceph.client.admin.keyring',
]:
ensure => absent
}
->
package { #{packages}:
ensure => purged
}
EOS
releases.each do |release|
describe release do
before(:all) do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
datas.each do |data|
it 'should install one OSD no cephx' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph_config {
'global/osd_journal_size': value => '100';
}
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
ceph::osd { '#{data}': }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '#{data}':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell "test -b #{data} && ceph-disk zap #{data}"
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install one osd with cephx' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
}
ceph_config {
'global/osd_journal_size': value => '100';
}
ceph::mon { 'a':
public_addr => #{mon_host},
key => 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw==',
}
ceph::key { 'client.admin':
secret => '#{admin_key}',
cap_mon => 'allow *',
cap_osd => 'allow *',
cap_mds => 'allow *',
inject => true,
inject_as_id => 'mon.',
inject_keyring => '/var/lib/ceph/mon/ceph-a/keyring',
}
->
exec { 'bootstrap-key':
command => '/usr/sbin/ceph-create-keys --id a',
}
->
ceph::osd { '#{data}': }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '#{data}': ensure => absent, }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell "test -b #{data} && ceph-disk zap #{data}"
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install one osd with external journal and no cephx' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph_config {
'global/osd_journal_size': value => '100';
}
ceph::mon { 'a':
public_addr => #{mon_host},
key => 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw==',
authentication_type => 'none',
}
ceph::osd { '#{data}':
journal => '/srv/journal'
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd and external journal' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '#{data}': ensure => absent, }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell "test -b #{data} && ceph-disk zap #{data}"
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install one OSD no cephx on a partition' do
shell 'sgdisk --largest-new=1 --change-name="1:ceph data" --partition-guid=1:7aebb13f-d4a5-4b94-8622-355d2b5401f1 --typecode=1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d -- /dev/sdb' do |r|
expect(r.exit_code).to be_zero
end
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph_config {
'global/osd_journal_size': value => '100';
}
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
ceph::osd { '/dev/sdb1': }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb1':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell 'ceph-disk zap /dev/sdb'
end
it 'should install one OSD no cephx on partition and activate after umount' do
shell 'sgdisk --delete=1 /dev/sdb || true; sgdisk --largest-new=1 --change-name="1:ceph data" --partition-guid=1:7aebb13f-d4a5-4b94-8622-355d2b5401f1 --typecode=1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d -- /dev/sdb' do |r|
expect(r.exit_code).to be_zero
end
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph_config {
'global/osd_journal_size': value => '100';
}
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
ceph::osd { '/dev/sdb1': }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
# stop and umount (but leave it prepared)
shell 'stop ceph-osd id=0 || /etc/init.d/ceph stop osd.0; umount /dev/sdb1' do |r|
expect(r.exit_code).to be_zero
end
# rerun puppet (should activate but not prepare)
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
# check osd up and same osd.id
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0\s*up/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb1':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell 'ceph-disk zap /dev/sdb'
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES=first \
# RELEASES=hammer \
# DATAS=/srv/data \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_osd_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,235 +0,0 @@
#
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph::osds' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
bootstrap_osd_key = 'AQCVio9T+BD9HBAAuSh15WdZYJOrSwnU/cbJsg=='
fixture_path = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures'))
data = File.join(fixture_path, 'scenario_node_terminus/data')
data_path = '/etc/puppet/data'
config_file = data_path + '/config.yaml'
role_mappings_file = data_path + '/role_mappings.yaml'
hiera_config = File.join(fixture_path, 'scenario_node_terminus/hiera.yaml')
hiera_config_file = '/etc/puppet/hiera.yaml'
user_hiera_file = data_path + '/hiera_data/user.yaml'
user_params_file = data_path + '/global_hiera_params/user.yaml'
minimal_hiera_config = <<-EOS
---
:logger: noop
EOS
before(:all) do
pp = <<-EOS
ini_setting { 'puppetmastermodulepath':
ensure => present,
path => '/etc/puppet/puppet.conf',
section => 'main',
setting => 'node_terminus',
value => 'scenario',
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
rcp(:sp => data, :dp => data_path, :d => node(:name => vm))
rcp(:sp => hiera_config, :dp => hiera_config_file, :d => node(:name => vm))
file = Tempfile.new('config')
begin
file.write(<<-EOS)
scenario: allinone
EOS
file.close
rcp(:sp => file.path, :dp => config_file, :d => node)
ensure
file.unlink
end
file = Tempfile.new('role_mappings')
begin
file.write(<<-EOS)
first: allinone
second: osd
EOS
file.close
rcp(:sp => file.path, :dp => role_mappings_file, :d => node)
ensure
file.unlink
end
end
end
after(:all) do
machines.each do |vm|
file = Tempfile.new('hieraconfig')
begin
file.write(minimal_hiera_config)
file.close
rcp(:sp => file.path, :dp => hiera_config_file, :d => node(:name => vm))
ensure
file.unlink
end
shell(:node => vm, :command => "sed -i '/^\\s*node_terminus\\s*=\\s*scenario\\s*$/d' /etc/puppet/puppet.conf")
shell(:node => vm, :command => 'rm -rf /etc/puppet/data')
end
end
releases.each do |release|
describe release do
after(:each) do
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
ensure: purged
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
machines.each do |vm|
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
end
shell(:node => vm, :command => 'test -b /dev/sdb && sgdisk --zap-all --clear --mbrtogpt -- /dev/sdb')
shell(:node => vm, :command => 'rm -rf /var/lib/ceph; rm -rf /etc/ceph')
end
end
describe 'on one host' do
it 'should install one OSD' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
fsid: '#{fsid}'
release: #{release}
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
ensure: present
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
end
describe 'on one host', :cephx do
it 'should install one OSD' do
file = Tempfile.new('user_hiera_data')
begin
file.write(<<-EOS)
---
fsid: '#{fsid}'
release: #{release}
ceph::keys::args:
'client.admin':
secret: '#{admin_key}'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: allow
'client.bootstrap-osd':
secret: '#{bootstrap_osd_key}'
cap_mon: 'allow profile bootstrap-osd'
keyring_path: '/var/lib/ceph/bootstrap-osd/ceph.keyring'
EOS
file.close
rcp(:sp => file.path, :dp => user_hiera_file, :d => node)
ensure
file.unlink
end
file = Tempfile.new('user_params')
begin
file.write(<<-EOS)
auth_type: cephx
ensure: present
EOS
file.close
rcp(:sp => file.path, :dp => user_params_file, :d => node)
ensure
file.unlink
end
puppet_apply('') do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES=hammer \
# MACHINES=first \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system \
# SPEC=spec/system/ceph_osds_spec.rb \
# SPEC_OPTS='--tag cephx' | tee /tmp/puppet.log &&
# git checkout Gemfile
# "
# End:

View File

@ -1,161 +0,0 @@
#
# Copyright (C) 2014 Catalyst IT Limited.
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
# Author: David Gurtner <aldavud@crimson.ch>
#
require 'spec_helper_system'
describe 'ceph::pool' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_host = '$::ipaddress'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
releases.each do |release|
describe release do
before(:all) do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
after(:all) do
pp = <<-EOS
ceph::mon { 'a': ensure => absent }
->
file { '/var/lib/ceph/bootstrap-osd/ceph.keyring': ensure => absent }
->
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
ensure => absent,
release => '#{release}',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install and create pool volumes' do
pp = <<-EOS
ceph::pool { 'volumes':
pg_num => 64,
pgp_num => 64,
size => 3,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd pool get volumes pg_num' do |r|
expect(r.stdout).to match(/pg_num: 64/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd pool get volumes pgp_num' do |r|
expect(r.stdout).to match(/pgp_num: 64/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd pool get volumes size' do |r|
expect(r.stdout).to match(/size: 3/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should install and delete pool volumes' do
pp = <<-EOS
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }
exec { 'create-volumes':
command => 'ceph osd pool create volumes 64',
unless => 'ceph osd lspools | grep volumes',
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
pp2 = <<-EOS
ceph::pool { 'volumes':
ensure => absent,
}
EOS
puppet_apply(pp2) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).to eq(0)
end
shell 'ceph osd lspools | grep volumes' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES=first \
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_pool_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,132 +0,0 @@
#
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph::profile::base' do
release2version = {
'firefly' => '0.80',
'hammer' => '0.94',
}
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : release2version.keys
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
hieradata_common = '/var/lib/hiera/common.yaml'
hiera_shared = <<-EOS
---
ceph::profile::params::fsid: '#{fsid}'
EOS
releases.each do |release|
describe release do
version = release2version[release]
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on one host' do
it 'should install ceph' do
osfamily = facter.facts['osfamily']
osfamily2querycommand = {
'Debian' => 'apt-cache policy ceph',
'RedHat' => 'yum info ceph',
}
osfamily2queryresult = {
'Debian' => "Candidate: #{version}" ,
'RedHat' => "Version : #{version}",
}
querycommand = osfamily2querycommand[osfamily]
queryresult = osfamily2queryresult[osfamily]
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::base
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'cat /etc/ceph/ceph.conf' do |r|
expect(r.stdout).to match(/#{fsid}/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell querycommand do |r|
expect(r.stdout).to match(/#{queryresult}/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES=first \
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_profile_base_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,260 +0,0 @@
#
# Copyright 2014 (C) Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: David Gurtner <aldavud@crimson.ch>
# Author: David Moreau Simard <dmsimard@iweb.com>
#
require 'spec_helper_system'
describe 'ceph::profile::client' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
volumes_key = 'AQA4MPZTOGU0ARAAXH9a0fXxVq0X25n2yPREDw=='
mon_key = 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg=='
hieradata_common = '/var/lib/hiera/common.yaml'
hiera_shared = <<-EOS
---
ceph::profile::params::fsid: '#{fsid}'
ceph::profile::params::mon_initial_members: 'first'
ceph::profile::params::mon_host: '10.11.12.2:6789'
EOS
purge = <<-EOS
ceph::mon { 'first': ensure => absent }
->
file { [
'/etc/ceph/ceph.client.admin.keyring',
'/etc/ceph/ceph.client.volumes.keyring'
]:
ensure => absent
}
EOS
releases.each do |release|
describe release do
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on one host' do
it 'should install one monitor and one extra client on one host', :cephx do
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::mon_key: '#{mon_key}'
ceph::profile::params::client_keys:
'client.admin':
secret: #{admin_key}
mode: '0600'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: 'allow *'
'client.volumes':
secret: #{volumes_key}
mode: '0644'
user: 'root'
group: 'root'
cap_mon: 'allow r'
cap_osd: 'allow class-read object_prefix rbd_children, allow rwx pool=volumes'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
include ::ceph::profile::client
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph -n client.volumes -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{volumes_key}/)
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on two hosts' do
it 'should install one monitor on first host, one client on second host', :cephx do
['first', 'second'].each do |vm|
if vm == "first"
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::mon_key: '#{mon_key}'
ceph::profile::params::client_keys:
'client.admin':
secret: #{admin_key}
mode: '0600'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: 'allow *'
'client.volumes':
secret: #{volumes_key}
mode: '0644'
user: 'root'
group: 'root'
cap_mon: 'allow r'
cap_osd: 'allow class-read object_prefix rbd_children, allow rwx pool=volumes'
EOS
end
if vm == "second"
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::client_keys:
'client.volumes':
secret: #{volumes_key}
mode: '0644'
user: 'root'
group: 'root'
cap_mon: 'allow r'
cap_osd: 'allow class-read object_prefix rbd_children, allow rwx pool=volumes'
EOS
end
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node(:name => vm))
ensure
file.unlink
end
if vm == "first"
pp = <<-EOS
include ::ceph::profile::mon
EOS
end
if vm == "second"
pp = <<-EOS
include ::ceph::profile::client
EOS
end
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
['first', 'second'].each do |vm|
if vm == "first"
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.exit_code).to be_zero
end
end
if vm == "second"
shell 'ceph -n client.volumes -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
end
end
it 'should uninstall one monitor' do
[ 'second', 'first' ].each do |vm|
puppet_apply(:node => vm, :code => purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES=hammer \
# RS_SET=two-ubuntu-server-1204-x64 \
# RS_DESTROY=no \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_profile_client_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,378 +0,0 @@
#
# Copyright 2014 (C) Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: David Gurtner <aldavud@crimson.ch>
# Author: David Moreau Simard <dmsimard@iweb.com>
#
require 'spec_helper_system'
describe 'ceph::profile::mon' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
admin_key = 'AQBMGHJTkC8HKhAAJ7NH255wYypgm1oVuV41MA=='
mon_key = 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg=='
hieradata_common = '/var/lib/hiera/common.yaml'
hiera_shared = <<-EOS
---
ceph::profile::params::fsid: '#{fsid}'
EOS
releases.each do |release|
describe release do
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on one host' do
it 'should install one monitor' do
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'none'
ceph::profile::params::mon_initial_members: 'first'
ceph::profile::params::mon_host: '10.11.12.2:6789'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'first':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.first/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to match(/mon.first not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
describe 'on one host', :cephx do
it 'should install one monitor with key' do
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::mon_key: '#{mon_key}'
ceph::profile::params::mon_initial_members: 'first'
ceph::profile::params::mon_host: '10.11.12.2:6789'
ceph::profile::params::client_keys:
'client.admin':
secret: #{admin_key}
mode: '0600'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: 'allow *'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'first':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.first/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to match(/mon.first not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
it 'should install one monitor with keyring' do
key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
keyring = "[mon.]\\n\\tkey = #{key}\\n\\tcaps mon = \"allow *\""
keyring_path = "/tmp/keyring"
shell "echo -e '#{keyring}' > #{keyring_path}"
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::mon_keyring: '#{keyring_path}'
ceph::profile::params::mon_initial_members: 'first'
ceph::profile::params::mon_host: '10.11.12.2:6789'
ceph::profile::params::client_keys:
'client.admin':
secret: #{admin_key}
mode: '0600'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: 'allow *'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph auth list' do |r|
expect(r.stdout).to match(/#{admin_key}/)
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'first':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.first/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to match(/mon.first not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
describe 'on two hosts' do
it 'should be two hosts' do
expect(machines.size).to eq(2)
end
it 'should install two monitors' do
[ 'first', 'second' ].each do |mon|
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'none'
ceph::profile::params::public_network: '10.11.12.0/24'
ceph::profile::params::mon_initial_members: 'first, second'
ceph::profile::params::mon_host: '10.11.12.2,10.11.12.3'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node(:name => mon))
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
EOS
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/2 mons .* quorum 0,1 first,second/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall two monitors' do
machines.each do |mon|
pp = <<-EOS
ceph::mon { '#{mon}':
ensure => absent,
}
EOS
puppet_apply(:node => mon, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell "status ceph-mon id=#{mon}" do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.#{mon}/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell "service ceph status mon.#{mon}" do |r|
expect(r.stdout).to match(/mon.#{mon} not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES='first second' \
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=two-ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system \
# SPEC=spec/system/ceph_profile_mon_spec.rb \
# SPEC_OPTS='--tag cephx' &&
# git checkout Gemfile
# "
# End:

View File

@ -1,461 +0,0 @@
#
# Copyright 2014 (C) Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: David Gurtner <aldavud@crimson.ch>
#
require 'spec_helper_system'
describe 'ceph::profile::osd' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
mon_key = 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg=='
bootstrap_osd_key = 'AQARG3JTsDDEHhAAVinHPiqvJkUi5Mww/URupw=='
hieradata_common = '/var/lib/hiera/common.yaml'
hiera_shared = <<-EOS
---
ceph::profile::params::fsid: '#{fsid}'
ceph::profile::params::mon_initial_members: 'first'
ceph::profile::params::mon_host: '10.11.12.2:6789'
EOS
purge = <<-EOS
ceph::mon { 'first': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/etc/ceph/ceph.client.admin.keyring',
]:
ensure => absent
}
EOS
releases.each do |release|
describe release do
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on one host' do
it 'should install one monitor and one osd' do
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'none'
ceph::profile::params::osds:
'/dev/sdb': {}
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
include ::ceph::profile::osd
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell 'ceph-disk zap /dev/sdb'
end
it 'should uninstall one monitor' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install one monitor and one osd with external journal' do
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'none'
ceph::profile::params::osds:
'/dev/sdb':
journal: '/srv/journal'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
include ::ceph::profile::osd
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb': ensure => absent, }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell 'ceph-disk zap /dev/sdb'
end
it 'should uninstall one monitor' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install one monitor and one osd', :cephx do
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::mon_key: '#{mon_key}'
ceph::profile::params::osds:
'/dev/sdb': {}
ceph::profile::params::client_keys:
'client.admin':
secret: #{admin_key}
mode: '0600'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: 'allow *'
'client.bootstrap-osd':
secret: #{bootstrap_osd_key}
keyring_path: '/var/lib/ceph/bootstrap-osd/ceph.keyring'
cap_mon: 'allow profile bootstrap-osd'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node)
ensure
file.unlink
end
pp = <<-EOS
include ::ceph::profile::mon
include ::ceph::profile::osd
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb': ensure => absent, }
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell 'ceph-disk zap /dev/sdb'
end
it 'should uninstall one monitor and all packages' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
describe 'on two hosts' do
it 'should install one monitor on first host, one osd on second host' do
[ 'first', 'second' ].each do |vm|
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'none'
ceph::profile::params::osds:
'/dev/sdb': {}
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node(:name => vm))
ensure
file.unlink
end
if vm == "first"
pp = <<-EOS
include ::ceph::profile::mon
EOS
end
if vm == "second"
pp = <<-EOS
include ::ceph::profile::osd
EOS
end
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd on second host' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb': ensure => absent, }
EOS
puppet_apply(:node => 'second', :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell(:node => 'second', :command => 'ceph-disk zap /dev/sdb')
puppet_apply(:node => 'second', :code => purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should uninstall one monitor on first host' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should install one monitor on first host, one osd on second host', :cephx do
[ 'first', 'second' ].each do |vm|
hiera = <<-EOS
ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'cephx'
ceph::profile::params::mon_key: '#{mon_key}'
ceph::profile::params::osds:
'/dev/sdb': {}
ceph::profile::params::client_keys:
'client.admin':
secret: #{admin_key}
mode: '0600'
cap_mon: 'allow *'
cap_osd: 'allow *'
cap_mds: 'allow *'
'client.bootstrap-osd':
secret: #{bootstrap_osd_key}
keyring_path: '/var/lib/ceph/bootstrap-osd/ceph.keyring'
cap_mon: 'allow profile bootstrap-osd'
EOS
file = Tempfile.new('hieradata')
begin
file.write(hiera_shared + hiera)
file.close
rcp(:sp => file.path, :dp => hieradata_common, :d => node(:name => vm))
ensure
file.unlink
end
if vm == "first"
pp = <<-EOS
include ::ceph::profile::mon
EOS
end
if vm == "second"
pp = <<-EOS
include ::ceph::profile::osd
EOS
end
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons .* quorum 0 first/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd on second host' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
# for osd removal we need additional credentials
# not included in the bootstrap-osd keyring
class { '::ceph::profile::client': } ->
ceph::osd { '/dev/sdb': ensure => absent, }
EOS
puppet_apply(:node => 'second', :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
shell(:node => 'second', :command => 'ceph-disk zap /dev/sdb')
puppet_apply(:node => 'second', :code => purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
it 'should uninstall one monitor' do
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES=hammer \
# RS_SET=two-ubuntu-server-1204-x64 \
# RS_DESTROY=no \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_profile_osd_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,319 +0,0 @@
#
# Copyright (C) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright 2014 (C) Nine Internet Solutions AG
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <aldavud@crimson.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph::repo' do
release2version = {
'firefly' => '0.80',
'hammer' => '0.94',
'(default)' => '0.94',
}
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : release2version.keys
# on RedHat family we need to remove with the correct release,
# and at this point we do not know what is currently installed
it 'should remove repo independent of release' do
releases.each do |release|
release_arg = release == '(default)' ? '' : "release => '#{release}',"
pp = <<-EOS
class { 'ceph::repo':
#{release_arg}
ensure => absent,
extras => true,
fastcgi => true,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
osfamily = facter.facts['osfamily']
if osfamily == 'Debian'
shell 'apt-cache policy ceph' do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'apt-cache policy curl' do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.exit_code).to be_zero
end
shell 'apt-cache policy libapache2-mod-fastcgi' do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell 'yum info ceph' do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.stderr).to match(/Error: No matching Packages to list/)
expect(r.exit_code).not_to be_zero
end
shell 'yum info qemu-kvm' do |r|
expect(r.stdout).not_to match(/Repo.*ext-ceph-extras/)
expect(r.exit_code).to be_zero
end
shell 'yum info mod_fastcgi' do |r|
expect(r.stdout).not_to match(/Repo.*ext-ceph-fastcgi/)
expect(r.stderr).to match(/Error: No matching Packages to list/)
expect(r.exit_code).not_to be_zero
end
end
end
releases.each do |release|
release_arg = release == '(default)' ? '' : "release => '#{release}',"
describe release do
version = release2version[release]
it "should find #{version}" do
osfamily = facter.facts['osfamily']
osfamily2querycommand = {
'Debian' => 'apt-cache policy ceph',
'RedHat' => 'yum info ceph',
}
osfamily2queryresult = {
'Debian' => "Candidate: #{version}" ,
'RedHat' => "Version : #{version}",
}
querycommand = osfamily2querycommand[osfamily]
queryresult = osfamily2queryresult[osfamily]
pp = <<-EOS
class { 'ceph::repo':
#{release_arg}
}
EOS
# Run it twice and test for idempotency
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell querycommand do |r|
expect(r.stdout).to match(/#{queryresult}/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
# Test extras is not enabled
if osfamily == 'Debian'
shell 'apt-cache policy curl' do |r|
expect(r.stdout).not_to match(/ceph\.com.*ceph-extras/)
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell 'yum info qemu-kvm' do |r|
expect(r.stdout).not_to match(/Repo.*ext-ceph-extras/)
expect(r.exit_code).to be_zero
end
end
# On RedHat family we need to use the version when removing
pp = <<-EOS
class { 'ceph::repo':
ensure => absent,
#{release_arg}
}
EOS
# Run it twice and test for idempotency
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
if osfamily == 'Debian'
shell querycommand do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell querycommand do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.stderr).to match(/Error: No matching Packages to list/)
expect(r.exit_code).not_to be_zero
end
end
end
it "should find curl/qemu-kvm in ceph-extras" do
osfamily = facter.facts['osfamily']
pp = <<-EOS
class { 'ceph::repo':
#{release_arg}
extras => true,
}
EOS
# Run it twice and test for idempotency
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
# Test for a package in ceph-extras (curl/qemu-kvm)
if osfamily == 'Debian'
shell 'apt-cache policy curl' do |r|
expect(r.stdout).to match(/ceph\.com.*ceph-extras/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell 'yum info qemu-kvm' do |r|
expect(r.stdout).to match(/Repo.*ext-ceph-extras/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
# On RedHat family we need to use the version when removing
pp = <<-EOS
class { 'ceph::repo':
ensure => absent,
extras => true,
#{release_arg}
}
EOS
# Run it twice and test for idempotency
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
if osfamily == 'Debian'
shell 'apt-cache policy curl' do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell 'yum info qemu-kvm' do |r|
expect(r.stdout).not_to match(/Repo.*ext-ceph-extras/)
expect(r.exit_code).to be_zero
end
end
end
it "should find fastcgi in ceph-fastcgi" do
osfamily = facter.facts['osfamily']
pp = <<-EOS
class { 'ceph::repo':
#{release_arg}
fastcgi => true,
}
EOS
# Run it twice and test for idempotency
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
# Test fastcgi in ceph-fastcgi
if osfamily == 'Debian'
shell 'apt-cache policy libapache2-mod-fastcgi' do |r|
expect(r.stdout).to match(/ceph.com/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell 'yum info mod_fastcgi' do |r|
expect(r.stdout).to match(/Repo.*ext-ceph-fastcgi/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
# On RedHat family we need to use the version when removing
pp = <<-EOS
class { 'ceph::repo':
ensure => absent,
fastcgi => true,
#{release_arg}
}
EOS
# Run it twice and test for idempotency
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
if osfamily == 'Debian'
shell 'apt-cache policy libapache2-mod-fastcgi' do |r|
expect(r.stdout).not_to match(/ceph.com/)
expect(r.exit_code).to be_zero
end
end
if osfamily == 'RedHat'
shell 'yum info mod_fastcgi' do |r|
expect(r.stdout).not_to match(/Repo.*ext-ceph-fastcgi/)
expect(r.stderr).to match(/Error: No matching Packages to list/)
expect(r.exit_code).not_to be_zero
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES=first \
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_repo_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,216 +0,0 @@
#
# Copyright (C) 2014 Catalyst IT Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
# Author: David Gurtner <aldavud@crimson.ch>
#
require 'spec_helper_system'
describe 'ceph::rgw::apache' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'hammer' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_key ='AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
radosgw_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRwg=='
mon_host = '$::ipaddress'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
releases.each do |release|
describe release do
it 'should install one monitor/osd with a rgw' do
pp = <<-EOS
$apache_user = $::osfamily ? {
'RedHat' => 'apache',
default => 'www-data',
}
class { 'ceph::repo':
release => '#{release}',
fastcgi => true,
}
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
osd_pool_default_size => '1',
osd_pool_default_min_size => '1',
}
ceph::mon { 'a':
public_addr => #{mon_host},
key => '#{mon_key}',
}
ceph::key { 'client.admin':
secret => '#{admin_key}',
cap_mon => 'allow *',
cap_osd => 'allow *',
cap_mds => 'allow *',
inject => true,
inject_as_id => 'mon.',
inject_keyring => '/var/lib/ceph/mon/ceph-a/keyring',
}
->
ceph::key { 'client.radosgw.gateway':
user => $apache_user,
secret => '#{radosgw_key}',
cap_mon => 'allow rwx',
cap_osd => 'allow rwx',
inject => true,
}
->
exec { 'bootstrap-key':
command => '/usr/sbin/ceph-create-keys --id a',
}
->
ceph::osd { '/srv/data': }
host { $::fqdn: # workaround for bad 'hostname -f' in vagrant box
ip => #{mon_host},
}
->
file { '/var/run/ceph': # workaround for bad sysvinit script (ignores socket)
ensure => directory,
owner => $apache_user,
}
->
ceph::rgw { 'radosgw.gateway':
rgw_socket_path => '/var/run/ceph/ceph-client.radosgw.gateway.asok',
}
Ceph::Osd['/srv/data'] -> Service['radosgw-radosgw.gateway']
ceph::rgw::apache { 'radosgw.gateway':
rgw_port => 80,
rgw_socket_path => '/var/run/ceph/ceph-client.radosgw.gateway.asok',
}
ceph_config {
'global/mon_data_avail_warn': value => 10; # workaround for health warn in mon
}
EOS
osfamily = facter.facts['osfamily']
servicequery = {
'Debian' => 'status radosgw id=radosgw.gateway',
'RedHat' => 'service ceph-radosgw status id=radosgw.gateway',
}
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell servicequery[osfamily] do |r|
expect(r.exit_code).to be_zero
end
shell 'radosgw-admin user create --uid=puppet --display-name=puppet-user' do |r|
expect(r.exit_code).to be_zero
end
shell 'radosgw-admin subuser create --uid=puppet --subuser=puppet:swift --access=full' do |r|
expect(r.exit_code).to be_zero
end
# need to create subuser key twice, due to http://tracker.ceph.com/issues/9155
shell "radosgw-admin key create --subuser=puppet:swift --key-type=swift --secret='123456'" do |r|
expect(r.exit_code).to be_zero
end
shell "radosgw-admin key create --subuser=puppet:swift --key-type=swift --secret='123456'" do |r|
expect(r.exit_code).to be_zero
end
shell 'curl -i -H "X-Auth-User: puppet:swift" -H "X-Auth-Key: 123456" http://first/auth/v1.0/' do |r|
expect(r.exit_code).to be_zero
expect(r.stdout).to match(/HTTP\/1\.1 204 No Content/)
expect(r.stdout).not_to match(/401 Unauthorized/)
end
end
it 'should purge everything' do
pp = <<-EOS
ceph::osd { '/srv/data':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
purge = <<-EOS
$radosgw = $::osfamily ? {
'RedHat' => 'ceph-radosgw',
default => 'radosgw',
}
ceph::mon { 'a': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/var/lib/ceph/bootstrap-mds/ceph.keyring',
'/var/lib/ceph/radosgw/ceph-radosgw.gateway',
'/var/lib/ceph/radosgw',
'/etc/ceph/ceph.client.admin.keyring',
'/etc/ceph/ceph.client.radosgw.gateway',
]:
ensure => absent
}
->
package { $radosgw: ensure => purged }
->
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
fastcgi => true,
ensure => absent,
}
class { 'apache':
service_ensure => stopped,
service_enable => false,
}
apache::vhost { "$fqdn-radosgw":
ensure => absent,
docroot => '/var/www',
}
EOS
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1404-x64 \
# MACHINES=first \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_rgw_apache_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,311 +0,0 @@
#
# Copyright (C) 2014 Catalyst IT Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
# Author: David Gurtner <aldavud@crimson.ch>
#
require 'spec_helper_system'
describe 'ceph::rgw::keystone' do
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'firefly', 'hammer' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_key ='AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
radosgw_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRwg=='
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
keystone_admin_token = 'keystonetoken'
keystone_password = '123456'
test_user = 'testuser'
test_password = '123456'
test_email = 'testuser@example.com'
test_tenant = 'openstack'
releases.each do |release|
describe release do
it 'should install one monitor/osd with a rgw and keystone integration' do
pp = <<-EOS
$apache_user = $::osfamily ? {
'RedHat' => 'apache',
default => 'www-data',
}
case $::osfamily {
'Debian': {
include ::apt
apt::source { 'cloudarchive-juno':
location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
release => 'trusty-updates/juno',
repos => 'main',
include_src => false,
required_packages => 'ubuntu-cloud-keyring',
}
Apt::Source['cloudarchive-juno'] -> Package['keystone','python-swiftclient']
Exec['apt_update'] -> Package['keystone','python-swiftclient']
}
'RedHat': {
# ceph-radosgw expects open file limit of 32768
file { '/etc/security/limits.d/80-nofile.conf':
content => '* hard nofile 32768',
}
yumrepo { 'openstack-juno':
descr => 'OpenStack Juno Repository',
baseurl => 'http://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7/',
enabled => '1',
gpgcheck => '1',
gpgkey => 'https://raw.githubusercontent.com/redhat-openstack/rdo-release/juno/RPM-GPG-KEY-RDO-Juno',
priority => '15', # prefer over EPEL, but below ceph
}
Yumrepo<||> -> Package['python-swiftclient','keystone']
}
}
class { 'keystone':
verbose => true,
catalog_type => 'sql',
admin_token => '#{keystone_admin_token}',
admin_endpoint => "http://${::ipaddress}:35357",
}
->
class { 'keystone::roles::admin':
email => 'admin@example.com',
password => '#{keystone_password}',
}
->
class { 'keystone::endpoint':
public_url => "http://${::ipaddress}:5000",
admin_url => "http://${::ipaddress}:35357",
internal_url => "http://${::ipaddress}:5000",
region => 'example-1',
}
# ceph setup
class { 'ceph::repo':
release => '#{release}',
fastcgi => true,
}
->
class { 'ceph':
fsid => '#{fsid}',
mon_host => $::ipaddress,
osd_pool_default_size => '1',
osd_pool_default_min_size => '1',
}
ceph::mon { 'a':
public_addr => $::ipaddress,
key => '#{mon_key}',
}
ceph::key { 'client.admin':
secret => '#{admin_key}',
cap_mon => 'allow *',
cap_osd => 'allow *',
cap_mds => 'allow *',
inject => true,
inject_as_id => 'mon.',
inject_keyring => '/var/lib/ceph/mon/ceph-a/keyring',
}
->
ceph::key { 'client.radosgw.gateway':
user => $apache_user,
secret => '#{radosgw_key}',
cap_mon => 'allow rwx',
cap_osd => 'allow rwx',
inject => true,
}
->
exec { 'bootstrap-key':
command => '/usr/sbin/ceph-create-keys --id a',
}
->
ceph::osd { '/srv/data': }
# setup ceph radosgw
host { $::fqdn: # workaround for bad 'hostname -f' in vagrant box
ip => $ipaddress,
host_aliases => [$::hostname],
}
->
file { '/var/run/ceph': # workaround for bad sysvinit script (ignores socket)
ensure => directory,
owner => $apache_user,
}
->
ceph::rgw { 'radosgw.gateway':
rgw_socket_path => '/var/run/ceph/ceph-client.radosgw.gateway.asok',
}
Ceph::Osd['/srv/data'] -> Service['radosgw-radosgw.gateway']
ceph::rgw::apache { 'radosgw.gateway':
rgw_port => '80',
rgw_socket_path => '/var/run/ceph/ceph-client.radosgw.gateway.asok',
}
package { 'python-swiftclient': # required for tests below
ensure => present,
}
ceph_config {
'global/mon_data_avail_warn': value => 10; # workaround for health warn in mon
'global/osd_journal_size': value => 100;
}
# add the require keystone endpoints for radosgw (object-store)
Service['keystone'] -> Ceph::Rgw::Keystone['radosgw.gateway']
ceph::rgw::keystone { 'radosgw.gateway':
rgw_keystone_url => "http://${::ipaddress}:5000",
rgw_keystone_admin_token => '#{keystone_admin_token}',
}
keystone_service { 'swift':
ensure => present,
type => 'object-store',
description => 'Openstack Object Storage Service',
}
Keystone_service<||> -> Ceph::Rgw::Keystone['radosgw.gateway']
keystone_endpoint { 'example-1/swift':
ensure => present,
public_url => "http://${::fqdn}:80/swift/v1",
admin_url => "http://${::fqdn}:80/swift/v1",
internal_url => "http://${::fqdn}:80/swift/v1",
}
Keystone_endpoint<||> -> Ceph::Rgw::Keystone['radosgw.gateway']
# add a testuser for validation below
keystone_user { '#{test_user}':
ensure => present,
enabled => true,
email => '#{test_email}',
password => '#{test_password}',
tenant => '#{test_tenant}',
}
Keystone_user<||> -> Ceph::Rgw::Keystone['radosgw.gateway']
keystone_user_role { 'testuser@openstack':
ensure => present,
roles => ['_member_'],
}
Keystone_user_role<||> -> Ceph::Rgw::Keystone['radosgw.gateway']
EOS
osfamily = facter.facts['osfamily']
servicequery = {
'Debian' => 'status radosgw id=radosgw.gateway',
'RedHat' => 'service ceph-radosgw status id=radosgw.gateway',
}
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
shell servicequery[osfamily] do |r|
expect(r.exit_code).to be_zero
end
shell "swift -V 2.0 -A http://127.0.0.1:5000/v2.0 -U #{test_tenant}:#{test_user} -K #{test_password} stat" do |r|
expect(r.exit_code).to be_zero
expect(r.stdout).to match(/Content-Type: text\/plain; charset=utf-8/)
expect(r.stdout).not_to match(/401 Unauthorized/)
end
end
it 'should purge everything' do
pp = <<-EOS
ceph::osd { '/srv/data':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
#shell 'ceph-disk zap /dev/sdb'
purge = <<-EOS
$radosgw = $::osfamily ? {
'RedHat' => 'ceph-radosgw',
default => 'radosgw',
}
class { 'keystone':
admin_token => 'keystonetoken',
enabled => false,
}
->
ceph::mon { 'a': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/var/lib/ceph/bootstrap-mds/ceph.keyring',
'/var/lib/ceph/nss/cert8.db',
'/var/lib/ceph/nss/key3.db',
'/var/lib/ceph/nss/secmod.db',
'/var/lib/ceph/radosgw/ceph-radosgw.gateway',
'/var/lib/ceph/radosgw',
'/var/lib/ceph/nss',
'/etc/ceph/ceph.client.admin.keyring',
'/etc/ceph/ceph.client.radosgw.gateway',
]:
ensure => absent
}
->
package { $radosgw: ensure => purged }
->
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
fastcgi => true,
ensure => absent,
}
class { 'apache':
service_ensure => stopped,
service_enable => false,
}
apache::vhost { "$fqdn-radosgw":
ensure => absent,
docroot => '/var/www',
}
EOS
puppet_apply(purge) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# MACHINES=first \
# RELEASES=hammer \
# RS_DESTROY=no \
# RS_SET=ubuntu-server-1404-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_rgw_keystone_spec.rb &&
# git checkout Gemfile
# "
# End:

View File

@ -1,426 +0,0 @@
#
# Copyright (C) Nine Internet Solutions AG
#
# Author: David Gurtner <david@nine.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'spec_helper_system'
describe 'ceph usecases' do
# this test relies entirely on there being 2 machines with those exact names
machines = [ 'first', 'second' ]
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
describe 'I want to try this module, heard of ceph, want to see it in action' do
it 'should install one monitor and one OSD on /srv/data' do
pp = <<-EOS
class { 'ceph::repo': }
class { 'ceph':
fsid => generate('/usr/bin/uuidgen'),
mon_host => $::ipaddress,
authentication_type => 'none',
osd_pool_default_size => '1',
osd_pool_default_min_size => '1',
}
ceph_config {
'global/osd_journal_size': value => '100';
}
ceph::mon { 'a':
public_addr => $::ipaddress,
authentication_type => 'none',
}
ceph::osd { '/srv/data': }
EOS
puppet_apply(pp) do |r|
# due to the generate() the above is not idempotent
# so we don't run twice as usual
expect(r.exit_code).not_to eq(1)
end
shell 'sleep 30' # we need to wait a bit until the OSD is up
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/srv/data':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.a/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
expect(r.stdout).to match(/mon.a not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
it 'should purge all packages' do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
describe 'I want to operate a production cluster' do
it 'should install one monitor with key and one OSD' do
# this usecase is simplified to accomodate for the fact that
# there are only 2 hosts availble for integration testing
pp = <<-EOS
$admin_key = 'AQCTg71RsNIHORAAW+O6FCMZWBjmVfMIPk3MhQ=='
$mon_key = 'AQDesGZSsC7KJBAAw+W/Z4eGSQGAIbxWjxjvfw=='
$bootstrap_osd_key = 'AQABsWZSgEDmJhAAkAGSOOAJwrMHrM5Pz5On1A=='
$fsid = '066F558C-6789-4A93-AAF1-5AF1BA01A3AD'
node /first/ {
class { 'ceph::repo': }
class { 'ceph':
fsid => $fsid,
mon_initial_members => 'first',
mon_host => '10.11.12.2',
}
ceph::mon { $::hostname:
key => $mon_key,
}
Ceph::Key {
inject => true,
inject_as_id => 'mon.',
inject_keyring => "/var/lib/ceph/mon/ceph-${::hostname}/keyring",
}
ceph::key { 'client.admin':
secret => $admin_key,
cap_mon => 'allow *',
cap_osd => 'allow *',
cap_mds => 'allow',
}
ceph::key { 'client.bootstrap-osd':
secret => $bootstrap_osd_key,
cap_mon => 'allow profile bootstrap-osd',
}
}
node /second/ {
class { 'ceph::repo': }
class { 'ceph':
fsid => $fsid,
mon_initial_members => 'first',
mon_host => '10.11.12.2',
}
ceph::osd { '/dev/sdb': }
ceph::key{'client.bootstrap-osd':
keyring_path => '/var/lib/ceph/bootstrap-osd/ceph.keyring',
secret => $bootstrap_osd_key,
}
ceph::key { 'client.admin':
secret => $admin_key
}
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one osd' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb':
ensure => absent,
}
EOS
puppet_apply(:node => 'second', :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell(:node => 'second', :command => "test -b /dev/sdb && ceph-disk zap /dev/sdb")
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'first':
ensure => absent,
}
EOS
puppet_apply(:node => 'first', :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.first/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to match(/mon.first not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
it 'should purge all packages' do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
describe 'I want to run benchmarks on three new machines' do
it 'should install one monitor and two OSDs' do
# contrary to the name we will only install two machines
pp = <<-EOS
$fsid = '066F558C-6789-4A93-AAF1-5AF1BA01A3AD'
node /first/ {
class { 'ceph::repo': }
class { 'ceph':
fsid => $fsid,
mon_host => '10.11.12.2',
mon_initial_members => 'first',
authentication_type => 'none',
}
ceph::mon { $::hostname:
authentication_type => 'none',
}
ceph::osd { '/dev/sdb': }
}
node /second/ {
class { 'ceph::repo': }
class { 'ceph':
fsid => $fsid,
mon_host => '10.11.12.2',
mon_initial_members => 'first',
authentication_type => 'none',
}
ceph::osd { '/dev/sdb': }
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
r.refresh
expect(r.exit_code).not_to eq(1)
end
end
shell 'ceph -s' do |r|
expect(r.stdout).to match(/1 mons at/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
shell 'ceph osd tree' do |r|
expect(r.stdout).to match(/osd.0/)
expect(r.stdout).to match(/osd.1/)
expect(r.stderr).to be_empty
expect(r.exit_code).to be_zero
end
end
it 'should uninstall two OSDs' do
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).not_to be_zero
end
pp = <<-EOS
ceph::osd { '/dev/sdb':
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
shell(:node => vm, :command => "test -b /dev/sdb && ceph-disk zap /dev/sdb")
end
shell 'ceph osd tree | grep DNE' do |r|
expect(r.exit_code).to be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'first':
ensure => absent,
}
EOS
puppet_apply(:node => 'first', :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=first' do |r|
expect(r.stdout).to be_empty
expect(r.stderr).to match(/Unknown instance: ceph.first/)
expect(r.exit_code).not_to be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.first' do |r|
expect(r.stdout).to match(/mon.first not found/)
expect(r.stderr).to be_empty
expect(r.exit_code).not_to be_zero
end
end
end
it 'should purge all packages' do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
ensure => absent,
}
EOS
machines.each do |vm|
puppet_apply(:node => vm, :code => pp) do |r|
expect(r.exit_code).not_to eq(1)
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-ubuntu-server-1204-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RS_DESTROY=no \
# RS_SET=two-ubuntu-server-1204-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system \
# SPEC=spec/system/ceph_usecases_spec.rb &&
# git checkout Gemfile
# "
# End: