Merge pull request #1111 from gaul/test/read-external-object

Add test to read an externally created object
This commit is contained in:
Takeshi Nakatani 2019-08-03 22:36:34 +09:00 committed by GitHub
commit 8cc008c501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -304,11 +304,19 @@ function test_external_modification {
echo "old" > ${TEST_TEXT_FILE} echo "old" > ${TEST_TEXT_FILE}
OBJECT_NAME="$(basename $PWD)/${TEST_TEXT_FILE}" OBJECT_NAME="$(basename $PWD)/${TEST_TEXT_FILE}"
sleep 2 sleep 2
echo "new new" | AWS_ACCESS_KEY_ID=local-identity AWS_SECRET_ACCESS_KEY=local-credential aws s3 --endpoint-url "${S3_URL}" --no-verify-ssl cp - "s3://${TEST_BUCKET_1}/${OBJECT_NAME}" echo "new new" | aws_cli cp - "s3://${TEST_BUCKET_1}/${OBJECT_NAME}"
cmp ${TEST_TEXT_FILE} <(echo "new new") cmp ${TEST_TEXT_FILE} <(echo "new new")
rm -f ${TEST_TEXT_FILE} rm -f ${TEST_TEXT_FILE}
} }
function test_read_external_object() {
describe "create objects via aws CLI and read via s3fs"
OBJECT_NAME="$(basename $PWD)/${TEST_TEXT_FILE}"
echo "test" | aws_cli cp - "s3://${TEST_BUCKET_1}/${OBJECT_NAME}"
cmp ${TEST_TEXT_FILE} <(echo "test")
rm -f ${TEST_TEXT_FILE}
}
function test_rename_before_close { function test_rename_before_close {
describe "Testing rename before close ..." describe "Testing rename before close ..."
( (
@ -579,6 +587,7 @@ function add_all_tests {
add_tests test_list add_tests test_list
add_tests test_remove_nonempty_directory add_tests test_remove_nonempty_directory
add_tests test_external_modification add_tests test_external_modification
add_tests test_read_external_object
add_tests test_rename_before_close add_tests test_rename_before_close
add_tests test_multipart_upload add_tests test_multipart_upload
add_tests test_multipart_copy add_tests test_multipart_copy

View File

@ -218,3 +218,7 @@ function get_mtime() {
stat -c %Y "$1" stat -c %Y "$1"
fi fi
} }
function aws_cli() {
AWS_ACCESS_KEY_ID=local-identity AWS_SECRET_ACCESS_KEY=local-credential aws s3 --endpoint-url "${S3_URL}" --no-verify-ssl $*
}