Skip to content
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

Switch order of test_Connection_checkout_fails_due_to_error_establish… #1523

Merged
Merged
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
4 changes: 2 additions & 2 deletions pymongo/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class _ConnectionStatusMessage(str, enum.Enum):
ConnectionClosedReason.POOL_CLOSED: "Connection pool was closed",
ConnectionCheckOutFailedReason.POOL_CLOSED: "Connection pool was closed",
ConnectionClosedReason.STALE: "Connection pool was stale",
ConnectionClosedReason.ERROR: "Connection experienced an error",
ConnectionCheckOutFailedReason.CONN_ERROR: "Connection experienced an error",
ConnectionClosedReason.ERROR: "An error occurred while using the connection",
ConnectionCheckOutFailedReason.CONN_ERROR: "An error occurred while trying to establish a new connection",
ConnectionClosedReason.IDLE: "Connection was idle too long",
ConnectionCheckOutFailedReason.TIMEOUT: "Connection exceeded the specified timeout",
}
Expand Down
3 changes: 2 additions & 1 deletion pymongo/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ def close_conn(self, reason: Optional[str]) -> None:
serverPort=self.address[1],
driverConnectionId=self.id,
reason=_verbose_connection_error_reason(reason),
error=reason,
)

def _close_conn(self) -> None:
Expand Down Expand Up @@ -1981,7 +1982,7 @@ def checkin(self, conn: Connection) -> None:
serverHost=self.address[0],
serverPort=self.address[1],
driverConnectionId=conn.id,
reason="An error occurred while using the connection",
reason=_verbose_connection_error_reason(ConnectionClosedReason.ERROR),
error=ConnectionClosedReason.ERROR,
)
else:
Expand Down
28 changes: 14 additions & 14 deletions test/connection_logging/connection-logging.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,13 @@
"level": "debug",
"component": "connection",
"data": {
"message": "Connection pool cleared",
"message": "Connection closed",
"driverConnectionId": {
"$$type": [
"int",
"long"
]
},
"serverHost": {
"$$type": "string"
},
Expand All @@ -438,20 +444,18 @@
"int",
"long"
]
},
"reason": "An error occurred while using the connection",
"error": {
"$$exists": true
}
}
},
{
"level": "debug",
"component": "connection",
"data": {
"message": "Connection closed",
"driverConnectionId": {
"$$type": [
"int",
"long"
]
},
"message": "Connection checkout failed",
"serverHost": {
"$$type": "string"
},
Expand All @@ -461,7 +465,7 @@
"long"
]
},
"reason": "An error occurred while using the connection",
"reason": "An error occurred while trying to establish a new connection",
"error": {
"$$exists": true
}
Expand All @@ -471,7 +475,7 @@
"level": "debug",
"component": "connection",
"data": {
"message": "Connection checkout failed",
"message": "Connection pool cleared",
"serverHost": {
"$$type": "string"
},
Expand All @@ -480,10 +484,6 @@
"int",
"long"
]
},
"reason": "An error occurred while trying to establish a new connection",
"error": {
"$$exists": true
}
}
}
Expand Down
Loading