1 require 'spec_helper_acceptance'
3 describe 'deprecation warnings' do
4 basedir = default.tmpdir('concat')
6 shared_examples 'has_warning' do |pp, w|
7 it 'applies the manifest twice with a stderr regex' do
8 expect(apply_manifest(pp, :catch_failures => true).stderr).to match(/#{Regexp.escape(w)}/m)
9 expect(apply_manifest(pp, :catch_changes => true).stderr).to match(/#{Regexp.escape(w)}/m)
13 context 'concat gnu parameter' do
15 concat { '#{basedir}/file':
18 concat::fragment { 'foo':
19 target => '#{basedir}/file',
23 w = 'The $gnu parameter to concat is deprecated and has no effect'
25 it_behaves_like 'has_warning', pp, w
28 context 'concat warn parameter =>' do
29 ['true', 'yes', 'on'].each do |warn|
32 concat { '#{basedir}/file':
35 concat::fragment { 'foo':
36 target => '#{basedir}/file',
40 w = 'Using stringified boolean values (\'true\', \'yes\', \'on\', \'false\', \'no\', \'off\') to represent boolean true/false as the $warn parameter to concat is deprecated and will be treated as the warning message in a future release'
42 it_behaves_like 'has_warning', pp, w
44 describe file("#{basedir}/file") do
47 should match '# This file is managed by Puppet. DO NOT EDIT.'
54 ['false', 'no', 'off'].each do |warn|
57 concat { '#{basedir}/file':
60 concat::fragment { 'foo':
61 target => '#{basedir}/file',
65 w = 'Using stringified boolean values (\'true\', \'yes\', \'on\', \'false\', \'no\', \'off\') to represent boolean true/false as the $warn parameter to concat is deprecated and will be treated as the warning message in a future release'
67 it_behaves_like 'has_warning', pp, w
69 describe file("#{basedir}/file") do
72 should_not match '# This file is managed by Puppet. DO NOT EDIT.'
80 context 'concat::fragment ensure parameter', :unless => fact('osfamily') == 'windows' do
81 context 'target file exists' do
87 file { '#{basedir}/file1':
88 content => "file1 contents\n",
95 concat { '#{basedir}/file': }
96 concat::fragment { 'foo':
97 target => '#{basedir}/file',
98 ensure => '#{basedir}/file1',
101 w = 'Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.'
103 it_behaves_like 'has_warning', pp, w
105 describe file("#{basedir}/file") do
106 it { should be_file }
107 its(:content) { should match 'file1 contents' }
110 describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact("osfamily") == "windows") do
112 concat { '#{basedir}/file': }
113 concat::fragment { 'foo':
114 target => '#{basedir}/file',
115 content => 'new content',
119 it 'applies the manifest twice with no stderr' do
120 apply_manifest(pp, :catch_failures => true)
121 apply_manifest(pp, :catch_changes => true)
124 describe file("#{basedir}/file") do
125 it { should be_file }
127 should match 'new content'
128 should_not match 'file1 contents'
132 end # target file exists
134 context 'target does not exist', :unless => fact('osfamily') == 'windows' do
136 concat { '#{basedir}/file': }
137 concat::fragment { 'foo':
138 target => '#{basedir}/file',
139 ensure => '#{basedir}/file1',
142 w = 'Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.'
144 it_behaves_like 'has_warning', pp, w
146 describe file("#{basedir}/file") do
147 it { should be_file }
150 describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact('osfamily') == 'windows') do
152 concat { '#{basedir}/file': }
153 concat::fragment { 'foo':
154 target => '#{basedir}/file',
155 content => 'new content',
159 it 'applies the manifest twice with no stderr' do
160 apply_manifest(pp, :catch_failures => true)
161 apply_manifest(pp, :catch_changes => true)
164 describe file("#{basedir}/file") do
165 it { should be_file }
166 its(:content) { should match 'new content' }
169 end # target file exists
171 end # concat::fragment ensure parameter
173 context 'concat::fragment mode parameter' do
175 concat { '#{basedir}/file': }
176 concat::fragment { 'foo':
177 target => '#{basedir}/file',
182 w = 'The $mode parameter to concat::fragment is deprecated and has no effect'
184 it_behaves_like 'has_warning', pp, w
187 context 'concat::fragment owner parameter' do
189 concat { '#{basedir}/file': }
190 concat::fragment { 'foo':
191 target => '#{basedir}/file',
196 w = 'The $owner parameter to concat::fragment is deprecated and has no effect'
198 it_behaves_like 'has_warning', pp, w
201 context 'concat::fragment group parameter' do
203 concat { '#{basedir}/file': }
204 concat::fragment { 'foo':
205 target => '#{basedir}/file',
210 w = 'The $group parameter to concat::fragment is deprecated and has no effect'
212 it_behaves_like 'has_warning', pp, w
215 context 'concat::fragment backup parameter' do
217 concat { '#{basedir}/file': }
218 concat::fragment { 'foo':
219 target => '#{basedir}/file',
224 w = 'The $backup parameter to concat::fragment is deprecated and has no effect'
226 it_behaves_like 'has_warning', pp, w
229 context 'include concat::setup' do
231 include concat::setup
233 w = 'concat::setup is deprecated as a public API of the concat module and should no longer be directly included in the manifest.'
235 it_behaves_like 'has_warning', pp, w