Skip to content

CSHARP-5373: Add test that PoolClearedEvent is emitted before ConnectionCheckedInEvent/ConnectionCheckOutFailedEvent #1738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"description": "pool-clear-application-error",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "4.4",
"serverless": "forbid",
"topologies": [
"single",
"replicaset",
"sharded"
]
}
],
"createEntities": [
{
"client": {
"id": "setupClient",
"useMultipleMongoses": false
}
}
],
"initialData": [
{
"collectionName": "find-network-error",
"databaseName": "sdam-tests",
"documents": [
{
"_id": 1
},
{
"_id": 2
}
]
}
],
"tests": [
{
"description": "Pool is cleared before application connection is checked into the pool",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "setupClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"find"
],
"closeConnection": true,
"appName": "findNetworkErrorTest"
}
}
}
},
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"useMultipleMongoses": false,
"observeEvents": [
"poolClearedEvent",
"connectionCheckedInEvent"
],
"uriOptions": {
"retryWrites": false,
"retryReads": false,
"appname": "findNetworkErrorTest"
}
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "sdam-tests"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "find-network-error"
}
}
]
}
},
{
"name": "find",
"object": "collection",
"arguments": {
"filter": {
"_id": 1
}
},
"expectError": {
"isError": true
}
},
{
"name": "waitForEvent",
"object": "testRunner",
"arguments": {
"client": "client",
"event": {
"poolClearedEvent": {}
},
"count": 1
}
},
{
"name": "waitForEvent",
"object": "testRunner",
"arguments": {
"client": "client",
"event": {
"connectionCheckedInEvent": {}
},
"count": 1
}
}
],
"expectEvents": [
{
"client": "client",
"eventType": "cmap",
"events": [
{
"poolClearedEvent": {}
},
{
"connectionCheckedInEvent": {}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
description: pool-clear-application-error

schemaVersion: "1.4"

runOnRequirements:
# failCommand appName requirements
- minServerVersion: "4.4"
serverless: forbid
topologies: [ single, replicaset, sharded ]

createEntities:
- client:
id: &setupClient setupClient
useMultipleMongoses: false

initialData: &initialData
- collectionName: &collectionName find-network-error
databaseName: &databaseName sdam-tests
documents:
- _id: 1
- _id: 2

tests:
- description: Pool is cleared before application connection is checked into the pool
operations:
- name: failPoint
object: testRunner
arguments:
client: *setupClient
failPoint:
configureFailPoint: failCommand
mode:
times: 1
data:
failCommands:
- find
closeConnection: true
appName: findNetworkErrorTest
- name: createEntities
object: testRunner
arguments:
entities:
- client:
id: &client client
useMultipleMongoses: false
observeEvents:
- poolClearedEvent
- connectionCheckedInEvent
uriOptions:
retryWrites: false
retryReads: false
appname: findNetworkErrorTest
- database:
id: &database database
client: *client
databaseName: *databaseName
- collection:
id: &collection collection
database: *database
collectionName: *collectionName
- name: find
object: *collection
arguments:
filter:
_id: 1
expectError:
isError: true
- name: waitForEvent
object: testRunner
arguments:
client: *client
event:
poolClearedEvent: {}
count: 1
- name: waitForEvent
object: testRunner
arguments:
client: *client
event:
connectionCheckedInEvent: {}
count: 1
expectEvents:
- client: *client
eventType: cmap
events:
- poolClearedEvent: {}
- connectionCheckedInEvent: {}
Loading
Loading