Skip to content

Commit edc8162

Browse files
authored
test: Update connection-monitoring-and-pooling specs (#2560)
Update connection-monitoring-and-pooling tests ensuring ConnectionCreated proceed ConnectionReady events. Add a script for spec fetching convenience. NODE-2804
1 parent 4f9d4ce commit edc8162

7 files changed

+53
-7
lines changed

etc/update-spec-tests.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
# This script is used to fetch the latest tests for the specified spec.
4+
# It puts the tests in the direcory $spec_root. It should be run from the root of the repository.
5+
6+
set -o errexit
7+
set -o nounset
8+
9+
if [ ! -d ".git" ]; then
10+
echo "$0: This script must be run from the root of the repository" >&2
11+
exit 1
12+
fi
13+
14+
if [ $# -ne 1 ]; then
15+
echo "$0: This script must be passed exactly one argument for which tests to sync" >&2
16+
exit 1
17+
fi
18+
19+
spec_root="test/spec"
20+
21+
tmpdir=$(mktemp -d -t spec_testsXXXX)
22+
curl -sL "https://github.com/mongodb/specifications/archive/master.zip" -o "$tmpdir/specs.zip"
23+
unzip -d "$tmpdir" "$tmpdir/specs.zip" > /dev/null
24+
mkdir -p "$spec_root/$1"
25+
rsync -ah --exclude '*.rst' "$tmpdir/specifications-master/source/$1/tests/" "$spec_root/$1" --delete
26+
rm -rf "$tmpdir"

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

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@
1212
"type": "ConnectionCheckOutStarted",
1313
"address": 42
1414
},
15+
{
16+
"type": "ConnectionCreated",
17+
"connectionId": 1,
18+
"address": 42
19+
},
20+
{
21+
"type": "ConnectionReady",
22+
"connectionId": 1,
23+
"address": 42
24+
},
1525
{
1626
"type": "ConnectionCheckedOut",
1727
"connectionId": 1,
1828
"address": 42
1929
}
2030
],
2131
"ignore": [
22-
"ConnectionPoolCreated",
23-
"ConnectionCreated",
24-
"ConnectionReady"
32+
"ConnectionPoolCreated"
2533
]
2634
}

test/spec/connection-monitoring-and-pooling/pool-checkout-connection.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ operations:
66
events:
77
- type: ConnectionCheckOutStarted
88
address: 42
9+
- type: ConnectionCreated
10+
connectionId: 1
11+
address: 42
12+
- type: ConnectionReady
13+
connectionId: 1
14+
address: 42
915
- type: ConnectionCheckedOut
1016
connectionId: 1
1117
address: 42
1218
ignore:
1319
- ConnectionPoolCreated
14-
- ConnectionCreated
15-
- ConnectionReady

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

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
"event": "ConnectionCreated",
1212
"count": 3
1313
},
14+
{
15+
"name": "waitForEvent",
16+
"event": "ConnectionReady",
17+
"count": 3
18+
},
1419
{
1520
"name": "checkOut"
1621
}

test/spec/connection-monitoring-and-pooling/pool-create-min-size.yml

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ operations:
77
- name: waitForEvent
88
event: ConnectionCreated
99
count: 3
10+
- name: waitForEvent
11+
event: ConnectionReady
12+
count: 3
1013
- name: checkOut
1114
events:
1215
- type: ConnectionPoolCreated

test/spec/connection-monitoring-and-pooling/wait-queue-timeout.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "must aggressively timeout threads enqueued longer than waitQueueTimeoutMS",
55
"poolOptions": {
66
"maxPoolSize": 1,
7-
"waitQueueTimeoutMS": 100
7+
"waitQueueTimeoutMS": 20
88
},
99
"operations": [
1010
{

test/spec/connection-monitoring-and-pooling/wait-queue-timeout.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ style: unit
33
description: must aggressively timeout threads enqueued longer than waitQueueTimeoutMS
44
poolOptions:
55
maxPoolSize: 1
6-
waitQueueTimeoutMS: 100
6+
waitQueueTimeoutMS: 20
77
operations:
88
# Check out only possible connection
99
- name: checkOut

0 commit comments

Comments
 (0)