puppet-swift/spec/defines/swift_storage_mount_spec.rb
Takashi Kajinami 109cd356de Replace legacy facts and use fact hash
... because the latest lint no longer allows usage of legacy facts and
top scope fact.

Change-Id: I4c0a9357fcc4184df852024e1f6f36c0ed2e1440
2023-03-02 14:47:43 +09:00

69 lines
1.6 KiB
Ruby

require 'spec_helper'
describe 'swift::storage::mount' do
let :title do
'dans_mount_point'
end
shared_examples 'swift::storage::mount' do
describe 'with defaults params' do
let :params do
{
:device => '/dev/sda'
}
end
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
:ensure => 'present',
:device => '/dev/sda',
:fstype => 'xfs',
:options => 'noatime,nodiratime,nofail,logbufs=8',
)}
end
describe 'when mounting a loopback device' do
let :params do
{
:device => '/dev/sda',
:loopback => true
}
end
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
:device => '/dev/sda',
:options => 'noatime,nodiratime,nofail,loop,logbufs=8'
)}
end
describe 'when mounting a loopback device on selinux system' do
let :params do
{
:device => '/dev/sda'
}
end
before do
facts[:os]['selinux']['enabled'] = 'true'
end
it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
:command => "restorecon /srv/node/dans_mount_point",
:path => ['/usr/sbin', '/sbin'],
:refreshonly => true
)}
end
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::mount'
end
end
end