Skip to content

Commit a820295

Browse files
committed
test: refactor existing appendable upload tests to work with new implementation
* Add incremental checksums to all messages * Add final object_checksums for all finalization * Remove tests that were testing the same thing -- especially when the setup was fairly involved * Remove some Integration tests that are now covered by unit tests of the bidi stream / bidi upload state (redirect limits, etc) * Refactor lots of common messages and test run flows to reduce duplication and make debugging easier * Ignore some tests that previously would partially split data rather than messages -- the current implementation only evicts when a whole message is consumed * In general, signal `onComplete()` after `onNext` in response to a finalize message * Update ITAppendableUploadTest to run for multiple permutations of BlobAppendableUploadConfigs
1 parent 174cd8f commit a820295

File tree

3 files changed

+617
-1095
lines changed

3 files changed

+617
-1095
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/Buffers.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,21 @@ static int fillFrom(ByteBuffer buf, ReadableByteChannel c) throws IOException {
173173
return total;
174174
}
175175

176+
static int emptyTo(ByteBuffer buf, WritableByteChannel c) throws IOException {
177+
int total = 0;
178+
while (buf.hasRemaining()) {
179+
int written = c.write(buf);
180+
if (written != -1) {
181+
total += written;
182+
} else if (total == 0) {
183+
return -1;
184+
} else {
185+
break;
186+
}
187+
}
188+
return total;
189+
}
190+
176191
static long totalRemaining(ByteBuffer[] buffers, int offset, int length) {
177192
long totalRemaning = 0;
178193
for (int i = offset; i < length; i++) {

0 commit comments

Comments
 (0)