@@ -90,5 +90,65 @@ def resource(host, type, name)
9090 assert_match ( res [ 'descr' ] , 'Puppet Labs Products El 7 - $basearch' )
9191 end
9292 end
93+
94+ describe '`proxy` property' do
95+ context 'when set to a URL' do
96+ it 'applies idempotently' do
97+ pp = <<-MANIFEST
98+ yumrepo {'proxied-repo':
99+ baseurl => 'http://myownmirror',
100+ proxy => 'http://proxy.example.com:3128',
101+ }
102+ MANIFEST
103+
104+ apply_manifest ( pp , catch_failures : true )
105+ apply_manifest ( pp , catch_changes : true )
106+ end
107+
108+ describe file ( '/etc/yum.repos.d/proxied-repo.repo' ) do
109+ its ( :content ) { is_expected . to contain ( 'proxy=http://proxy.example.com:3128' ) }
110+ end
111+ end
112+ context 'when set to `absent`' do
113+ it 'applies idempotently' do
114+ pp = <<-MANIFEST
115+ yumrepo {'proxied-repo':
116+ baseurl => 'http://myownmirror',
117+ proxy => absent,
118+ }
119+ MANIFEST
120+
121+ apply_manifest ( pp , catch_failures : true )
122+ apply_manifest ( pp , catch_changes : true )
123+ end
124+
125+ describe file ( '/etc/yum.repos.d/proxied-repo.repo' ) do
126+ its ( :content ) { is_expected . not_to contain ( 'proxy' ) }
127+ end
128+ end
129+ context 'when set to `_none_`' do
130+ it 'applies idempotently' do
131+ pp = <<-MANIFEST
132+ yumrepo {'proxied-repo':
133+ baseurl => 'http://myownmirror',
134+ proxy => '_none_',
135+ }
136+ MANIFEST
137+
138+ apply_manifest ( pp , catch_failures : true )
139+ apply_manifest ( pp , catch_changes : true )
140+ end
141+
142+ if fact ( 'os.release.major' ) == '8'
143+ describe file ( '/etc/yum.repos.d/proxied-repo.repo' ) do
144+ its ( :content ) { is_expected . to match ( %r{^proxy=$} ) }
145+ end
146+ else
147+ describe file ( '/etc/yum.repos.d/proxied-repo.repo' ) do
148+ its ( :content ) { is_expected . to match ( %r{^proxy=_none_$} ) }
149+ end
150+ end
151+ end
152+ end
93153 end
94154end
0 commit comments