Skip to content

Commit 5e452e1

Browse files
christophstroblmp911de
authored andcommitted
DATAMONGO-2305 - Upgrade to MongoDB Java Driver 3.11.0-beta4.
Tested against 4.0.9 and 4.2.0-rc1 servers. Added a delay and left a todo in one of the tests where the 4.2.0-rc1 server takes a bit longer than it predecessor when creating indexes which can lead to BackgroundOperationInProgressForNamespace errors. Original pull request: #764.
1 parent 8ce8a83 commit 5e452e1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<project.type>multi</project.type>
2828
<dist.id>spring-data-mongodb</dist.id>
2929
<springdata.commons>2.2.0.BUILD-SNAPSHOT</springdata.commons>
30-
<mongo>3.11.0-beta3</mongo>
30+
<mongo>3.11.0-beta4</mongo>
3131
<mongo.reactivestreams>1.11.0</mongo.reactivestreams>
3232
<jmh.version>1.19</jmh.version>
3333
</properties>

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateIndexTests.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import reactor.core.publisher.Flux;
2323
import reactor.test.StepVerifier;
2424

25+
import java.time.Duration;
2526
import java.util.concurrent.BlockingQueue;
2627
import java.util.concurrent.LinkedBlockingQueue;
2728
import java.util.concurrent.TimeUnit;
@@ -41,13 +42,13 @@
4142
import org.springframework.data.mongodb.core.index.IndexField;
4243
import org.springframework.data.mongodb.core.index.IndexInfo;
4344
import org.springframework.data.mongodb.core.index.Indexed;
45+
import org.springframework.data.mongodb.test.util.MongoTestUtils;
4446
import org.springframework.test.context.ContextConfiguration;
4547
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
4648

4749
import com.mongodb.client.model.IndexOptions;
4850
import com.mongodb.reactivestreams.client.ListIndexesPublisher;
4951
import com.mongodb.reactivestreams.client.MongoClient;
50-
import com.mongodb.reactivestreams.client.Success;
5152

5253
/**
5354
* Integration test for index creation via {@link ReactiveMongoTemplate}.
@@ -68,9 +69,9 @@ public class ReactiveMongoTemplateIndexTests {
6869
@Before
6970
public void setUp() {
7071

71-
StepVerifier.create(template.getCollection("person").drop()).expectNext(Success.SUCCESS).verifyComplete();
72-
StepVerifier.create(template.getCollection("indexfail").drop()).expectNext(Success.SUCCESS).verifyComplete();
73-
StepVerifier.create(template.getCollection("indexedSample").drop()).expectNext(Success.SUCCESS).verifyComplete();
72+
MongoTestUtils.dropCollectionNow(template.getMongoDatabase().getName(), "person", client);
73+
MongoTestUtils.dropCollectionNow(template.getMongoDatabase().getName(), "indexfail", client);
74+
MongoTestUtils.dropCollectionNow(template.getMongoDatabase().getName(), "indexedSample", client);
7475
}
7576

7677
@After
@@ -199,6 +200,7 @@ public void shouldCreateIndexOnAccess() {
199200
.verifyComplete();
200201

201202
template.findAll(IndexedSample.class) //
203+
.delayElements(Duration.ofMillis(200)) // TODO: check if 4.2.0 server GA still requires this timeout
202204
.as(StepVerifier::create) //
203205
.verifyComplete();
204206

0 commit comments

Comments
 (0)