Skip to content

Commit 9101b41

Browse files
authored
GODRIVER-1826 Sync maxConnecting tests, support failpoints in CMAP spec tests, and fix failures. (#864)
1 parent 649258b commit 9101b41

18 files changed

+1117
-79
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"version": 1,
3+
"style": "integration",
4+
"description": "custom maxConnecting is enforced",
5+
"runOn": [
6+
{
7+
"minServerVersion": "4.4.0"
8+
}
9+
],
10+
"failPoint": {
11+
"configureFailPoint": "failCommand",
12+
"mode": "alwaysOn",
13+
"data": {
14+
"failCommands": [
15+
"isMaster",
16+
"hello"
17+
],
18+
"closeConnection": false,
19+
"blockConnection": true,
20+
"blockTimeMS": 500
21+
}
22+
},
23+
"poolOptions": {
24+
"maxConnecting": 1,
25+
"maxPoolSize": 2,
26+
"waitQueueTimeoutMS": 5000
27+
},
28+
"operations": [
29+
{
30+
"name": "ready"
31+
},
32+
{
33+
"name": "start",
34+
"target": "thread1"
35+
},
36+
{
37+
"name": "start",
38+
"target": "thread2"
39+
},
40+
{
41+
"name": "checkOut",
42+
"thread": "thread1"
43+
},
44+
{
45+
"name": "waitForEvent",
46+
"event": "ConnectionCreated",
47+
"count": 1
48+
},
49+
{
50+
"name": "checkOut",
51+
"thread": "thread2"
52+
},
53+
{
54+
"name": "waitForEvent",
55+
"event": "ConnectionReady",
56+
"count": 2
57+
}
58+
],
59+
"events": [
60+
{
61+
"type": "ConnectionCreated"
62+
},
63+
{
64+
"type": "ConnectionReady"
65+
},
66+
{
67+
"type": "ConnectionCreated"
68+
},
69+
{
70+
"type": "ConnectionReady"
71+
}
72+
],
73+
"ignore": [
74+
"ConnectionCheckOutStarted",
75+
"ConnectionCheckedIn",
76+
"ConnectionCheckedOut",
77+
"ConnectionClosed",
78+
"ConnectionPoolCreated",
79+
"ConnectionPoolReady"
80+
]
81+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: 1
2+
style: integration
3+
description: custom maxConnecting is enforced
4+
runOn:
5+
-
6+
minServerVersion: "4.4.0"
7+
failPoint:
8+
configureFailPoint: failCommand
9+
mode: "alwaysOn"
10+
data:
11+
failCommands: ["isMaster","hello"]
12+
closeConnection: false
13+
blockConnection: true
14+
blockTimeMS: 500
15+
poolOptions:
16+
maxConnecting: 1
17+
# gives opportunity for the checkout in thread2 to establish a new connection, which it must not do until thread1 establishes one
18+
maxPoolSize: 2
19+
waitQueueTimeoutMS: 5000
20+
operations:
21+
- name: ready
22+
# thread1 exists to consume the single permit to open a connection,
23+
# so that thread2 would be blocked acquiring a permit, which results in ordering its ConnectionCreated event after
24+
# the ConnectionReady event from thread1.
25+
- name: start
26+
target: thread1
27+
- name: start
28+
target: thread2
29+
- name: checkOut
30+
thread: thread1
31+
- name: waitForEvent
32+
event: ConnectionCreated
33+
count: 1
34+
- name: checkOut
35+
thread: thread2
36+
- name: waitForEvent
37+
event: ConnectionReady
38+
count: 2
39+
events:
40+
- type: ConnectionCreated
41+
- type: ConnectionReady
42+
- type: ConnectionCreated
43+
- type: ConnectionReady
44+
ignore:
45+
- ConnectionCheckOutStarted
46+
- ConnectionCheckedIn
47+
- ConnectionCheckedOut
48+
- ConnectionClosed
49+
- ConnectionPoolCreated
50+
- ConnectionPoolReady
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"version": 1,
3+
"style": "integration",
4+
"description": "maxConnecting is enforced",
5+
"runOn": [
6+
{
7+
"minServerVersion": "4.4.0"
8+
}
9+
],
10+
"failPoint": {
11+
"configureFailPoint": "failCommand",
12+
"mode": {
13+
"times": 50
14+
},
15+
"data": {
16+
"failCommands": [
17+
"isMaster",
18+
"hello"
19+
],
20+
"closeConnection": false,
21+
"blockConnection": true,
22+
"blockTimeMS": 750
23+
}
24+
},
25+
"poolOptions": {
26+
"maxPoolSize": 10,
27+
"waitQueueTimeoutMS": 5000
28+
},
29+
"operations": [
30+
{
31+
"name": "ready"
32+
},
33+
{
34+
"name": "start",
35+
"target": "thread1"
36+
},
37+
{
38+
"name": "start",
39+
"target": "thread2"
40+
},
41+
{
42+
"name": "start",
43+
"target": "thread3"
44+
},
45+
{
46+
"name": "checkOut",
47+
"thread": "thread1"
48+
},
49+
{
50+
"name": "waitForEvent",
51+
"event": "ConnectionCreated",
52+
"count": 1
53+
},
54+
{
55+
"name": "wait",
56+
"ms": 100
57+
},
58+
{
59+
"name": "checkOut",
60+
"thread": "thread2"
61+
},
62+
{
63+
"name": "checkOut",
64+
"thread": "thread3"
65+
},
66+
{
67+
"name": "waitForEvent",
68+
"event": "ConnectionReady",
69+
"count": 3
70+
}
71+
],
72+
"events": [
73+
{
74+
"type": "ConnectionCreated",
75+
"address": 42,
76+
"connectionId": 1
77+
},
78+
{
79+
"type": "ConnectionCreated",
80+
"address": 42
81+
},
82+
{
83+
"type": "ConnectionReady",
84+
"address": 42,
85+
"connectionId": 1
86+
},
87+
{
88+
"type": "ConnectionCreated",
89+
"address": 42
90+
},
91+
{
92+
"type": "ConnectionReady",
93+
"address": 42
94+
},
95+
{
96+
"type": "ConnectionReady",
97+
"address": 42
98+
}
99+
],
100+
"ignore": [
101+
"ConnectionCheckOutStarted",
102+
"ConnectionCheckedIn",
103+
"ConnectionCheckedOut",
104+
"ConnectionClosed",
105+
"ConnectionPoolCreated",
106+
"ConnectionPoolReady"
107+
]
108+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
version: 1
2+
style: integration
3+
description: maxConnecting is enforced
4+
runOn:
5+
-
6+
# required for blockConnection in fail point
7+
minServerVersion: "4.4.0"
8+
failPoint:
9+
configureFailPoint: failCommand
10+
# high amount to ensure not interfered with by monitor checks.
11+
mode: { times: 50 }
12+
data:
13+
failCommands: ["isMaster","hello"]
14+
closeConnection: false
15+
blockConnection: true
16+
blockTimeMS: 750
17+
poolOptions:
18+
maxPoolSize: 10
19+
waitQueueTimeoutMS: 5000
20+
operations:
21+
- name: ready
22+
# start 3 threads
23+
- name: start
24+
target: thread1
25+
- name: start
26+
target: thread2
27+
- name: start
28+
target: thread3
29+
# start creating a Connection. This will take a while
30+
# due to the fail point.
31+
- name: checkOut
32+
thread: thread1
33+
# wait for thread1 to actually start creating a Connection
34+
- name: waitForEvent
35+
event: ConnectionCreated
36+
count: 1
37+
# wait some more time to ensure thread1 has begun establishing a Connection
38+
- name: wait
39+
ms: 100
40+
# start 2 check out requests. Only one thread should
41+
# start creating a Connection and the other one should be
42+
# waiting for pendingConnectionCount to be less than maxConnecting,
43+
# only starting once thread1 finishes creating its Connection.
44+
- name: checkOut
45+
thread: thread2
46+
- name: checkOut
47+
thread: thread3
48+
# wait until all Connections have been created.
49+
- name: waitForEvent
50+
event: ConnectionReady
51+
count: 3
52+
events:
53+
# thread1 creates its connection
54+
- type: ConnectionCreated
55+
address: 42
56+
connectionId: 1
57+
# either thread2 or thread3 creates its connection
58+
# the other thread is stuck waiting for maxConnecting to come down
59+
- type: ConnectionCreated
60+
address: 42
61+
# thread1 finishes establishing its connection, freeing
62+
# up the blocked thread to start establishing
63+
- type: ConnectionReady
64+
address: 42
65+
connectionId: 1
66+
- type: ConnectionCreated
67+
address: 42
68+
# the remaining two Connections finish establishing
69+
- type: ConnectionReady
70+
address: 42
71+
- type: ConnectionReady
72+
address: 42
73+
ignore:
74+
- ConnectionCheckOutStarted
75+
- ConnectionCheckedIn
76+
- ConnectionCheckedOut
77+
- ConnectionClosed
78+
- ConnectionPoolCreated
79+
- ConnectionPoolReady

0 commit comments

Comments
 (0)