Skip to content

Commit

Permalink
Include audit_enable tests (#190, #199)
Browse files Browse the repository at this point in the history
Allow passing Integer to `audit_maxbackupindex`
  • Loading branch information
deric committed Jan 22, 2025
1 parent ff2c976 commit e9cd4bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
Hash[String,Hash[String,String]] $extra_appenders = $zookeeper::params::extra_appenders,
String $audit_threshold = $zookeeper::params::audit_threshold,
String $audit_maxfilesize = $zookeeper::params::audit_maxfilesize,
String $audit_maxbackupindex = $zookeeper::params::audit_maxbackupindex,
Variant[Integer,String] $audit_maxbackupindex = $zookeeper::params::audit_maxbackupindex,
Boolean $logrotate_timebased = $zookeeper::params::logrotate_timebased,
Integer $logrotate_days = $zookeeper::params::logrotate_days,

Expand Down
18 changes: 18 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,22 @@
it { is_expected.not_to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{^clientPort=2181}) }
it { is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{^secureClientPort=2182}) }
end

context 'with audit_enable' do
let(:params) do
{
audit_enable: true,
audit_maxfilesize: '5M',
audit_maxbackupindex: 5,
audit_threshold: 'ERROR',
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{^audit.enable=true}) }
it { is_expected.to contain_file('/etc/zookeeper/conf/log4j.properties').with_content(%r{^zookeeper.auditlog.file=zookeeper_audit.log}) }
it { is_expected.to contain_file('/etc/zookeeper/conf/log4j.properties').with_content(%r{^log4j.appender.RFAAUDIT.MaxFileSize=5M}) }
it { is_expected.to contain_file('/etc/zookeeper/conf/log4j.properties').with_content(%r{^log4j.appender.RFAAUDIT.MaxBackupIndex=5}) }
it { is_expected.to contain_file('/etc/zookeeper/conf/log4j.properties').with_content(%r{^zookeeper.auditlog.threshold=ERROR}) }
end
end

0 comments on commit e9cd4bc

Please sign in to comment.