adutra commented on PR #1916:
URL: 
https://github.com/apache/cassandra-java-driver/pull/1916#issuecomment-2041040707

   > Do you have any suggestions on how we should write the unit test for this?
   
   I don't think you need GC for this, it would be enough to check that the 
metrics were cleared. That is, something like:
   
   ```java
       Object registry = newMetricRegistry();
       try (CqlSession session =
           CqlSession.builder()
               .addContactEndPoints(simulacron().getContactPoints())
               .withConfigLoader(loader)
               .withMetricRegistry(registry)
               .build()) {
   
         session.prepare("irrelevant");
         queryAllNodes(session);
         assertMetricsPresent(session);
       } finally {
         assertMetricsNotPresent(registry);
       }
   ```
   
   The implementation for Micrometer could be:
   
   ```java
     @Override
     protected void assertMetricsNotPresent(Object registry) {
       assertThat(((MeterRegistry) registry).getMeters()).isEmpty();
     }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to