Skip to content

Commit 1c97dc7

Browse files
committed
Guarding setting a custom jitter for only sync tests
1 parent 4bbef70 commit 1c97dc7

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,10 +1121,11 @@ public void setUp() {
11211121
chunksCollectionHelper = new CollectionHelper<>(new BsonDocumentCodec(), gridFsChunksNamespace);
11221122
commandListener = new TestCommandListener();
11231123

1124-
// setting jitter to 0 to make test using withTransaction deterministic (i.e retries immediately) otherwise we might get
1125-
// MongoCommandException setup in the failpoint instead of MongoOperationTimeoutException depending on the random jitter value.
1126-
ExponentialBackoff.setTestJitterSupplier(() -> 0);
1127-
1124+
if (!isAsync()) {
1125+
// setting jitter to 0 to make test using withTransaction deterministic (i.e retries immediately) otherwise we might get
1126+
// MongoCommandException setup in the failpoint instead of MongoOperationTimeoutException depending on the random jitter value.
1127+
ExponentialBackoff.setTestJitterSupplier(() -> 0);
1128+
}
11281129
}
11291130

11301131
@AfterEach
@@ -1151,7 +1152,9 @@ public void tearDown() throws InterruptedException {
11511152
executor.awaitTermination(MAX_VALUE, NANOSECONDS);
11521153
}
11531154

1154-
ExponentialBackoff.clearTestJitterSupplier();
1155+
if (!isAsync()) {
1156+
ExponentialBackoff.clearTestJitterSupplier();
1157+
}
11551158
}
11561159

11571160
@AfterAll

0 commit comments

Comments
 (0)