matrei commented on code in PR #15565:
URL: https://github.com/apache/grails-core/pull/15565#discussion_r3058987736


##########
grails-data-mongodb/core/src/test/groovy/org/apache/grails/data/mongo/core/GrailsDataMongoTckManager.groovy:
##########
@@ -136,17 +138,31 @@ class GrailsDataMongoTckManager extends 
GrailsDataTckManager {
 
     @Override
     void destroy() {
-        mongoDatastore.getMongoClient().listDatabaseNames().findAll {!(it in 
['admin', 'config', 'local']) }.each {
+        try {
+            mongoDatastore?.mongoClient?.listDatabaseNames()
+                    ?.findAll { !(it in ['admin', 'config', 'local']) }
+                    ?.each {
+                        try {
+                            mongoDatastore.mongoClient.getDatabase(it as 
String).drop()
+                        }
+                        catch (ignored) {
+                            log.warn("Could not drop ${it}")
+                        }
+                    }
+            for (cls in domainClasses) {
+                GormEnhancer.findValidationApi(cls).validator = null
+            }
+        }
+        finally {
             try {
-                mongoDatastore.getMongoClient().getDatabase(it).drop()
+                mongoDatastore?.close()

Review Comment:
   Yes, it still does the drop.
   But that is on the databases: 
`mongoDatastore.mongoClient.getDatabase(String).drop()`
   The close is on the datastore: `mongoDatastore.close()`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to