Skip to content

Commit fa8ff5a

Browse files
committed
Add a unit test to ensure bacula::director::console works as expeced
1 parent 493e2bf commit fa8ff5a

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe 'bacula::director::console' do
6+
on_supported_os.each do |os, facts|
7+
context "on #{os}" do
8+
let(:facts) { facts }
9+
10+
let(:pre_condition) { 'include bacula' }
11+
12+
context 'with default parameters' do
13+
let(:title) { 'Monitoring' }
14+
15+
let(:params) do
16+
{
17+
password: 'monitoring_password',
18+
}
19+
end
20+
21+
it { is_expected.to contain_concat__fragment('bacula-director-console-Monitoring').with(content: <<~FRAGMENT) }
22+
Console {
23+
Name = Monitoring
24+
Password = "monitoring_password"
25+
CatalogACL = *all*
26+
CommandACL = list
27+
}
28+
FRAGMENT
29+
end
30+
31+
context 'with all parameters set' do
32+
let(:title) { 'restricted-user' }
33+
34+
let(:params) do
35+
{
36+
password: 'A different UntrustedUser',
37+
jobacl: 'Restricted Client Save',
38+
clientacl: 'restricted-client',
39+
storageacl: 'second-storage',
40+
scheduleacl: 'weekly-schedule',
41+
poolacl: 'backup-pool',
42+
filesetacl: "Restricted Client's FileSet",
43+
catalogacl: 'RestrictedCatalog',
44+
commandacl: %w[run restore],
45+
whereacl: '/',
46+
}
47+
end
48+
49+
it { is_expected.to contain_concat__fragment('bacula-director-console-restricted-user').with(content: <<~FRAGMENT) }
50+
Console {
51+
Name = restricted-user
52+
Password = "A different UntrustedUser"
53+
JobACL = Restricted Client Save
54+
ClientACL = restricted-client
55+
StorageACL = second-storage
56+
ScheduleACL = weekly-schedule
57+
PoolACL = backup-pool
58+
FileSetACL = Restricted Client's FileSet
59+
CatalogACL = RestrictedCatalog
60+
CommandACL = run, restore
61+
WhereACL = /
62+
}
63+
FRAGMENT
64+
end
65+
end
66+
end
67+
end

0 commit comments

Comments
 (0)