1
test_name "#6541: file type truncates target when filebucket cannot retrieve hash"
4
on agents, host_command('rm -rf #{host["puppetvardir"]}/*bucket')
6
step "write zero length file"
7
manifest = "file { '#{target}': content => '' }"
8
apply_manifest_on(agents, manifest)
10
step "overwrite file, causing zero-length file to be backed up"
11
manifest = "file { '#{target}': content => 'some text' }"
12
apply_manifest_on(agents, manifest)
14
test_name "verify invalid hashes should not change the file"
15
manifest = "file { '#{target}': content => '{md5}notahash' }"
17
apply_manifest_on(host, manifest) do
18
assert_no_match(/content changed/, stdout, "#{host}: shouldn't have overwrote the file")
22
test_name "verify valid but unbucketed hashes should not change the file"
23
manifest = "file { '#{target}': content => '{md5}13ad7345d56b566a4408ffdcd877bc78' }"
25
apply_manifest_on(host, manifest) do
26
assert_no_match(/content changed/, stdout, "#{host}: shouldn't have overwrote the file")
30
test_name "verify that an empty file can be retrieved from the filebucket"
31
manifest = "file { '#{target}': content => '{md5}d41d8cd98f00b204e9800998ecf8427e' }"
33
apply_manifest_on(host, manifest) do
34
assert_match(/content changed '\{md5\}552e21cd4cd9918678e3c1a0df491bc3' to '\{md5\}d41d8cd98f00b204e9800998ecf8427e'/, stdout, "#{host}: shouldn't have overwrote the file")