Skip to content

Commit

Permalink
Add a unit test to ensure bacula::director::console works as expeced
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Jun 19, 2024
1 parent 493e2bf commit b623b58
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions spec/defines/director_console_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'bacula::director::console' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }

let(:pre_condition) { 'include bacula' }

context 'with default parameters' do
let(:title) { 'Monitoring' }

let(:params) do
{
password: 'monitoring_password',
}
end

it { is_expected.to contain_concat__fragment('bacula-director-console-Monitoring').with(content: <<~FRAGMENT) }
Console {

Check failure on line 22 in spec/defines/director_console_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/HeredocIndentation: Use 2 spaces for indentation in a heredoc. (https://rubystyle.guide#squiggly-heredocs)
Name = Monitoring
Password = "monitoring_password"
CatalogACL = *all*
CommandACL = list
}
FRAGMENT
end

context 'with all parameters set' do
let(:title) { 'restricted-user' }

let(:params) do
{
password: 'A different UntrustedUser',
jobacl: 'Restricted Client Save',
clientacl: 'restricted-client',
storageacl: 'second-storage',
scheduleacl: 'weekly-schedule',
poolacl: 'backup-pool',
filesetacl: "Restricted Client's FileSet",
catalogacl: 'RestrictedCatalog',
commandacl: ['run', 'restore'],

Check failure on line 44 in spec/defines/director_console_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/WordArray: Use `%w` or `%W` for an array of words. (https://rubystyle.guide#percent-w)
whereacl: '/',
}
end

it { is_expected.to contain_concat__fragment('bacula-director-console-restricted-user').with(content: <<~FRAGMENT) }
Console {

Check failure on line 50 in spec/defines/director_console_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/HeredocIndentation: Use 2 spaces for indentation in a heredoc. (https://rubystyle.guide#squiggly-heredocs)
Name = restricted-user
Password = "A different UntrustedUser"
JobACL = Restricted Client Save
ClientACL = restricted-client
StorageACL = second-storage
ScheduleACL = weekly-schedule
PoolACL = backup-pool
FileSetACL = Restricted Client's FileSet
CatalogACL = RestrictedCatalog
CommandACL = run, restore
WhereACL = /
}
FRAGMENT
end
end
end
end

0 comments on commit b623b58

Please sign in to comment.