Skip to content

Commit 3267f1e

Browse files
committed
update spec tests
1 parent 351a2a6 commit 3267f1e

File tree

7 files changed

+41
-5
lines changed

7 files changed

+41
-5
lines changed

src/test/spec/json/connection-monitoring-and-pooling/README.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,20 @@ Unit Test Format:
3636

3737
All Unit Tests have some of the following fields:
3838

39-
- ``poolOptions``: if present, connection pool options to use when creating a pool
39+
- ``poolOptions``: If present, connection pool options to use when creating a pool;
40+
both `standard ConnectionPoolOptions <https://github.com/mongodb/specifications/blob/master/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst#connection-pool-options-1>`__
41+
and the following test-specific options are allowed:
42+
43+
- ``backgroundThreadIntervalMS``: A time interval between the end of a
44+
`Background Thread Run <https://github.com/mongodb/specifications/blob/master/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst#background-thread>`__
45+
and the beginning of the next Run. If a Connection Pool does not implement a Background Thread, the Test Runner MUST ignore the option.
46+
If the option is not specified, an implementation is free to use any value it finds reasonable.
47+
48+
Possible values (0 is not allowed):
49+
50+
- A negative value: never begin a Run.
51+
- A positive value: the interval between Runs in milliseconds.
52+
4053
- ``operations``: A list of operations to perform. All operations support the following fields:
4154

4255
- ``name``: A string describing which operation to issue.
@@ -155,8 +168,6 @@ For each YAML file with ``style: unit``:
155168

156169
- If ``poolOptions`` is specified, use those options to initialize both pools
157170
- The returned pool must have an ``address`` set as a string value.
158-
- If the pool uses a background thread to satisfy ``minPoolSize``, ensure it
159-
attempts to create a new connection every 50ms.
160171

161172
- Process each ``operation`` in ``operations`` (on the main thread)
162173

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-no-idle.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"style": "unit",
44
"description": "must destroy and must not check out an idle connection if found while iterating available connections",
55
"poolOptions": {
6-
"maxIdleTimeMS": 10
6+
"maxIdleTimeMS": 10,
7+
"backgroundThreadIntervalMS": -1
78
},
89
"operations": [
910
{
@@ -23,6 +24,11 @@
2324
},
2425
{
2526
"name": "checkOut"
27+
},
28+
{
29+
"name": "waitForEvent",
30+
"event": "ConnectionCheckedOut",
31+
"count": 2
2632
}
2733
],
2834
"events": [

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-no-idle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ style: unit
33
description: must destroy and must not check out an idle connection if found while iterating available connections
44
poolOptions:
55
maxIdleTimeMS: 10
6+
backgroundThreadIntervalMS: -1
67
operations:
78
- name: ready
89
- name: checkOut
@@ -12,6 +13,9 @@ operations:
1213
- name: wait
1314
ms: 50
1415
- name: checkOut
16+
- name: waitForEvent
17+
event: ConnectionCheckedOut
18+
count: 2
1519
events:
1620
- type: ConnectionPoolCreated
1721
address: 42

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-no-stale.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"version": 1,
33
"style": "unit",
44
"description": "must destroy and must not check out a stale connection if found while iterating available connections",
5+
"poolOptions": {
6+
"backgroundThreadIntervalMS": -1
7+
},
58
"operations": [
69
{
710
"name": "ready"
@@ -22,6 +25,11 @@
2225
},
2326
{
2427
"name": "checkOut"
28+
},
29+
{
30+
"name": "waitForEvent",
31+
"event": "ConnectionCheckedOut",
32+
"count": 2
2533
}
2634
],
2735
"events": [

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-no-stale.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
version: 1
22
style: unit
33
description: must destroy and must not check out a stale connection if found while iterating available connections
4+
poolOptions:
5+
backgroundThreadIntervalMS: -1
46
operations:
57
- name: ready
68
- name: checkOut
@@ -10,6 +12,9 @@ operations:
1012
- name: clear
1113
- name: ready
1214
- name: checkOut
15+
- name: waitForEvent
16+
event: ConnectionCheckedOut
17+
count: 2
1318
events:
1419
- type: ConnectionPoolCreated
1520
address: 42

src/test/spec/json/connection-monitoring-and-pooling/pool-clear-min-size.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"style": "unit",
44
"description": "pool clear halts background minPoolSize establishments",
55
"poolOptions": {
6-
"minPoolSize": 1
6+
"minPoolSize": 1,
7+
"backgroundThreadIntervalMS": 50
78
},
89
"operations": [
910
{

src/test/spec/json/connection-monitoring-and-pooling/pool-clear-min-size.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ style: unit
33
description: pool clear halts background minPoolSize establishments
44
poolOptions:
55
minPoolSize: 1
6+
backgroundThreadIntervalMS: 50
67
operations:
78
- name: ready
89
- name: waitForEvent

0 commit comments

Comments
 (0)