-
Notifications
You must be signed in to change notification settings - Fork 67
Test isopen on response_stream
#470
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -88,10 +88,37 @@ try | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| try | ||||||||||||||||||||||
| S3.put_object(BUCKET_NAME, file_name) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # The tests below validate the current behavior of how streams are handled. | ||||||||||||||||||||||
| # Note: Avoid using `eof` for these tests can hang when using an unclosed `Base.BufferStream` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| stream = S3.get_object(BUCKET_NAME, file_name, Dict("return_stream" => true)) | ||||||||||||||||||||||
| println("test #466") # So we know if this is the reason for tests hanging. | ||||||||||||||||||||||
| @test eof(stream) # This will hang if #466 not fixed and using HTTP.jl v0.9.15+ | ||||||||||||||||||||||
| println("#466 fixed") | ||||||||||||||||||||||
| if AWS.DEFAULT_BACKEND[] isa AWS.HTTPBackend | ||||||||||||||||||||||
|
omus marked this conversation as resolved.
|
||||||||||||||||||||||
| @test !isopen(stream) | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| @test isopen(stream) | ||||||||||||||||||||||
| end | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| stream = Base.BufferStream() | ||||||||||||||||||||||
| S3.get_object(BUCKET_NAME, file_name, Dict("response_stream" => stream)) | ||||||||||||||||||||||
| if AWS.DEFAULT_BACKEND[] isa AWS.HTTPBackend | ||||||||||||||||||||||
|
Contributor
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. Why do different backends have different behaviour?
Member
Author
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. They really shouldn't. I think this all comes the fact that
Member
Author
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. I'm going to address these inconsistencies with #384
Contributor
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. thanks, i think the changes here would benefit from a comment explaining that they are testing the current behaviour and also linking to the issue you intend to open about possibly changing this behaviour (at first i thought we were testing we had "buggy" behaviour, which seemed an odd thing to test, but now i understand) The changes themselves all LGTM, i was just struggling to follow what it is that these tests are documenting |
||||||||||||||||||||||
| @test !isopen(stream) | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| # See: https://github.com/JuliaCloud/AWS.jl/issues/471 | ||||||||||||||||||||||
| @test_broken isopen(stream) | ||||||||||||||||||||||
|
omus marked this conversation as resolved.
omus marked this conversation as resolved.
|
||||||||||||||||||||||
| end | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| stream = Base.BufferStream() | ||||||||||||||||||||||
| S3.get_object( | ||||||||||||||||||||||
| BUCKET_NAME, | ||||||||||||||||||||||
| file_name, | ||||||||||||||||||||||
| Dict("response_stream" => stream, "return_stream" => true), | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| if AWS.DEFAULT_BACKEND[] isa AWS.HTTPBackend | ||||||||||||||||||||||
| @test !isopen(stream) | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| @test isopen(stream) | ||||||||||||||||||||||
|
Contributor
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. it's expected to be
Member
Author
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. This is the reason for the difference in behaviour. Calling AWS.jl/src/utilities/downloads_backend.jl Lines 35 to 39 in 1722aa5
Whether this function is called is dependent on a couple of factors: AWS.jl/src/utilities/downloads_backend.jl Lines 70 to 74 in 1722aa5
|
||||||||||||||||||||||
| end | ||||||||||||||||||||||
| finally | ||||||||||||||||||||||
| S3.delete_object(BUCKET_NAME, file_name) | ||||||||||||||||||||||
| end | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.