From c0c491404304ccdc330defbc62f94b1eef4fb692 Mon Sep 17 00:00:00 2001 From: Robert Wolf Date: Mon, 27 May 2024 15:53:01 +0200 Subject: [PATCH] array config tests for agent config tests for proxy --- spec/classes/agent_spec.rb | 24 ++++++++++++++++++++++++ spec/classes/proxy_spec.rb | 31 +++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/spec/classes/agent_spec.rb b/spec/classes/agent_spec.rb index e2e825667..a87eea0e8 100644 --- a/spec/classes/agent_spec.rb +++ b/spec/classes/agent_spec.rb @@ -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'] + } + end + + it { is_expected.to contain_file(config_path).with_content %r{^TLSAccept=unencrypted,cert$} } + end + end + context 'without ListenIP' do let :params do { diff --git a/spec/classes/proxy_spec.rb b/spec/classes/proxy_spec.rb index 6b38bf58e..eb7dbb0ed 100644 --- a/spec/classes/proxy_spec.rb +++ b/spec/classes/proxy_spec.rb @@ -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'] + } + end + + it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=unencrypted,cert$} } + end + end end end