Skip to content
Merged
Show file tree
Hide file tree
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 @@ -475,7 +475,7 @@ private BulkWriteTracker(final boolean retry, @Nullable final BulkWriteBatch bat
attempt = 0;
attempts = retry ? RetryState.RETRIES + 1 : 1;
this.batch = batch;
this.retryUntilTimeoutThrowsException = timeoutContext.hasTimeoutMS();;
this.retryUntilTimeoutThrowsException = timeoutContext.hasTimeoutMS();
}

boolean lastAttempt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.mongodb.internal.TimeoutSettings;
import com.mongodb.internal.async.function.LoopState.AttachmentKey;
import com.mongodb.internal.operation.retry.AttachmentKeys;
import org.junit.Ignore;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -331,14 +330,12 @@ void advanceOrThrowPredicateThrowsAfterFirstAttempt(final TimeoutContext timeout
}));
}

@Ignore // TODO (CSOT) update this
@Test
void advanceOrThrowPredicateThrowsTimeoutAfterFirstAttempt() {
RetryState retryState = new RetryState(TIMEOUT_CONTEXT_EXPIRED_GLOBAL_TIMEOUT);
RuntimeException predicateException = new RuntimeException() {
};
RuntimeException attemptException = new RuntimeException() {
};
RuntimeException attemptException = new MongoOperationTimeoutException(EXPECTED_TIMEOUT_MESSAGE);
MongoOperationTimeoutException mongoOperationTimeoutException = assertThrows(MongoOperationTimeoutException.class,
() -> retryState.advanceOrThrow(attemptException, (e1, e2) -> e2, (rs, e) -> {
assertTrue(rs.isFirstAttempt());
Expand All @@ -347,7 +344,7 @@ void advanceOrThrowPredicateThrowsTimeoutAfterFirstAttempt() {
}));

assertEquals(EXPECTED_TIMEOUT_MESSAGE, mongoOperationTimeoutException.getMessage());
assertEquals(attemptException, mongoOperationTimeoutException.getCause());
assertNull(mongoOperationTimeoutException.getCause());
}

@ParameterizedTest
Expand Down Expand Up @@ -417,14 +414,13 @@ void advanceOrThrowTransformAfterFirstAttempt(final TimeoutContext timeoutContex
}));
}

@Ignore // TODO (CSOT) update this
@Test
void advanceOrThrowTransformThrowsTimeoutExceptionAfterFirstAttempt() {
RetryState retryState = new RetryState(TIMEOUT_CONTEXT_EXPIRED_GLOBAL_TIMEOUT);
RuntimeException attemptException = new RuntimeException() {
};
RuntimeException transformerResult = new RuntimeException() {
};

RuntimeException attemptException = new MongoOperationTimeoutException(EXPECTED_TIMEOUT_MESSAGE);
RuntimeException transformerResult = new RuntimeException();

MongoOperationTimeoutException mongoOperationTimeoutException =
assertThrows(MongoOperationTimeoutException.class, () -> retryState.advanceOrThrow(attemptException,
(e1, e2) -> {
Expand All @@ -439,7 +435,6 @@ void advanceOrThrowTransformThrowsTimeoutExceptionAfterFirstAttempt() {

assertEquals(EXPECTED_TIMEOUT_MESSAGE, mongoOperationTimeoutException.getMessage());
assertEquals(transformerResult, mongoOperationTimeoutException.getCause());

}

@ParameterizedTest
Expand Down