Skip to content

Commit

Permalink
Add tests for small chunk downloads via the streaming interface
Browse files Browse the repository at this point in the history
This also tests that it's possible to customise the chunk size on
individual adapters.
  • Loading branch information
ivgiuliani committed Apr 13, 2023
1 parent bffaa4a commit 5dd0594
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/bucket_store_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@
expect(rebuilt_large_file.size).to eq(large_file_content.size)
expect(rebuilt_large_file).to eq(large_file_content)
end

it "allows downloads of individual small chunks" do
described_class.
for("#{base_bucket_uri}/large.txt").
upload!("1234567890")

chunks = described_class.for("#{base_bucket_uri}/large.txt").
stream.
download(chunk_size: 1).
to_a

expect(chunks.size).to eq(10)
expect(chunks.map { |_meta, chunk| chunk }).to match_array(
%w[1 2 3 4 5 6 7 8 9 0],
)
end
end
end
end
Expand Down

0 comments on commit 5dd0594

Please sign in to comment.