From 84d758d3752720aeffd39b709d7ad92b5289c9e5 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 5 May 2017 11:08:49 -0700 Subject: [PATCH] (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. --- .../exec/should_accept_large_output.rb | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 acceptance/tests/resource/exec/should_accept_large_output.rb diff --git a/acceptance/tests/resource/exec/should_accept_large_output.rb b/acceptance/tests/resource/exec/should_accept_large_output.rb new file mode 100644 index 00000000000..2e8c296f9db --- /dev/null +++ b/acceptance/tests/resource/exec/should_accept_large_output.rb @@ -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 = < ['/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