From 849e66f6a1125b975a3b92e99d9898b2e1ea57e1 Mon Sep 17 00:00:00 2001 From: Robb Kistler Date: Fri, 11 Sep 2015 11:21:51 -0700 Subject: [PATCH] Change test_append_file to avoid object read-after-after-overwrite Open the test file once outside of the tests for loop. This helps avoid object consistency problems when running against S3 providers without strong consistency (like Amazon). See Issue #263. --- test/integration-test-main.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration-test-main.sh b/test/integration-test-main.sh index 6fc859d..c27a82b 100755 --- a/test/integration-test-main.sh +++ b/test/integration-test-main.sh @@ -63,13 +63,16 @@ function rm_test_dir { function test_append_file { echo "Testing append to file ..." - + # Open and close file outside of loop to avoid eventual object consistency + # issues + exec 3<> ${TEST_TEXT_FILE} # open # Write a small test file for x in `seq 1 $TEST_TEXT_FILE_LENGTH` do - echo "echo ${TEST_TEXT} to ${TEST_TEXT_FILE}" - echo $TEST_TEXT >> $TEST_TEXT_FILE + echo "echo ${TEST_TEXT} ${x} to ${TEST_TEXT_FILE}" + echo "$TEST_TEXT ${x}" >&3 done + exec 3>&- # close # Verify contents of file echo "Verifying length of test file"