2012-02-26 20:51:17 -08:00
|
|
|
require 'spec_helper'
|
|
|
|
describe 'swift::storage::xfs' do
|
|
|
|
let :title do
|
|
|
|
'foo'
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when a device is specified' do
|
|
|
|
let :default_params do
|
2012-07-23 15:04:14 -07:00
|
|
|
{
|
2013-01-07 11:07:20 -08:00
|
|
|
:device => "/dev/#{title}",
|
2012-02-26 20:51:17 -08:00
|
|
|
:byte_size => '1024',
|
2012-07-23 15:04:14 -07:00
|
|
|
:mnt_base_dir => '/srv/node',
|
|
|
|
:loopback => false
|
|
|
|
}
|
2012-02-26 20:51:17 -08:00
|
|
|
end
|
|
|
|
|
2013-01-07 11:07:20 -08:00
|
|
|
[{},
|
2012-07-23 15:04:14 -07:00
|
|
|
{
|
|
|
|
:device => 'some_device',
|
|
|
|
:byte_size => 1,
|
|
|
|
:mnt_base_dir => '/mnt/foo',
|
|
|
|
:loopback => true
|
|
|
|
}
|
2012-02-26 20:51:17 -08:00
|
|
|
].each do |param_set|
|
|
|
|
|
2012-02-26 21:19:13 -08:00
|
|
|
describe "#{param_set == {} ? "using default" : "specifying"} class parameters" do
|
2012-02-26 20:51:17 -08:00
|
|
|
let :param_hash do
|
|
|
|
default_params.merge(param_set)
|
|
|
|
end
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
param_set
|
|
|
|
end
|
|
|
|
|
2015-03-23 18:23:07 +01:00
|
|
|
it { is_expected.to contain_exec("mkfs-foo").with(
|
2012-09-26 18:37:11 +02:00
|
|
|
:command => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}",
|
|
|
|
:path => ['/sbin/', '/usr/sbin/'],
|
2012-02-26 20:51:17 -08:00
|
|
|
:require => 'Package[xfsprogs]'
|
|
|
|
)}
|
|
|
|
|
2015-03-23 18:23:07 +01:00
|
|
|
it { is_expected.to contain_swift__storage__mount(title).with(
|
2013-01-07 11:07:20 -08:00
|
|
|
:device => param_hash[:device],
|
2012-02-26 20:51:17 -08:00
|
|
|
:mnt_base_dir => param_hash[:mnt_base_dir],
|
2012-07-23 15:04:14 -07:00
|
|
|
:loopback => param_hash[:loopback],
|
|
|
|
:subscribe => 'Exec[mkfs-foo]'
|
2012-02-26 20:51:17 -08:00
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|