1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
# frozen_string_literal: true
require 'spec_helper'
describe 'kmod::blacklist', type: :define do
let(:title) { 'foo' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge(augeasversion: '1.2.0')
end
context 'when ensure is set to present' do
let(:params) { { ensure: 'present', file: '/bar/baz' } }
it { is_expected.to contain_kmod__blacklist('foo') }
it {
is_expected.to contain_kmod__setting('kmod::blacklist foo').
with('ensure' => 'present',
'category' => 'blacklist',
'module' => 'foo',
'file' => '/bar/baz')
}
end
context 'when file is not specified' do
let(:params) { { ensure: 'present' } }
it { is_expected.to contain_kmod__blacklist('foo') }
it {
is_expected.to contain_kmod__setting('kmod::blacklist foo').
with('ensure' => 'present',
'category' => 'blacklist',
'module' => 'foo',
'file' => '/etc/modprobe.d/blacklist.conf')
}
end
context 'when ensure is set to absent' do
let(:params) { { ensure: 'absent', file: '/bar/baz' } }
it { is_expected.to contain_kmod__blacklist('foo') }
it {
is_expected.to contain_kmod__setting('kmod::blacklist foo').
with('ensure' => 'absent',
'category' => 'blacklist',
'module' => 'foo',
'file' => '/bar/baz')
}
end
context 'when file permissions are specified' do
let(:params) { { file: '/bar/baz' } }
let(:pre_condition) do
<<~END
class { 'kmod':
owner => 'adm',
group => 'sys',
file_mode => '0600',
}
END
end
it { is_expected.to contain_kmod__blacklist('foo') }
it {
is_expected.to contain_file(params[:file]).
with(
'owner' => 'adm',
'group' => 'sys',
'mode' => '0600'
)
}
end
end
end
end
|