This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch fix/multi-tenant-get-by-id
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/fix/multi-tenant-get-by-id by 
this push:
     new e8d235330a Use the 8.0.x cleanup of SchemaBasedMultiTenancySpec
e8d235330a is described below

commit e8d235330ac0850f5a8c948f064ecfad037810bd
Author: James Daugherty <[email protected]>
AuthorDate: Fri Oct 9 11:38:30 2026 -0400

    Use the 8.0.x cleanup of SchemaBasedMultiTenancySpec
    
    6fe37380ea fixed the same crash on 8.0.x by dropping the two tenant
    databases through the MongoClient. Take its code in place of the
    cleanup from the previous commit, so both branches carry the same lines
    and merge without a conflict.
---
 .../gorm/mongo/connections/SchemaBasedMultiTenancySpec.groovy  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/grails-data-mongodb/core/src/test/groovy/org/grails/datastore/gorm/mongo/connections/SchemaBasedMultiTenancySpec.groovy
 
b/grails-data-mongodb/core/src/test/groovy/org/grails/datastore/gorm/mongo/connections/SchemaBasedMultiTenancySpec.groovy
index a8405c10d6..e4e3c76790 100644
--- 
a/grails-data-mongodb/core/src/test/groovy/org/grails/datastore/gorm/mongo/connections/SchemaBasedMultiTenancySpec.groovy
+++ 
b/grails-data-mongodb/core/src/test/groovy/org/grails/datastore/gorm/mongo/connections/SchemaBasedMultiTenancySpec.groovy
@@ -73,11 +73,13 @@ class SchemaBasedMultiTenancySpec extends 
AutoStartedMongoSpec {
     }
 
     void "Test persist and retrieve entities with multi tenancy"() {
-        setup:"only the databases of these tenants are dropped, as every 
database of the shared server is a tenant, config included"
+        setup: "the tenants this feature uses start empty"
+        // Not eachTenant: in SCHEMA mode every database on the server is a 
tenant, MongoDB's own admin, config
+        // and local included. Dropping config on the shared test server 
removes config.image_collection, and
+        // the next retryable findAndModify - native id generation, in any 
later specification - then aborts
+        // mongod when it recreates that collection inside the write.
         ['test1', 'test2'].each { String tenantId ->
-            CompanyB.withTenant(tenantId) {
-                CompanyB.DB.drop()
-            }
+            datastore.mongoClient.getDatabase(tenantId).drop()
         }
 
         when:"A tenant id is present"

Reply via email to