puppet-swift/spec/defines/swift_storage_disk_spec.rb
Xingchao Yu 8380976e33 Support to pass external args in parted command
Currently facter only support to fetch the partition's uuid,
If users want to mount device by uuid, then partitions should
be made in the disks.

This patch aims to add new param $ext_args in swift::storage::disk to
enable passing making partitions arguments in parted command.

Change-Id: I26dcfe73d2791a9033b555323847ddd211f02ceb
2017-07-14 11:33:43 +08:00

35 lines
931 B
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
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',
:subscribe => 'Exec[create_partition_label-sdb]',
:loopback => false
) }
end