@@ -94,6 +94,11 @@ for verification purposes.
94
94
Drivers should verify that metadata provided after ` MongoClient ` initialization is appended, not replaced, and is
95
95
visible in the ` hello ` command of new connections.
96
96
97
+ There are multiple test cases parameterized with ` DriverInfoOptions ` to be appended after ` MongoClient ` initialization.
98
+ Before each test case, perform the setup.
99
+
100
+ #### Setup
101
+
97
102
1 . Create a ` MongoClient ` instance with the following:
98
103
99
104
- ` maxIdleTimeMS ` set to ` 1ms `
@@ -114,33 +119,67 @@ visible in the `hello` command of new connections.
114
119
115
120
3 . Wait 5ms for the connection to become idle.
116
121
117
- 4 . Append the following ` DriverInfoOptions ` to the ` MongoClient ` metadata:
122
+ #### Parameterized test cases
118
123
119
- | Field | Value |
120
- | -------- | ------------------ |
121
- | name | framework |
122
- | version | 2.0 |
123
- | platform | Framework Platform |
124
+ ** Case 1**
125
+
126
+ | Field | Value |
127
+ | -------- | ------------------ |
128
+ | name | framework |
129
+ | version | 2.0 |
130
+ | platform | Framework Platform |
131
+
132
+ ** Case 2**
124
133
125
- 5 . Send ` ping ` command to the server and verify:
134
+ | Field | Value |
135
+ | -------- | --------- |
136
+ | name | framework |
137
+ | version | 2.0 |
138
+ | platform | null |
139
+
140
+ ** Case 3**
141
+
142
+ | Field | Value |
143
+ | -------- | ------------------ |
144
+ | name | framework |
145
+ | version | null |
146
+ | platform | Framework Platform |
147
+
148
+ ** Case 4**
149
+
150
+ | Field | Value |
151
+ | -------- | --------- |
152
+ | name | framework |
153
+ | version | null |
154
+ | platform | null |
155
+
156
+ #### Running a test case
157
+
158
+ 1 . Append the ` DriverInfoOptions ` from the selected test case to the ` MongoClient ` metadata.
159
+
160
+ 2 . Send a ` ping ` command to the server and verify:
126
161
127
162
- The command succeeds.
128
163
129
164
- The framework metadata is appended to the existing ` DriverInfoOptions ` in the ` client.driver ` fields of the ` hello `
130
- command.
165
+ command, with values separated by a pipe ` | ` .
131
166
132
- | Field | Value |
133
- | -------- | ------------------------------------ |
134
- | name | library\| framework |
135
- | version | 1.2\| 2.0 |
136
- | platform | Library Platform\| Framework Platform |
167
+ - ` client.driver.name ` :
168
+ - If test case's name is non-null: ` library|<name> `
169
+ - Otherwise, the field remains unchanged: ` library `
170
+ - ` client.driver.version ` :
171
+ - If test case's version is non-null: ` 1.2|<version> `
172
+ - Otherwise, the field remains unchanged: ` 1.2 `
173
+ - ` client.driver.platform ` :
174
+ - If test case's platform is non-null: ` Library Platform|<platform> `
175
+ - Otherwise, the field remains unchanged: ` Library Platform `
137
176
138
- - All other subfields in the client document remain unchanged from ` initialClientMetadata ` .
177
+ - All other subfields in the ` client ` document remain unchanged from ` initialClientMetadata ` .
139
178
140
179
### Test 2: Test that metadata is not updated on established connections
141
180
142
181
Drivers should verify that appending metadata after ` MongoClient ` initialization does ** not** close existing
143
- connections, and that no new ` hello ` command is sent.
182
+ connections, and that no new ` hello ` command is sent on existing connections .
144
183
145
184
1 . Create a ` MongoClient ` instance with wrapping library metadata:
146
185
@@ -163,7 +202,7 @@ connections, and that no new `hello` command is sent.
163
202
| version | 2.0 |
164
203
| platform | Framework Platform |
165
204
166
- 4 . Send another ` ping ` command to the server and verify:
205
+ 4 . Send a ` ping ` command to the server and verify:
167
206
168
207
- The command succeeds.
169
208
- No ` hello ` command is sent.
0 commit comments