Skip to content

Commit 783489b

Browse files
committed
update prose test num.2
1 parent 4c52f77 commit 783489b

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

test/integration/client-backpressure/client-backpressure.prose.test.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,25 @@ describe('Client Backpressure (Prose)', function () {
6666
}
6767
);
6868

69-
it('Test 2: Token Bucket capacity is Enforced', async () => {
70-
// 1-2. Assert that the client's retry token bucket is at full capacity and that the capacity
71-
// is DEFAULT_RETRY_TOKEN_CAPACITY.
69+
it('Test 2: Token Bucket capacity is Enforced', async function () {
70+
// 1. Let client be a MongoClient with adaptiveRetries=True.
71+
const client = this.configuration.newClient({
72+
adaptiveRetries: true
73+
});
74+
await client.connect();
75+
76+
// 2. Assert that the client's retry token bucket is at full capacity and that the capacity is DEFAULT_RETRY_TOKEN_CAPACITY.
7277
const tokenBucket = client.topology.tokenBucket;
7378
expect(tokenBucket).to.have.property('budget', INITIAL_TOKEN_BUCKET_SIZE);
7479
expect(tokenBucket).to.have.property('capacity', INITIAL_TOKEN_BUCKET_SIZE);
7580

76-
// 3. Execute a successful ping command.
81+
// 3. Using client, execute a successful ping command.
7782
await client.db('admin').command({ ping: 1 });
7883

79-
// 4. Assert that the successful command did not increase the number of tokens in the bucket
80-
// above DEFAULT_RETRY_TOKEN_CAPACITY.
84+
// 4. Assert that the successful command did not increase the number of tokens in the bucket above DEFAULT_RETRY_TOKEN_CAPACITY.
8185
expect(tokenBucket).to.have.property('budget').that.is.at.most(INITIAL_TOKEN_BUCKET_SIZE);
86+
87+
await client.close();
8288
});
8389

8490
it(

0 commit comments

Comments
 (0)