Skip to content

Commit 73e78b6

Browse files
committed
update tests
1 parent d228f08 commit 73e78b6

File tree

6 files changed

+371
-143
lines changed

6 files changed

+371
-143
lines changed

test/connection_logging/connection-logging.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,11 @@
539539
"uriOptions": {
540540
"retryReads": true,
541541
"appname": "clientAppName",
542-
"heartbeatFrequencyMS": 10000
542+
"heartbeatFrequencyMS": 5000
543543
},
544+
"observeEvents": [
545+
"serverHeartbeatSucceededEvent"
546+
],
544547
"observeLogMessages": {
545548
"connection": "debug"
546549
}
@@ -556,6 +559,17 @@
556559
]
557560
}
558561
},
562+
{
563+
"name": "waitForEvent",
564+
"object": "testRunner",
565+
"arguments": {
566+
"client": "client",
567+
"event": {
568+
"serverHeartbeatSucceededEvent": {}
569+
},
570+
"count": 1
571+
}
572+
},
559573
{
560574
"name": "failPoint",
561575
"object": "testRunner",
@@ -568,7 +582,8 @@
568582
},
569583
"data": {
570584
"failCommands": [
571-
"saslContinue"
585+
"isMaster",
586+
"hello"
572587
],
573588
"closeConnection": true,
574589
"appName": "clientAppName"
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
{
2+
"description": "heartbeat-failure-clears-backoff-pool",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.4",
7+
"serverless": "forbid",
8+
"topologies": [
9+
"single",
10+
"replicaset",
11+
"sharded"
12+
]
13+
}
14+
],
15+
"createEntities": [
16+
{
17+
"client": {
18+
"id": "setupClient",
19+
"useMultipleMongoses": false
20+
}
21+
}
22+
],
23+
"initialData": [
24+
{
25+
"collectionName": "heartbeat-backoff-error",
26+
"databaseName": "sdam-tests",
27+
"documents": [
28+
{
29+
"_id": 1
30+
},
31+
{
32+
"_id": 2
33+
}
34+
]
35+
}
36+
],
37+
"tests": [
38+
{
39+
"description": "A heartbeat failure during backoff should clear the pool",
40+
"operations": [
41+
{
42+
"name": "createEntities",
43+
"object": "testRunner",
44+
"arguments": {
45+
"entities": [
46+
{
47+
"client": {
48+
"id": "client",
49+
"useMultipleMongoses": false,
50+
"observeEvents": [
51+
"commandStartedEvent",
52+
"poolBackoffEvent",
53+
"poolReadyEvent",
54+
"poolClearedEvent",
55+
"serverHeartbeatFailedEvent",
56+
"serverHeartbeatSucceededEvent"
57+
],
58+
"uriOptions": {
59+
"retryWrites": false,
60+
"heartbeatFrequencyMS": 5000,
61+
"appname": "heartbeatBackoffFailTest"
62+
}
63+
}
64+
},
65+
{
66+
"database": {
67+
"id": "database",
68+
"client": "client",
69+
"databaseName": "sdam-tests"
70+
}
71+
},
72+
{
73+
"collection": {
74+
"id": "collection",
75+
"database": "database",
76+
"collectionName": "heartbeat-backoff-error"
77+
}
78+
}
79+
]
80+
}
81+
},
82+
{
83+
"name": "waitForEvent",
84+
"object": "testRunner",
85+
"arguments": {
86+
"client": "client",
87+
"event": {
88+
"serverHeartbeatSucceededEvent": {}
89+
},
90+
"count": 1
91+
}
92+
},
93+
{
94+
"name": "failPoint",
95+
"object": "testRunner",
96+
"arguments": {
97+
"client": "setupClient",
98+
"failPoint": {
99+
"configureFailPoint": "failCommand",
100+
"mode": "alwaysOn",
101+
"data": {
102+
"failCommands": [
103+
"isMaster",
104+
"hello"
105+
],
106+
"appName": "heartbeatBackoffFailTest",
107+
"closeConnection": true
108+
}
109+
}
110+
}
111+
},
112+
{
113+
"name": "insertMany",
114+
"object": "collection",
115+
"arguments": {
116+
"documents": [
117+
{
118+
"_id": 3
119+
},
120+
{
121+
"_id": 4
122+
}
123+
]
124+
},
125+
"expectError": {
126+
"isError": true
127+
}
128+
},
129+
{
130+
"name": "waitForEvent",
131+
"object": "testRunner",
132+
"arguments": {
133+
"client": "client",
134+
"event": {
135+
"serverHeartbeatFailedEvent": {}
136+
},
137+
"count": 1
138+
}
139+
}
140+
],
141+
"expectEvents": [
142+
{
143+
"client": "client",
144+
"eventType": "cmap",
145+
"events": [
146+
{
147+
"poolReadyEvent": {}
148+
},
149+
{
150+
"poolBackoffEvent": {}
151+
},
152+
{
153+
"poolBackoffEvent": {}
154+
},
155+
{
156+
"poolBackoffEvent": {}
157+
},
158+
{
159+
"poolBackoffEvent": {}
160+
},
161+
{
162+
"poolBackoffEvent": {}
163+
},
164+
{
165+
"poolBackoffEvent": {}
166+
},
167+
{
168+
"poolClearedEvent": {}
169+
}
170+
]
171+
}
172+
]
173+
}
174+
]
175+
}

test/discovery_and_monitoring/unified/backoff-heartbeat-clears-pool.json renamed to test/discovery_and_monitoring/unified/backoff-heartbeat-success.json

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "heartbeat-failure-does-not-clear-backoff-pool",
2+
"description": "heartbeat-success-backoff",
33
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
@@ -22,7 +22,7 @@
2222
],
2323
"initialData": [
2424
{
25-
"collectionName": "heartbeat-backoff-error",
25+
"collectionName": "heartbeat-backoff-success",
2626
"databaseName": "sdam-tests",
2727
"documents": [
2828
{
@@ -36,26 +36,8 @@
3636
],
3737
"tests": [
3838
{
39-
"description": "A heartbeat failure during backoff should not clear the pool",
39+
"description": "A heartbeat success during backoff not mark the pool as ready",
4040
"operations": [
41-
{
42-
"name": "failPoint",
43-
"object": "testRunner",
44-
"arguments": {
45-
"client": "setupClient",
46-
"failPoint": {
47-
"configureFailPoint": "failCommand",
48-
"mode": "alwaysOn",
49-
"data": {
50-
"failCommands": [
51-
"saslContinue"
52-
],
53-
"appName": "heartbeatBackoffFailTest",
54-
"closeConnection": true
55-
}
56-
}
57-
}
58-
},
5941
{
6042
"name": "createEntities",
6143
"object": "testRunner",
@@ -75,6 +57,7 @@
7557
],
7658
"uriOptions": {
7759
"retryWrites": false,
60+
"heartbeatFrequencyMS": 5000,
7861
"appname": "heartbeatBackoffFailTest"
7962
}
8063
}
@@ -90,27 +73,21 @@
9073
"collection": {
9174
"id": "collection",
9275
"database": "database",
93-
"collectionName": "heartbeat-backoff-error"
76+
"collectionName": "heartbeat-backoff-success"
9477
}
9578
}
9679
]
9780
}
9881
},
9982
{
100-
"name": "insertMany",
101-
"object": "collection",
83+
"name": "waitForEvent",
84+
"object": "testRunner",
10285
"arguments": {
103-
"documents": [
104-
{
105-
"_id": 3
106-
},
107-
{
108-
"_id": 4
109-
}
110-
]
111-
},
112-
"expectError": {
113-
"isError": true
86+
"client": "client",
87+
"event": {
88+
"serverHeartbeatSucceededEvent": {}
89+
},
90+
"count": 1
11491
}
11592
},
11693
{
@@ -133,14 +110,20 @@
133110
}
134111
},
135112
{
136-
"name": "waitForEvent",
137-
"object": "testRunner",
113+
"name": "insertMany",
114+
"object": "collection",
138115
"arguments": {
139-
"client": "client",
140-
"event": {
141-
"serverHeartbeatFailedEvent": {}
142-
},
143-
"count": 1
116+
"documents": [
117+
{
118+
"_id": 3
119+
},
120+
{
121+
"_id": 4
122+
}
123+
]
124+
},
125+
"expectError": {
126+
"isError": true
144127
}
145128
},
146129
{

0 commit comments

Comments
 (0)