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
|
# frozen_string_literal: true
require 'spec_helper'
describe 'vector::user' do
let(:pre_condition) { 'include vector' }
#Test that we do not manage vector user/group by default
context 'normal' do
it do
expect(catalogue.resource('user', 'vector')).to be_nil
expect(catalogue.resource('group', 'vector')).to be_nil
end
end
#Test that we can create vector user and group
context 'enable user and group management' do
let(:pre_condition) do
<<-EOS
class {'vector':
manage_user => true,
manage_group => true,
}
EOS
end
it do
is_expected.to contain_user('vector')
.with({ 'system' => true, 'shell' => '/sbin/nologin' })
is_expected.to contain_group('vector')
.with({})
end
end
#Test that vector user and group opts are enforced
context 'user and group opts' do
let(:pre_condition) do
<<-EOS
class {'vector':
manage_user => true,
manage_group => true,
user_opts => {
system => false,
shell => '/bin/bash',
},
group_opts => {
gid => 200,
},
}
EOS
end
it do
is_expected.to contain_user('vector')
.with({ 'system' => false, 'shell' => '/bin/bash' })
is_expected.to contain_group('vector')
.with({'gid' => 200})
end
end
end
|