Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwriting directories should succeed #261

Merged
merged 1 commit into from
Mar 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions run/core/awscli/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,25 @@ function test_lookup_object_prefix() {
# if make bucket succeeds create a directory.
if [ $rv -eq 0 ]; then
function="${AWS} s3api put-object --bucket ${bucket_name} --key prefix/directory/"
# save the ref to function being tested, so it can be logged
test_function=${function}

out=$($function 2>&1)

rv=$?
else
# if make_bucket fails, $bucket_name has the error output
out="${bucket_name}"
fi

if [ $rv -eq 0 ]; then
## Attempt an overwrite of the prefix again and should succeed as well.
function="${AWS} s3api put-object --bucket ${bucket_name} --key prefix/directory/"
# save the ref to function being tested, so it can be logged
test_function=${function}

out=$($function 2>&1)

rv=$?
else
# if make_bucket fails, $bucket_name has the error output
Expand All @@ -205,6 +223,24 @@ function test_lookup_object_prefix() {
rv=$?
fi

# Attempt a delete on prefix shouldn't delete the directory since we have an object inside it.
if [ $rv -eq 0 ]; then
function="${AWS} s3api delete-object --bucket ${bucket_name} --key prefix/directory/"
# 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 object should succeed.
if [ $rv -eq 0 ]; then
function="${AWS} s3api head-object --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