Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,6 @@ public void deadlineExceededFailsAfterRetries() throws InterruptedException {
});
pipeline.run().waitUntilFinish();

// Due to jitter in backoff algorithm, we cannot test for an exact number of retries,
// but there will be more than 16 (normally 18).
int numSleeps = Mockito.mockingDetails(WriteToSpannerFn.sleeper).getInvocations().size();
assertTrue(String.format("Should be least 16 sleeps, got %d", numSleeps), numSleeps > 16);
long totalSleep =
Mockito.mockingDetails(WriteToSpannerFn.sleeper).getInvocations().stream()
.mapToLong(i -> i.getArgument(0))
Expand All @@ -504,6 +500,7 @@ public void deadlineExceededFailsAfterRetries() throws InterruptedException {
String.format("Should be least 7200s of sleep, got %d", totalSleep),
totalSleep >= Duration.standardHours(2).getMillis());

int numSleeps = Mockito.mockingDetails(WriteToSpannerFn.sleeper).getInvocations().size();
// Number of write attempts should be numSleeps + 2 write attempts:
// 1 batch attempt, numSleeps/2 batch retries,
// then 1 individual attempt + numSleeps/2 individual retries
Expand Down