1 require 'spec_helper_acceptance'
3 describe 'concat backup parameter' do
4 basedir = default.tmpdir('concat')
11 file { '#{basedir}/file':
12 content => "old contents\n",
18 concat { '#{basedir}/file':
21 concat::fragment { 'new file':
22 target => '#{basedir}/file',
23 content => 'new contents',
27 it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do
28 apply_manifest(pp, :catch_failures => true) do |r|
29 expect(r.stdout).to match(/Filebucketed #{basedir}\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents'
31 apply_manifest(pp, :catch_changes => true)
34 describe file("#{basedir}/file") do
36 its(:content) { should match /new contents/ }
40 context '=> .backup' do
46 file { '#{basedir}/file':
47 content => "old contents\n",
53 concat { '#{basedir}/file':
56 concat::fragment { 'new file':
57 target => '#{basedir}/file',
58 content => 'new contents',
62 # XXX Puppet doesn't mention anything about filebucketing with a given
63 # extension like .backup
64 it 'applies the manifest twice no stderr' do
65 apply_manifest(pp, :catch_failures => true)
66 apply_manifest(pp, :catch_changes => true)
69 describe file("#{basedir}/file") do
71 its(:content) { should match /new contents/ }
73 describe file("#{basedir}/file.backup") do
75 its(:content) { should match /old contents/ }
79 # XXX The backup parameter uses validate_string() and thus can't be the
80 # boolean false value, but the string 'false' has the same effect in Puppet 3
81 context "=> 'false'" do
87 file { '#{basedir}/file':
88 content => "old contents\n",
94 concat { '#{basedir}/file':
97 concat::fragment { 'new file':
98 target => '#{basedir}/file',
99 content => 'new contents',
103 it 'applies the manifest twice with no "Filebucketed" stdout and no stderr' do
104 apply_manifest(pp, :catch_failures => true) do |r|
105 expect(r.stdout).to_not match(/Filebucketed/)
107 apply_manifest(pp, :catch_changes => true)
110 describe file("#{basedir}/file") do
111 it { should be_file }
112 its(:content) { should match /new contents/ }