Skip to content

Commit

Permalink
Try #470:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Sep 29, 2021
2 parents 1722aa5 + 6457586 commit 16e6c65
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 3 deletions.
31 changes: 28 additions & 3 deletions test/issues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,35 @@ try

try
S3.put_object(BUCKET_NAME, file_name)

# 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
@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
@test !isopen(stream)
else
@test_broken isopen(stream)
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)
end
finally
S3.delete_object(BUCKET_NAME, file_name)
end
Expand Down
42 changes: 42 additions & 0 deletions test/minio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,48 @@ try
@test sort(getindex.(objs_prefix["Contents"], "Key")) == ["empty", "myobject"]
@test objs_prefix["CommonPrefixes"]["Prefix"] == "foo/"

# Duplicated testset from "test/issues.jl". Useful for testing outside the CI. Ideally,
# the tests should be revised such that local testing works without having to duplicate
# testsets.
@testset "issue 466" begin
file_name = "hang.txt"

try
S3.put_object("anewbucket", file_name)

# Note: Using `eof` for these tests can hang when using an unclosed `Base.BufferStream`

stream = S3.get_object("anewbucket", file_name, Dict("return_stream" => true))
if AWS.DEFAULT_BACKEND[] isa AWS.HTTPBackend
@test !isopen(stream)
else
@test isopen(stream)
end

stream = Base.BufferStream()
S3.get_object("anewbucket", file_name, Dict("response_stream" => stream))
if AWS.DEFAULT_BACKEND[] isa AWS.HTTPBackend
@test !isopen(stream)
else
@test_broken isopen(stream)
end

stream = Base.BufferStream()
S3.get_object(
"anewbucket",
file_name,
Dict("response_stream" => stream, "return_stream" => true),
)
if AWS.DEFAULT_BACKEND[] isa AWS.HTTPBackend
@test !isopen(stream)
else
@test isopen(stream)
end
finally
S3.delete_object("anewbucket", file_name)
end
end

finally
# Delete all objects and the bucket
objs = S3.list_objects_v2("anewbucket")
Expand Down

0 comments on commit 16e6c65

Please sign in to comment.