Add spec tests for additional loopback parameter.
This commit adds test coverage that verifies the behavior of the loopback related class parameters.
This commit is contained in:
@@ -1,4 +1,18 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'swift::storage::loopback' do
|
describe 'swift::storage::loopback' do
|
||||||
# TODO add unit tests
|
# TODO add more unit tests
|
||||||
# this is not the highest priority b/c it is really for testing
|
|
||||||
|
let :title do
|
||||||
|
'dans_disk'
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_swift__storage__xfs('dans_disk').with(
|
||||||
|
:device => '/srv/loopback-device/dans_disk',
|
||||||
|
:mnt_base_dir => '/srv/node',
|
||||||
|
:byte_size => '1024',
|
||||||
|
:subscribe => 'Exec[create_partition-dans_disk]',
|
||||||
|
:loopback => true
|
||||||
|
) }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@@ -1,4 +1,42 @@
|
|||||||
|
require 'spec_helper'
|
||||||
describe 'swift::storage::mount' do
|
describe 'swift::storage::mount' do
|
||||||
# TODO add unit tests
|
# TODO add unit tests
|
||||||
# not a super high priority b/c this is just for testing
|
|
||||||
|
let :title do
|
||||||
|
'dans_mount_point'
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with defaults params' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:device => '/dev/sda'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_mount('/srv/node/dans_mount_point').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:device => '/dev/sda',
|
||||||
|
:fstype => 'xfs',
|
||||||
|
:options => 'noatime,nodiratime,nobarrier,logbufs=8',
|
||||||
|
:require => 'File[/srv/node/dans_mount_point]'
|
||||||
|
)}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when mounting a loopback device' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:device => '/dev/sda',
|
||||||
|
:loopback => true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_mount('/srv/node/dans_mount_point').with(
|
||||||
|
:device => '/dev/sda',
|
||||||
|
:options => 'noatime,nodiratime,nobarrier,logbufs=8,loop'
|
||||||
|
)}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@@ -13,15 +13,21 @@ describe 'swift::storage::xfs' do
|
|||||||
|
|
||||||
describe 'when a device is specified' do
|
describe 'when a device is specified' do
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{:device => 'some_device',
|
{
|
||||||
|
:device => 'some_device',
|
||||||
:byte_size => '1024',
|
:byte_size => '1024',
|
||||||
:mnt_base_dir => '/srv/node'}
|
:mnt_base_dir => '/srv/node',
|
||||||
|
:loopback => false
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
[{:device => 'some_device'},
|
[{:device => 'some_device'},
|
||||||
{:device => 'some_device',
|
{
|
||||||
|
:device => 'some_device',
|
||||||
:byte_size => 1,
|
:byte_size => 1,
|
||||||
:mnt_base_dir => '/mnt/foo'}
|
:mnt_base_dir => '/mnt/foo',
|
||||||
|
:loopback => true
|
||||||
|
}
|
||||||
].each do |param_set|
|
].each do |param_set|
|
||||||
|
|
||||||
describe "#{param_set == {} ? "using default" : "specifying"} class parameters" do
|
describe "#{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||||
@@ -41,9 +47,10 @@ describe 'swift::storage::xfs' do
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
it { should contain_swift__storage__mount('foo').with(
|
it { should contain_swift__storage__mount('foo').with(
|
||||||
{:device => param_hash[:device],
|
:device => param_hash[:device],
|
||||||
:mnt_base_dir => param_hash[:mnt_base_dir],
|
:mnt_base_dir => param_hash[:mnt_base_dir],
|
||||||
:subscribe => 'Exec[mkfs-foo]'}
|
:loopback => param_hash[:loopback],
|
||||||
|
:subscribe => 'Exec[mkfs-foo]'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
1
spec/fixtures/modules/swift
vendored
1
spec/fixtures/modules/swift
vendored
@@ -1 +0,0 @@
|
|||||||
../../../
|
|
Reference in New Issue
Block a user