Skip to content

Commit

Permalink
awscli: Create directory prefix first before uploading object
Browse files Browse the repository at this point in the history
Fixes #231
  • Loading branch information
harshavardhana committed Nov 22, 2017
1 parent 8af058c commit 6cb2b05
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions run/core/awscli/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,25 @@ function test_lookup_object_prefix() {
bucket_name=$(make_bucket)
rv=$?

# if make bucket succeeds upload a file
# if make bucket succeeds create a directory.
if [ $rv -eq 0 ]; then
function="${AWS} s3api put-object --body ${MINT_DATA_DIR}/datafile-1-MB --bucket ${bucket_name} --key prefix/directory/datafile-1-MB"
function="${AWS} s3api put-object --bucket ${bucket_name} --key prefix/directory/"
out=$($function 2>&1)
rv=$?
else
# if make_bucket fails, $bucket_name has the error output
out="${bucket_name}"
fi

# if directory create succeeds, upload the object.
if [ $rv -eq 0 ]; then
function="${AWS} s3api put-object --body ${MINT_DATA_DIR}/datafile-1-MB --bucket ${bucket_name} --key prefix/directory/datafile-1-MB"
# save the ref to function being tested, so it can be logged
test_function=${function}
out=$($function 2>&1)
rv=$?
fi

# if upload succeeds lookup for the prefix.
if [ $rv -eq 0 ]; then
function="${AWS} s3api head-object --bucket ${bucket_name} --key prefix/directory"
Expand Down

0 comments on commit 6cb2b05

Please sign in to comment.