-
Notifications
You must be signed in to change notification settings - Fork 34
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
Use list_objects_v2 to check isdir #265
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
beb513a
Use list_objects_v2 to check isdir
fchorney 05677bd
Update src/s3path.jl
fchorney 38340c1
Add isdir Tests
fchorney a51c8a8
Make NoSuchBucket test a patch
fchorney 21d281a
Sort `using`s
fchorney facf9ec
Restructure isdir tests
fchorney 7915e9d
Bump minor version
fchorney c05deca
Add Minio 0.2 support
fchorney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,6 +421,42 @@ function s3path_tests(config) | |
end | ||
end | ||
|
||
@testset "isdir" begin | ||
# Top level | ||
path = S3Path("s3://$(bucket_name)"; config=config) | ||
@test isdir(path) == true | ||
|
||
# No Such Bucket | ||
test_exception = AWSException( | ||
"NoSuchBucket", | ||
"", | ||
nothing, | ||
AWS.HTTP.Exceptions.StatusError(404, "", "", ""), | ||
nothing, | ||
) | ||
patch = @patch AWSS3.S3.list_objects_v2(args...; kwargs...) = throw(test_exception) | ||
|
||
path = S3Path("s3://some_non_existent_bucket_7051649213"; config=config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should make this an actual AWSException w/ the |
||
apply(patch) do | ||
@test isdir(path) == false | ||
end | ||
|
||
# Other Error | ||
test_exception = AWSException( | ||
"TestException", | ||
"", | ||
nothing, | ||
AWS.HTTP.Exceptions.StatusError(404, "", "", ""), | ||
nothing, | ||
) | ||
patch = @patch AWSS3.S3.list_objects_v2(args...; kwargs...) = throw(test_exception) | ||
|
||
path = S3Path("s3://$(bucket_name)"; config=config) | ||
apply(patch) do | ||
@test_throws AWSException isdir(path) | ||
end | ||
end | ||
|
||
mattBrzezinski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@testset "JSON roundtripping" begin | ||
json_path = S3Path("s3://$(bucket_name)/test_json"; config=config) | ||
my_dict = Dict("key" => "value", "key2" => 5.0) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically we're changing behaviour that folks could depend on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm somewhat unsure if that's the case, what behaviour could someone depend on? Theoretically you already need
list_objects
permissions to do anisdir
on a non root bucket. I guess this could potentially be an issue for someone that is only doing anisdir
on a root bucket somehow? I'm fine to bump the minor if you still think that should be the caseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumped the version regardless