Skip to content

Commit a6b7b95

Browse files
committed
add second test that is deterministic
1 parent c11aef8 commit a6b7b95

File tree

1 file changed

+25
-4
lines changed
  • source/transactions-convenient-api/tests

1 file changed

+25
-4
lines changed

source/transactions-convenient-api/tests/README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,31 @@ If possible, drivers should implement these tests without requiring the test run
4141
the retry timeout. This might be done by internally modifying the timeout value used by `withTransaction` with some
4242
private API or using a mock timer.
4343

44+
### Retry Backoff is Random
45+
46+
Drivers should test that retries within `withTransaction` do not occur immediately. Configure a fail point that forces
47+
30 retries like so:
48+
49+
```json
50+
{
51+
"configureFailPoint": "failCommand",
52+
"mode": {
53+
"times": 30
54+
},
55+
"data": {
56+
"failCommands": ["commitTransaction"],
57+
"errorCode": 24,
58+
},
59+
}
60+
```
61+
62+
Let the callback for the transaction be a simple `insertOne` command. Check that the total time for all retries exceeded
63+
3.5 seconds.
64+
4465
### Retry Backoff is Enforced
4566

46-
Drivers should test that retries within `withTransaction` do not occur immediately. Optionally, set BACKOFF_INITIAL to a
47-
higher value to decrease flakiness of this test. Configure a fail point that forces 30 retries like so:
67+
Drivers should test that retries within `withTransaction` do not occur immediately. Configure the random number
68+
generator used for jitter to always return `1`. Configure a fail point that forces 30 retries like so:
4869

4970
```json
5071
{
@@ -59,8 +80,8 @@ higher value to decrease flakiness of this test. Configure a fail point that for
5980
}
6081
```
6182

62-
Additionally, let the callback for the transaction be a simple `insertOne` command. Check that the total time for all
63-
retries exceeded 1.25 seconds.
83+
Let the callback for the transaction be a simple `insertOne` command. Check that the total time for all retries exceeded
84+
3.5 seconds.
6485

6586
## Changelog
6687

0 commit comments

Comments
 (0)