-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Added logging specification tests #1740
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
base: main
Are you sure you want to change the base?
Conversation
JAVA-4770
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes skip markers for several logging tests and updates logging-related code to support the new logging specification tests. Key changes include:
- Enabling logging specification tests by removing skip instructions for JAVA-4770.
- Updating test methods to include new ignoreMessages parameters.
- Refactoring logging routines in core connection components to use StructuredLogger.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTestModifications.java | Removed skip markers for logging tests. |
driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTest.java | Added parameter to pass ignoreMessages to log message assertion. |
driver-sync/src/test/functional/com/mongodb/client/unified/LogMatcher.java | Updated log filtering and renaming helper methods. |
driver-sync/src/test/functional/com/mongodb/client/unified/ContextElement.java | Updated mapping to utilize the new log document conversion method. |
driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedServerDiscoveryAndMonitoringTest.java | Minor formatting update. |
driver-core/src/main/com/mongodb/internal/logging/LogMessage.java | Added a new log entry type AWAITED. |
driver-core/src/main/com/mongodb/internal/connection/SingleServerCluster.java | Modified the order of setting the server instance relative to publishing a description. |
driver-core/src/main/com/mongodb/internal/connection/LoadBalancedCluster.java | Replaced topology closed logging with topology monitoring stopping. |
driver-core/src/main/com/mongodb/internal/connection/DefaultServerMonitor.java | Added structured logging methods for heartbeat events and monitoring lifecycle. |
driver-core/src/main/com/mongodb/internal/connection/DefaultServer.java | Introduced StructuredLogger for connection logging. |
driver-core/src/main/com/mongodb/internal/connection/BaseCluster.java | Updated logging method names to align with the new structured logging pattern. |
Comments suppressed due to low confidence (1)
driver-core/src/main/com/mongodb/internal/connection/SingleServerCluster.java:63
- Reordering the call to server.set so that it occurs after publishDescription may impact the initialization flow. Please verify that this change is intentional and does not introduce any race conditions.
server.set(createServer(settings.getHosts().get(0)));
@@ -58,9 +58,9 @@ public SingleServerCluster(final ClusterId clusterId, final ClusterSettings sett | |||
// synchronized in the constructor because the change listener is re-entrant to this instance. | |||
// In other words, we are leaking a reference to "this" from the constructor. | |||
withLock(() -> { | |||
server.set(createServer(settings.getHosts().get(0))); | |||
publishDescription(ServerDescription.builder().state(CONNECTING).address(settings.getHosts().get(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests expect the toplogy description changed to connecting & unknown to be logged before the starting the server monitor log message.
Creating the server first meant that they were the wrong way around.
JAVA-4770