-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PUP-6675) Add exec test using large output
This test passes lots of data over pipes when performing an exec, to attempt to catch any issues with buffered reads over pipes. On *nix the standand buffer size is 64KB.
- Loading branch information
1 parent
15ab173
commit 84d758d
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
acceptance/tests/resource/exec/should_accept_large_output.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
test_name "tests that puppet correctly captures large and empty output." | ||
|
||
@testfilename = master.tmpfile('should_accept_large_output').split('/')[-1] | ||
|
||
agents.each do |agent| | ||
testfile = | ||
if /windows/ =~ agent[:platform] | ||
"C:/#{@testfilename}" | ||
else | ||
"/tmp/#{@testfilename}" | ||
end | ||
|
||
# Generate >64KB file to exceed pipe buffer. | ||
lorem_ipsum = <<EOF | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna | ||
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | ||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint | ||
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
EOF | ||
create_remote_file(agent, testfile, lorem_ipsum*1024) | ||
|
||
apply_manifest_on(agent, "exec {'cat #{testfile}': path => ['/bin', '/usr/bin', 'C:/cygwin32/bin', 'C:/cygwin64/bin'], logoutput => true}") do | ||
fail_test "didn't seem to run the command" unless | ||
stdout.include? 'executed successfully' | ||
fail_test "didn't print output correctly" unless | ||
stdout.lines.select {|line| line =~ /\/returns:/}.count == 4097 | ||
end | ||
|
||
apply_manifest_on(agent, "exec {'echo': path => ['/bin', '/usr/bin', 'C:/cygwin32/bin', 'C:/cygwin64/bin'], logoutput => true}") do | ||
fail_test "didn't seem to run the command" unless | ||
stdout.include? 'executed successfully' | ||
end | ||
end |