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:
Dan Bode
2012-07-23 15:04:14 -07:00
parent 1841771355
commit 4691b3929d
4 changed files with 69 additions and 11 deletions

View File

@@ -1,4 +1,18 @@
require 'spec_helper'
describe 'swift::storage::loopback' do
# TODO add unit tests
# this is not the highest priority b/c it is really for testing
# TODO add more unit tests
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

View File

@@ -1,4 +1,42 @@
require 'spec_helper'
describe 'swift::storage::mount' do
# 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

View File

@@ -13,15 +13,21 @@ describe 'swift::storage::xfs' do
describe 'when a device is specified' do
let :default_params do
{:device => 'some_device',
{
:device => 'some_device',
:byte_size => '1024',
:mnt_base_dir => '/srv/node'}
:mnt_base_dir => '/srv/node',
:loopback => false
}
end
[{:device => 'some_device'},
{:device => 'some_device',
:byte_size => 1,
:mnt_base_dir => '/mnt/foo'}
{
:device => 'some_device',
:byte_size => 1,
:mnt_base_dir => '/mnt/foo',
:loopback => true
}
].each do |param_set|
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(
{:device => param_hash[:device],
:device => param_hash[:device],
:mnt_base_dir => param_hash[:mnt_base_dir],
:subscribe => 'Exec[mkfs-foo]'}
:loopback => param_hash[:loopback],
:subscribe => 'Exec[mkfs-foo]'
)}
end

View File

@@ -1 +0,0 @@
../../../