1 require 'spec_helper_acceptance'
3 describe 'concat backup parameter' do
5 @basedir = setup_test_directory
8 describe 'when puppet' do
11 concat { '#{@basedir}/file':
14 concat::fragment { 'new file':
15 target => '#{@basedir}/file',
16 content => 'new contents',
21 it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do
22 expect(apply_manifest(pp, catch_failures: true, debug: true).stdout).to match(%r{Filebucketed.*to puppet with sum.*})
23 apply_manifest(pp, catch_changes: true)
24 expect(file("#{@basedir}/file")).to be_file
25 expect(file("#{@basedir}/file").content).to match %r{new contents}
29 describe 'when .backup' do
32 concat { '#{@basedir}/file':
35 concat::fragment { 'new file':
36 target => '#{@basedir}/file',
37 content => 'backup extension',
42 # XXX Puppet doesn't mention anything about filebucketing with a given
43 # extension like .backup
44 it 'applies the manifest twice no stderr' do
46 expect(file("#{@basedir}/file")).to be_file
47 expect(file("#{@basedir}/file").content).to match %r{backup extension}
48 expect(file("#{@basedir}/file.backup")).to be_file
49 expect(file("#{@basedir}/file.backup").content).to match %r{new contents}
53 # XXX The backup parameter uses validate_string() and thus can't be the
54 # boolean false value, but the string 'false' has the same effect in Puppet 3
55 describe "when 'false'" do
58 concat { '#{@basedir}/file':
61 concat::fragment { 'new file':
62 target => '#{@basedir}/file',
63 content => 'new contents',
68 it 'applies the manifest twice with no "Filebucketed" stdout and no stderr' do
69 apply_manifest(pp, catch_failures: true) do |r|
70 expect(r.stdout).not_to match(%r{Filebucketed})
72 apply_manifest(pp, catch_changes: true)
73 expect(file("#{@basedir}/file")).to be_file
74 expect(file("#{@basedir}/file").content).to match %r{new contents}