Skip to content

Commit 88a37e1

Browse files
committed
Merge branch 'master' into revise-encryption-tests
2 parents ac230aa + 9d0d3f0 commit 88a37e1

File tree

49 files changed

+2614
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2614
-244
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# Change to the working directory where the schema files are located
4+
cd source/unified-test-format || {
5+
echo "Directory source/unified-test-format not found."
6+
exit 1
7+
}
8+
9+
# Find the max X in schema-1.X.json
10+
max=0
11+
for file in schema-1.*.json; do
12+
# Extract the version number from the filename
13+
version=${file##*schema-1.}
14+
version=${version%.json}
15+
16+
if [[ $version =~ ^[0-9]+$ ]]; then
17+
# Compare the version number with the current max
18+
if ((version > max)); then
19+
max=$version
20+
fi
21+
fi
22+
done
23+
24+
if ((max == 0)); then
25+
echo "No schema files found."
26+
exit 1
27+
fi
28+
29+
# Compare that file vs schema-latest.json
30+
expected="schema-1.$max.json"
31+
if ! diff -u "$expected" schema-latest.json >/dev/null; then
32+
echo "schema-latest.json is not up to date with schema-1.$max.json"
33+
echo "please run 'make update-schema-latest' from source/ to update it"
34+
exit 1
35+
fi
36+
37+
exit 0

.github/workflows/unified-test-format-schema-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ jobs:
2828
run: make
2929
- name: Check all unified tests schema version is valid
3030
run: bash .github/workflows/check_schema_version.sh
31+
- name: Check schema-latest.json has been updated
32+
run: bash .github/workflows/check-schema-latest.sh

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
stages: [manual]
2424

2525
- repo: https://github.com/executablebooks/mdformat
26-
rev: 0.7.18
26+
rev: 0.7.22
2727
hooks:
2828
- id: mdformat
2929
args: ["--wrap=120", "--number"]
@@ -32,7 +32,7 @@ repos:
3232
- mdformat-frontmatter
3333
- mdformat-gfm
3434
- mdformat-gfm-alerts
35-
- mdformat-mkdocs~=3.0
35+
- mdformat-mkdocs
3636

3737
- repo: local
3838
hooks:
@@ -52,10 +52,10 @@ 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
58-
args: ["-c", "markdown_link_config.json"]
58+
args: ["-q", "-c", "markdown_link_config.json"]
5959

6060
- repo: https://github.com/rstcheck/rstcheck
6161
rev: v6.2.0

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/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ HAS_JSYAML:
1717
echo 'Error: need "npm install -g js-yaml"' 1>&2; \
1818
exit 1; \
1919
fi
20+
21+
VERSION := $(shell \
22+
find unified-test-format -maxdepth 1 -type f -name 'schema-1.*.json' \
23+
| sed -E 's:.*/schema-1\.([0-9]+)\.json:\1:' \
24+
| sort -n \
25+
| tail -n1 \
26+
)
27+
28+
.PHONY: update-schema-latest
29+
update-schema-latest:
30+
cp unified-test-format/schema-1.$(VERSION).json \
31+
unified-test-format/schema-latest.json
32+

source/auth/auth.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -922,18 +922,18 @@ else // the valid host string contains no periods and is not "aws.amazonaws.com"
922922
923923
Examples are provided below.
924924
925-
| Host | Region | Notes |
926-
| ------------------------------ | ---------- | ------------------------------------------------ |
927-
| sts.amazonaws.com | us-east-1 | the host is "sts.amazonaws.com"; use `us-east-1` |
928-
| sts.us-west-2.amazonaws.com | us-west-2 | use the second label |
929-
| sts.us-west-2.amazonaws.com.ch | us-west-2 | use the second label |
930-
| example.com | com | use the second label |
931-
| localhost | us-east-1 | no "`.`" character; use the default region |
932-
| sts..com | \< Error > | second label is empty |
933-
| .amazonaws.com | \< Error > | starts with a period |
934-
| sts.amazonaws. | \< Error > | ends with a period |
935-
| "" | \< Error > | empty string |
936-
| "string longer than 255" | \< Error > | string longer than 255 bytes |
925+
| Host | Region | Notes |
926+
| ------------------------------ | --------- | ------------------------------------------------ |
927+
| sts.amazonaws.com | us-east-1 | the host is "sts.amazonaws.com"; use `us-east-1` |
928+
| sts.us-west-2.amazonaws.com | us-west-2 | use the second label |
929+
| sts.us-west-2.amazonaws.com.ch | us-west-2 | use the second label |
930+
| example.com | com | use the second label |
931+
| localhost | us-east-1 | no "`.`" character; use the default region |
932+
| sts..com | < Error > | second label is empty |
933+
| .amazonaws.com | < Error > | starts with a period |
934+
| sts.amazonaws. | < Error > | ends with a period |
935+
| "" | < Error > | empty string |
936+
| "string longer than 255" | < Error > | string longer than 255 bytes |
937937
938938
#### [MongoCredential](#mongocredential) Properties
939939

0 commit comments

Comments
 (0)