Skip to content

Commit

Permalink
array config tests for agent
Browse files Browse the repository at this point in the history
config tests for proxy
  • Loading branch information
wolfaba committed May 27, 2024
1 parent 651326f commit c0c4914
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,30 @@
end
end

context 'tlsaccept with one value array' do
if facts[:kernel] == 'Linux'
let :params do
{
tlsaccept: ['cert']
}
end

it { is_expected.to contain_file(config_path).with_content %r{^TLSAccept=cert$} }
end
end

context 'tlsaccept with two value array' do
if facts[:kernel] == 'Linux'
let :params do
{
tlsaccept: ['unencrypted','cert']

Check failure on line 371 in spec/classes/agent_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)

Check failure on line 371 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceAfterComma: Space missing after comma. (https://rubystyle.guide#spaces-operators)
}
end

it { is_expected.to contain_file(config_path).with_content %r{^TLSAccept=unencrypted,cert$} }
end
end

context 'without ListenIP' do
let :params do
{
Expand Down
31 changes: 31 additions & 0 deletions spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,37 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^LogFileSize=10$} }
end
end

context 'tlsaccept with one string value' do
let :params do
{
tlsaccept: 'cert',
}
end

it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=cert$} }
end

context 'tlsaccept with one value array' do
let :params do
{
tlsaccept: ['cert']
}
end

it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=cert$} }
end

context 'tlsaccept with two value array' do
let :params do
{
tlsaccept: ['unencrypted','cert']

Check failure on line 442 in spec/classes/proxy_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)

Check failure on line 442 in spec/classes/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceAfterComma: Space missing after comma. (https://rubystyle.guide#spaces-operators)
}
end

it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=unencrypted,cert$} }
end

end
end
end
Expand Down

0 comments on commit c0c4914

Please sign in to comment.