Files
puppet-swift/spec/defines/swift_storage_disk_spec.rb
Thomas Goirand 7577eec93c Make it possible to skip parted+mkfs
Previously, each run puppet runs a parted and a xfs_admin command,
which itself triggers udev rules. In production, and during a
rebalance, this may trigger a *very* high load on the storage nodes.

This patch introduces 2 a new options: "manage_partition" and
"manage_filesystem" which are "true" by default (not changing the
past behavior), so administrators can, once the cluster is setup
and the new disks are in, set this variable to "false", or manage
partitions and formating out of puppet.

Change-Id: I2740da550157c94cd80805f60321d3cd91381cff
2021-06-16 00:56:18 +02:00

47 lines
1.2 KiB
Ruby

require 'spec_helper'
describe 'swift::storage::disk' do
# TODO add more unit tests
let :title do
'sdb'
end
let :params do
{
:base_dir => '/dev',
:mnt_base_dir => '/srv/node',
:byte_size => '1024',
:ext_args => 'mkpart primary 0% 100%',
}
end
shared_examples 'swift::storage::disk' do
it { is_expected.to contain_exec("create_partition_label-sdb").with(
:command => "parted -s #{params[:base_dir]}/sdb mklabel gpt #{params[:ext_args]}",
:path => ["/usr/bin/", "/sbin", "/bin"],
:onlyif => ["test -b #{params[:base_dir]}/sdb","parted #{params[:base_dir]}/sdb print|tail -1|grep 'Error'"],
:before => 'Anchor[swift::config::end]'
)}
it { is_expected.to contain_swift__storage__xfs('sdb').with(
:device => '/dev/sdb',
:mnt_base_dir => '/srv/node',
:byte_size => '1024',
:loopback => false
) }
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'swift::storage::disk'
end
end
end