Skip to content

Commit 3a4c773

Browse files
Move handshake prose tests from spec into prose test file (#1714)
1 parent f8dbd24 commit 3a4c773

File tree

2 files changed

+74
-73
lines changed

2 files changed

+74
-73
lines changed

source/mongodb-handshake/handshake.md

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -452,78 +452,6 @@ limit:
452452
Additionally, implementers are encouraged to place high priority information about the platform earlier in the string,
453453
in order to avoid possible truncating of those details.
454454

455-
## Test Plan
456-
457-
Drivers that capture values for `client.env` should test that a connection and hello command succeeds in the presence of
458-
the following sets of environment variables:
459-
460-
1. Valid AWS
461-
462-
| Environment Variable | Value |
463-
| --------------------------------- | ------------------ |
464-
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
465-
| `AWS_REGION` | `us-east-2` |
466-
| `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` | `1024` |
467-
468-
2. Valid Azure
469-
470-
| Environment Variable | Value |
471-
| -------------------------- | ------ |
472-
| `FUNCTIONS_WORKER_RUNTIME` | `node` |
473-
474-
3. Valid GCP
475-
476-
| Environment Variable | Value |
477-
| ---------------------- | ------------- |
478-
| `K_SERVICE` | `servicename` |
479-
| `FUNCTION_MEMORY_MB` | `1024` |
480-
| `FUNCTION_TIMEOUT_SEC` | `60` |
481-
| `FUNCTION_REGION` | `us-central1` |
482-
483-
4. Valid Vercel
484-
485-
| Environment Variable | Value |
486-
| -------------------- | ------ |
487-
| `VERCEL` | `1` |
488-
| `VERCEL_REGION` | `cdg1` |
489-
490-
5. Invalid - multiple providers
491-
492-
| Environment Variable | Value |
493-
| -------------------------- | ------------------ |
494-
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
495-
| `FUNCTIONS_WORKER_RUNTIME` | `node` |
496-
497-
6. Invalid - long string
498-
499-
| Environment Variable | Value |
500-
| -------------------- | ---------------------- |
501-
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
502-
| `AWS_REGION` | `a` repeated 512 times |
503-
504-
7. Invalid - wrong types
505-
506-
| Environment Variable | Value |
507-
| --------------------------------- | ------------------ |
508-
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
509-
| `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` | `big` |
510-
511-
8. Invalid - `AWS_EXECUTION_ENV` does not start with `"AWS_Lambda_"`
512-
513-
| Environment Variable | Value |
514-
| -------------------- | ----- |
515-
| `AWS_EXECUTION_ENV` | `EC2` |
516-
517-
9. Valid container and FaaS provider. This test MUST verify that both the container metadata and the AWS Lambda metadata
518-
is present in `client.env`.
519-
520-
| Environment Variable | Value |
521-
| --------------------------------- | ------------------ |
522-
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
523-
| `AWS_REGION` | `us-east-2` |
524-
| `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` | `1024` |
525-
| `KUBERNETES_SERVICE_HOST` | `1` |
526-
527455
## Motivation For Change
528456

529457
Being able to annotate individual connections with custom data will allow users and sysadmins to easily correlate events
@@ -606,6 +534,7 @@ support the `hello` command, the `helloOk: true` argument is ignored and the leg
606534

607535
## Changelog
608536

537+
- 2024-11-05: Move handshake prose tests from spec file to prose test file.
609538
- 2024-10-09: Clarify that FaaS and container metadata must both be populated when both are present.
610539
- 2024-08-16: Migrated from reStructuredText to Markdown.
611540
- 2019-11-13: Added section about supporting wrapping libraries

source/mongodb-handshake/tests/README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,79 @@
22

33
## Prose Tests
44

5-
### Test that the driver accepts an arbitrary auth mechanism
5+
### Test 1: Test that environment metadata is properly captured
6+
7+
Drivers that capture values for `client.env` should test that a connection and hello command succeeds in the presence of
8+
the following sets of environment variables:
9+
10+
1. Valid AWS
11+
12+
| Environment Variable | Value |
13+
| --------------------------------- | ------------------ |
14+
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
15+
| `AWS_REGION` | `us-east-2` |
16+
| `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` | `1024` |
17+
18+
2. Valid Azure
19+
20+
| Environment Variable | Value |
21+
| -------------------------- | ------ |
22+
| `FUNCTIONS_WORKER_RUNTIME` | `node` |
23+
24+
3. Valid GCP
25+
26+
| Environment Variable | Value |
27+
| ---------------------- | ------------- |
28+
| `K_SERVICE` | `servicename` |
29+
| `FUNCTION_MEMORY_MB` | `1024` |
30+
| `FUNCTION_TIMEOUT_SEC` | `60` |
31+
| `FUNCTION_REGION` | `us-central1` |
32+
33+
4. Valid Vercel
34+
35+
| Environment Variable | Value |
36+
| -------------------- | ------ |
37+
| `VERCEL` | `1` |
38+
| `VERCEL_REGION` | `cdg1` |
39+
40+
5. Invalid - multiple providers
41+
42+
| Environment Variable | Value |
43+
| -------------------------- | ------------------ |
44+
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
45+
| `FUNCTIONS_WORKER_RUNTIME` | `node` |
46+
47+
6. Invalid - long string
48+
49+
| Environment Variable | Value |
50+
| -------------------- | ---------------------- |
51+
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
52+
| `AWS_REGION` | `a` repeated 512 times |
53+
54+
7. Invalid - wrong types
55+
56+
| Environment Variable | Value |
57+
| --------------------------------- | ------------------ |
58+
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
59+
| `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` | `big` |
60+
61+
8. Invalid - `AWS_EXECUTION_ENV` does not start with `"AWS_Lambda_"`
62+
63+
| Environment Variable | Value |
64+
| -------------------- | ----- |
65+
| `AWS_EXECUTION_ENV` | `EC2` |
66+
67+
9. Valid container and FaaS provider. This test MUST verify that both the container metadata and the AWS Lambda metadata
68+
is present in `client.env`.
69+
70+
| Environment Variable | Value |
71+
| --------------------------------- | ------------------ |
72+
| `AWS_EXECUTION_ENV` | `AWS_Lambda_java8` |
73+
| `AWS_REGION` | `us-east-2` |
74+
| `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` | `1024` |
75+
| `KUBERNETES_SERVICE_HOST` | `1` |
76+
77+
### Test 2: Test that the driver accepts an arbitrary auth mechanism
678

779
1. Mock the server response in a way that `saslSupportedMechs` array in the `hello` command response contains an
880
arbitrary string.

0 commit comments

Comments
 (0)