Skip to content

Commit 1097f63

Browse files
DRIVERS-2884 Update retryable reads and writes to retry for network error on conn c/o
2 parents c785d0a + f4c0bbd commit 1097f63

28 files changed

+590
-142
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ repos:
5252
entry: python3 scripts/check_md_html.py
5353

5454
- repo: https://github.com/tcort/markdown-link-check
55-
rev: v3.12.2
55+
rev: v3.13.7
5656
hooks:
5757
- id: markdown-link-check
5858
args: ["-q", "-c", "markdown_link_config.json"]

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,43 @@ To run a manual hook like `shellcheck` manually, run:
3636
pre-commit run --all-files --hook-stage manual shellcheck
3737
```
3838

39-
## Prose test numbering
39+
## Prose Test Numbering
4040

4141
When numbering prose tests, always use relative numbered bullets (`1.`). New tests must be appended at the end of the
4242
test list, since drivers may refer to existing tests by number.
4343

4444
Outdated tests must not be removed completely, but may be marked as such (e.g. by striking through or replacing the
4545
entire test with a note (e.g. *Removed*).
4646

47+
## Automated Test Best Practices
48+
49+
### Immutability of Existing Tests
50+
51+
**Do not modify existing tests**, unless they are testing incorrect behavior. Default to creating new tests or test
52+
files instead of altering existing ones.
53+
54+
Test files can only be deleted once no driver runs them anymore. In the meantime, for cases where a spec change removes
55+
functionality:
56+
57+
- **Unified Tests:** Use `runOnRequirements` to ensure tests are only executed by drivers supporting the required
58+
functionality.
59+
- **Non-Unified Tests (e.g., SDAM):** Drivers should skip tests that no longer apply to them.
60+
61+
### Test Isolation
62+
63+
When creating a new test, only test functionality directly related to the new spec requirements. Omit irrelevant fields
64+
in command expectations.
65+
66+
This makes tests more resilient against spec updates and avoids needing to change tests down the line.
67+
68+
### Schema Version Usage
69+
70+
Use the **lowest possible schema version** for each test.
71+
72+
Do NOT default to using the latest unified test format schema version, as the drivers may not all implement it. Use the
73+
oldest schema version that supports all functionality used in the test, even if it requires creating a new test file
74+
with a lower schema version.
75+
4776
## Building Documents
4877

4978
We use [mkdocs](https://www.mkdocs.org/) to render the documentation. To see a live view of the documentation, in a

source/auth/tests/mongodb-oidc.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,31 @@ source the `secrets-export.sh` file and use the associated env variables in your
232232
- Assert there were `SaslStart` commands executed.
233233
- Close the client.
234234

235+
#### 4.5 Reauthentication Succeeds when a Session is involved
236+
237+
- Create an OIDC configured client.
238+
- Set a fail point for `find` commands of the form:
239+
240+
```javascript
241+
{
242+
configureFailPoint: "failCommand",
243+
mode: {
244+
times: 1
245+
},
246+
data: {
247+
failCommands: [
248+
"find"
249+
],
250+
errorCode: 391 // ReauthenticationRequired
251+
}
252+
}
253+
```
254+
255+
- Start a new session.
256+
- In the started session perform a `find` operation that succeeds.
257+
- Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
258+
- Close the session and the client.
259+
235260
## (5) Azure Tests
236261

237262
Drivers MUST only run the Azure tests when testing on an Azure VM. See instructions in

source/change-streams/tests/README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,23 +194,13 @@ and sharded clusters unless otherwise specified:
194194

195195
11. For a `ChangeStream` under these conditions:
196196

197-
- Running against a server `>=4.0.7`.
198197
- The batch is empty or has been iterated to the last document.
199198

200199
Expected result:
201200

202201
- `getResumeToken` must return the `postBatchResumeToken` from the current command response.
203202

204-
12. For a `ChangeStream` under these conditions:
205-
206-
- Running against a server `<4.0.7`.
207-
- The batch is empty or has been iterated to the last document.
208-
209-
Expected result:
210-
211-
- `getResumeToken` must return the `_id` of the last document returned if one exists.
212-
- `getResumeToken` must return `resumeAfter` from the initial aggregate if the option was specified.
213-
- If `resumeAfter` was not specified, the `getResumeToken` result must be empty.
203+
12. **Removed**
214204

215205
13. For a `ChangeStream` under these conditions:
216206

source/client-side-encryption/tests/unified/fle2v2-BypassQueryAnalysis.json

Lines changed: 42 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-encryption/tests/unified/fle2v2-BypassQueryAnalysis.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ createEntities:
2828
id: &encryptedColl encryptedColl
2929
database: *encryptedDB
3030
collectionName: &encryptedCollName default
31+
- client:
32+
id: &client1 client1
33+
- database:
34+
id: &unencryptedDB unencryptedDB
35+
client: *client1
36+
databaseName: *encryptedDBName
37+
- collection:
38+
id: &unencryptedColl unencryptedColl
39+
database: *unencryptedDB
40+
collectionName: *encryptedCollName
3141

3242
initialData:
3343
- databaseName: &keyvaultDBName keyvault
@@ -61,6 +71,12 @@ tests:
6171
arguments:
6272
filter: { "_id": 1 }
6373
expectResult: [{"_id": 1, "encryptedIndexed": "123" }]
74+
- object: *unencryptedColl
75+
name: find
76+
arguments:
77+
filter: {}
78+
expectResult:
79+
- {"_id": 1, "encryptedIndexed": { "$$type": "binData" }, "__safeContent__": [{ "$binary" : { "base64" : "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", "subType" : "00" } }] }
6480
expectEvents:
6581
- client: *client0
6682
events:
@@ -111,9 +127,4 @@ tests:
111127
}
112128
$db: *keyvaultDBName
113129
readConcern: { level: "majority" }
114-
commandName: find
115-
outcome:
116-
- collectionName: *encryptedCollName
117-
databaseName: *encryptedDBName
118-
documents:
119-
- {"_id": 1, "encryptedIndexed": { "$$type": "binData" }, "__safeContent__": [{ "$binary" : { "base64" : "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", "subType" : "00" } }] }
130+
commandName: find

0 commit comments

Comments
 (0)