Skip to content

Commit c6bd91c

Browse files
fix tests && re-run lint
1 parent db39675 commit c6bd91c

9 files changed

Lines changed: 25 additions & 16 deletions

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export {
8787
MongoWriteConcernError,
8888
WriteConcernErrorResult
8989
} from './error';
90+
export { TokenBucket } from './token_bucket';
9091
export {
9192
AbstractCursor,
9293
// Actual driver classes exported

src/token_bucket.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @internal
3+
*/
14
export class TokenBucket {
25
private budget: number;
36
constructor(allowance: number) {

test/spec/client-backpressure/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Drivers should test that retries do not occur immediately when a SystemOverloade
3535
}
3636
```
3737

38-
3. Execute the following command. Expect that the command errors. Measure the duration of the command execution.
38+
3. Execute the following command. Expect that the command errors. Measure the duration of the command execution.
3939

4040
```javascript
4141
const start = performance.now();
@@ -44,16 +44,17 @@ Drivers should test that retries do not occur immediately when a SystemOverloade
4444
).to.be.an.instanceof(MongoServerError);
4545
const end = performance.now();
4646
```
47-
48-
4. Configure the random number generator used for jitter to always return `1`.
47+
48+
4. Configure the random number generator used for jitter to always return `1`.
49+
4950
5. Execute step 3 again.
51+
5052
6. Compare the two time between the two runs.
5153
```python
5254
assertTrue(absolute_value(with_backoff_time - (no_backoff_time + 3.1 seconds)) < 1)
5355
```
54-
The sum of 5 backoffs is 3.1 seconds. There is a 1-second window to account for potential variance between
55-
the two runs.
56-
56+
The sum of 5 backoffs is 3.1 seconds. There is a 1-second window to account for potential variance between the two
57+
runs.
5758

5859
## Changelog
5960

test/spec/client-backpressure/backpressure-retry-loop.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,11 @@
381381
},
382382
{
383383
"description": "client.clientBulkWrite retries using operation loop",
384-
"runOnRequirements": {
385-
"minServerVersion": "8.0"
386-
},
384+
"runOnRequirements": [
385+
{
386+
"minServerVersion": "8.0"
387+
}
388+
],
387389
"operations": [
388390
{
389391
"object": "utilCollection",

test/spec/client-backpressure/backpressure-retry-loop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ tests:
224224
-
225225
description: 'client.clientBulkWrite retries using operation loop'
226226
runOnRequirements:
227-
minServerVersion: '8.0'
227+
- minServerVersion: '8.0' # client bulk write added to server in 8.0
228228
operations:
229229
-
230230
object: *utilCollection

test/spec/client-backpressure/backpressure-retry-loop.yml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tests:
5858
description: '{{operation.object}}.{{operation.operation_name}} retries using operation loop'
5959
{%- if ((operation.operation_name == 'clientBulkWrite')) %}
6060
runOnRequirements:
61-
minServerVersion: '8.0'
61+
- minServerVersion: '8.0' # client bulk write added to server in 8.0
6262
{%- endif %}
6363
operations:
6464
-

test/spec/client-backpressure/backpressure-retry-max-attempts.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,11 @@
364364
},
365365
{
366366
"description": "client.clientBulkWrite retries at most maxAttempts=5 times",
367-
"runOnRequirements": {
368-
"minServerVersion": "8.0"
369-
},
367+
"runOnRequirements": [
368+
{
369+
"minServerVersion": "8.0"
370+
}
371+
],
370372
"operations": [
371373
{
372374
"name": "failPoint",

test/spec/client-backpressure/backpressure-retry-max-attempts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ tests:
203203
-
204204
description: 'client.clientBulkWrite retries at most maxAttempts=5 times'
205205
runOnRequirements:
206-
minServerVersion: '8.0'
206+
- minServerVersion: '8.0' # client bulk write added to server in 8.0
207207
operations:
208208
- name: failPoint
209209
object: testRunner

test/spec/client-backpressure/backpressure-retry-max-attempts.yml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tests:
4646
description: '{{operation.object}}.{{operation.operation_name}} retries at most maxAttempts=5 times'
4747
{%- if ((operation.operation_name == 'clientBulkWrite')) %}
4848
runOnRequirements:
49-
minServerVersion: '8.0'
49+
- minServerVersion: '8.0' # client bulk write added to server in 8.0
5050
{%- endif %}
5151
operations:
5252
- name: failPoint

0 commit comments

Comments
 (0)