Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

rozza
Copy link
Member

@rozza rozza commented Jun 16, 2025

@rozza rozza requested a review from Copilot June 16, 2025 13:33
Copilot

This comment was marked as resolved.

@rozza rozza requested a review from Copilot June 16, 2025 13:44
Copy link

@Copilot Copilot AI left a 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))
Copy link
Member Author

@rozza rozza Jun 16, 2025

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.

@rozza rozza requested review from a team and katcharov and removed request for a team June 16, 2025 15:56
@rozza rozza marked this pull request as ready for review June 17, 2025 13:45
@rozza rozza requested a review from a team as a code owner June 17, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant