|
16 | 16 |
|
17 | 17 | package com.mongodb.reactivestreams.client.unified;
|
18 | 18 |
|
19 |
| -import com.mongodb.lang.Nullable; |
20 |
| -import org.bson.BsonArray; |
21 |
| -import org.bson.BsonDocument; |
22 |
| -import org.junit.jupiter.api.AfterEach; |
23 |
| -import org.junit.jupiter.api.BeforeEach; |
24 | 19 | import org.junit.jupiter.params.provider.Arguments;
|
25 | 20 |
|
26 | 21 | import java.io.IOException;
|
27 | 22 | import java.net.URISyntaxException;
|
28 |
| -import java.util.Arrays; |
29 | 23 | import java.util.Collection;
|
30 |
| -import java.util.List; |
31 |
| - |
32 |
| -import static com.mongodb.reactivestreams.client.syncadapter.SyncMongoClient.disableSleep; |
33 |
| -import static com.mongodb.reactivestreams.client.syncadapter.SyncMongoClient.enableSleepAfterCursorClose; |
34 |
| -import static com.mongodb.reactivestreams.client.syncadapter.SyncMongoClient.enableSleepAfterCursorOpen; |
35 |
| -import static org.junit.jupiter.api.Assumptions.assumeFalse; |
36 | 24 |
|
37 | 25 | final class LoadBalancerTest extends UnifiedReactiveStreamsTest {
|
38 |
| - |
39 |
| - private static final List<String> CURSOR_OPEN_TIMING_SENSITIVE_TESTS = |
40 |
| - Arrays.asList( |
41 |
| - "pinned connections are returned when the cursor is drained", |
42 |
| - "only connections for a specific serviceId are closed when pools are cleared", |
43 |
| - "pinned connections are returned to the pool when the cursor is closed", |
44 |
| - "no connection is pinned if all documents are returned in the initial batch", |
45 |
| - "stale errors are ignored", |
46 |
| - "a connection can be shared by a transaction and a cursor", |
47 |
| - "wait queue timeout errors include cursor statistics"); |
48 |
| - |
49 |
| - private static final List<String> CURSOR_CLOSE_TIMING_SENSITIVE_TESTS = |
50 |
| - Arrays.asList( |
51 |
| - "pinned connections are returned to the pool when the cursor is closed", |
52 |
| - "only connections for a specific serviceId are closed when pools are cleared", |
53 |
| - "pinned connections are returned after a network error during a killCursors request", |
54 |
| - "a connection can be shared by a transaction and a cursor"); |
55 |
| - |
56 |
| - @Override |
57 |
| - protected void skips(final String fileDescription, final String testDescription) { |
58 |
| - // Reactive streams driver can't implement these tests because the underlying cursor is closed on error, which |
59 |
| - // breaks assumption in the tests that closing the cursor is something that happens under user control |
60 |
| - assumeFalse(testDescription.equals("pinned connections are not returned after an network error during getMore")); |
61 |
| - assumeFalse(testDescription.equals("pinned connections are not returned to the pool after a non-network error on getMore")); |
62 |
| - // Reactive streams driver can't implement this test because there is no way to tell that a change stream cursor |
63 |
| - // that has not yet received any results has even initiated the change stream |
64 |
| - assumeFalse(testDescription.equals("change streams pin to a connection")); |
65 |
| - } |
66 |
| - |
67 |
| - @Override |
68 |
| - @BeforeEach |
69 |
| - public void setUp( |
70 |
| - @Nullable final String fileDescription, |
71 |
| - @Nullable final String testDescription, |
72 |
| - final String schemaVersion, |
73 |
| - @Nullable final BsonArray runOnRequirements, |
74 |
| - final BsonArray entitiesArray, |
75 |
| - final BsonArray initialData, |
76 |
| - final BsonDocument definition) { |
77 |
| - super.setUp( |
78 |
| - fileDescription, |
79 |
| - testDescription, |
80 |
| - schemaVersion, |
81 |
| - runOnRequirements, |
82 |
| - entitiesArray, |
83 |
| - initialData, |
84 |
| - definition); |
85 |
| - if (CURSOR_OPEN_TIMING_SENSITIVE_TESTS.contains(testDescription)) { |
86 |
| - enableSleepAfterCursorOpen(256); |
87 |
| - } |
88 |
| - |
89 |
| - if (CURSOR_CLOSE_TIMING_SENSITIVE_TESTS.contains(testDescription)) { |
90 |
| - enableSleepAfterCursorClose(256); |
91 |
| - } |
92 |
| - } |
93 |
| - |
94 |
| - @Override |
95 |
| - @AfterEach |
96 |
| - public void cleanUp() { |
97 |
| - super.cleanUp(); |
98 |
| - disableSleep(); |
99 |
| - } |
100 |
| - |
101 | 26 | private static Collection<Arguments> data() throws URISyntaxException, IOException {
|
102 | 27 | return getTestData("unified-test-format/load-balancers");
|
103 | 28 | }
|
|
0 commit comments