Skip to content

Commit 7aa4c8d

Browse files
committed
JAVA-2859: Remove extra server session pool
Now that the extra server session pool is gone, it exposed an error in a ClientSession test which creates two client sessions in a Spock where clause. Since both sessions are created by Spock in advance of the test executions, it means that the cleanup check for in-use sessions triggers after the first test execution completes and asserts that there is one in-use session.
1 parent 94acda5 commit 7aa4c8d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

driver-legacy/src/test/functional/com/mongodb/MongoClientSessionSpecification.groovy

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package com.mongodb
1818

1919
import category.Slow
20-
import com.mongodb.internal.connection.TestCommandListener
2120
import com.mongodb.event.CommandStartedEvent
21+
import com.mongodb.internal.connection.TestCommandListener
2222
import org.bson.BsonBinarySubType
2323
import org.bson.BsonDocument
2424
import org.bson.BsonInt32
@@ -36,8 +36,8 @@ import static com.mongodb.ClusterFixture.isAuthenticated
3636
import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet
3737
import static com.mongodb.ClusterFixture.isStandalone
3838
import static com.mongodb.ClusterFixture.serverVersionAtLeast
39-
import static com.mongodb.MongoCredential.createCredential
4039
import static com.mongodb.Fixture.getMongoClient
40+
import static com.mongodb.MongoCredential.createCredential
4141

4242
class MongoClientSessionSpecification extends FunctionalSpecification {
4343

@@ -66,6 +66,9 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
6666

6767
@IgnoreIf({ !serverVersionAtLeast(3, 6) || isStandalone() })
6868
def 'should create session with correct defaults'() {
69+
given:
70+
def clientSession = getMongoClient().startSession()
71+
6972
expect:
7073
clientSession.getOriginator() == getMongoClient()
7174
clientSession.isCausallyConsistent()
@@ -82,10 +85,6 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
8285

8386
cleanup:
8487
clientSession?.close()
85-
86-
where:
87-
clientSession << [getMongoClient().startSession(),
88-
getMongoClient().startSession(ClientSessionOptions.builder().build())]
8988
}
9089

9190
@IgnoreIf({ !serverVersionAtLeast(3, 7) || isStandalone() })

0 commit comments

Comments
 (0)