11require 'spec_helper_acceptance'
22
33def agent_supported ( version )
4- if default [ :platform ] =~ %r{(ubuntu-16.04|debian-9)-amd64}
5- return version != '2.4'
6- end
4+ return version != '2.4' if default [ :platform ] =~ %r{(ubuntu-16.04|debian-9)-amd64}
5+ return version >= '4.0' if default [ :platform ] =~ %r{debian-10-amd64}
76 true
87end
98
@@ -14,7 +13,7 @@ def agent_supported(version)
1413 class { 'zabbix::agent':
1514 server => '192.168.20.11',
1615 zabbix_package_state => 'latest',
17- zabbix_version => '#{ version } '
16+ zabbix_version => '#{ version } ',
1817 }
1918 EOS
2019
@@ -36,42 +35,54 @@ class { 'zabbix::agent':
3635 describe file ( '/etc/zabbix/zabbix_agentd.conf' ) do
3736 its ( :content ) { is_expected . not_to match %r{ListenIP=} }
3837 end
39- end
40- end
4138
42- describe 'zabbix::agent class with zabbix_version 3.4 ' do
43- context 'With ListenIP set to an IP-Address ' do
44- it 'works idempotently with no errors' do
45- pp = <<-EOS
46- class { 'zabbix::agent':
47- server => '192.168.20.11 ',
48- zabbix_package_state => 'latest ',
49- listenip => '127.0.0.1 ',
50- zabbix_version => '3.4'
51- }
52- EOS
53- apply_manifest ( pp , catch_failures : true )
54- apply_manifest ( pp , catch_changes : true )
55- end
56- describe file ( '/etc/zabbix/zabbix_agentd.conf' ) do
57- its ( :content ) { is_expected . to match %r{ListenIP=127.0.0.1} }
39+ context 'With ListenIP set to an IP-Address ' do
40+ it 'works idempotently with no errors ' do
41+ pp = <<-EOS
42+ class { 'zabbix::agent':
43+ server => '192.168.20.11',
44+ zabbix_package_state => 'latest ',
45+ listenip => '127.0.0.1 ',
46+ zabbix_version => '#{ version } ',
47+ }
48+ EOS
49+ apply_manifest ( pp , catch_failures : true )
50+ apply_manifest ( pp , catch_changes : true )
51+ end
52+ describe file ( '/etc/zabbix/zabbix_agentd.conf' ) do
53+ its ( :content ) { is_expected . to match %r{ListenIP=127.0.0.1} }
54+ end
5855 end
59- end
60- context 'With ListenIP set to lo' do
61- it 'works idempotently with no errors' do
62- pp = <<-EOS
63- class { 'zabbix::agent':
64- server => '192.168.20.11',
65- zabbix_package_state => 'latest',
66- listenip => 'lo',
67- zabbix_version => '3.4'
68- }
69- EOS
70- apply_manifest ( pp , catch_failures : true )
71- apply_manifest ( pp , catch_changes : true )
72- end
73- describe file ( '/etc/zabbix/zabbix_agentd.conf' ) do
74- its ( :content ) { is_expected . to match %r{ListenIP=127.0.0.1} }
56+ context 'With ListenIP set to lo' do
57+ it 'works idempotently with no errors' do
58+ pp = <<-EOS
59+ class { 'zabbix::agent':
60+ server => '192.168.20.11',
61+ zabbix_package_state => 'latest',
62+ listenip => 'lo',
63+ zabbix_version => '#{ version } ',
64+ }
65+ EOS
66+ apply_manifest ( pp , catch_failures : true )
67+ apply_manifest ( pp , catch_changes : true )
68+ end
69+ context 'With ListenIP set to an IP-Address' do
70+ it 'works idempotently with no errors' do
71+ pp = <<-EOS
72+ class { 'zabbix::agent':
73+ server => '192.168.20.11',
74+ zabbix_package_state => 'latest',
75+ listenip => '127.0.0.1',
76+ zabbix_version => '#{ version } ',
77+ }
78+ EOS
79+ apply_manifest ( pp , catch_failures : true )
80+ apply_manifest ( pp , catch_changes : true )
81+ end
82+ describe file ( '/etc/zabbix/zabbix_agentd.conf' ) do
83+ its ( :content ) { is_expected . to match %r{ListenIP=127.0.0.1} }
84+ end
85+ end
7586 end
7687 end
7788end
0 commit comments