Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import spock.lang.Unroll

import static com.mongodb.ClusterFixture.getBinding
import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet
import static com.mongodb.ClusterFixture.serverVersionAtLeast

class DropIndexOperationSpecification extends OperationFunctionalSpecification {

Expand All @@ -45,6 +46,7 @@ class DropIndexOperationSpecification extends OperationFunctionalSpecification {
async << [true, false]
}

@IgnoreIf({ serverVersionAtLeast(8, 3) })
def 'should error when dropping non-existent index on existing collection'() {
given:
getCollectionHelper().insertDocuments(new DocumentCodec(), new Document('documentThat', 'forces creation of the Collection'))
Expand Down
6 changes: 3 additions & 3 deletions driver-legacy/src/main/com/mongodb/DBCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ public OperationExecutor getExecutor() {
* key name and type must be specified.
*
* @param index the specification of the index to drop
* @throws MongoException if the index does not exist
* @throws MongoException if the index does not exist and the server version is less than 8.3
* @mongodb.driver.manual core/indexes/ Indexes
*/
public void dropIndex(final DBObject index) {
Expand All @@ -1906,7 +1906,7 @@ public void dropIndex(final DBObject index) {
* Drops the index with the given name from this collection.
*
* @param indexName name of index to drop
* @throws MongoException if the index does not exist
* @throws MongoException if the index does not exist and the server version is less than 8.3
* @mongodb.driver.manual core/indexes/ Indexes
*/
public void dropIndex(final String indexName) {
Expand All @@ -1930,7 +1930,7 @@ public void dropIndexes() {
* Drops the index with the given name from this collection. This method is exactly the same as {@code dropIndex(indexName)}.
*
* @param indexName name of index to drop
* @throws MongoException if the index does not exist
* @throws MongoException if the index does not exist and the server version is less than 8.3
* @mongodb.driver.manual core/indexes/ Indexes
*/
public void dropIndexes(final String indexName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import spock.lang.IgnoreIf
import spock.lang.Unroll

import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet
import static com.mongodb.ClusterFixture.serverVersionAtLeast
import static org.hamcrest.Matchers.contains
import static org.hamcrest.Matchers.containsInAnyOrder
import static spock.util.matcher.HamcrestSupport.that
Expand Down Expand Up @@ -163,6 +164,7 @@ class DBCollectionFunctionalSpecification extends FunctionalSpecification {
collection.dropIndex('indexOnCollectionThatDoesNotExist')
}

@IgnoreIf({ serverVersionAtLeast(8, 3) })
def 'drop index should error if index does not exist'() {
given:
collection.createIndex(new BasicDBObject('x', 1))
Expand All @@ -175,6 +177,7 @@ class DBCollectionFunctionalSpecification extends FunctionalSpecification {
exception.getErrorMessage().contains('index not found')
}

@IgnoreIf({ serverVersionAtLeast(8, 3) })
def 'should throw Exception if dropping an index with an incorrect type'() {
given:
BasicDBObject index = new BasicDBObject('x', 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,98 @@ public static void applyCustomizations(final TestDef def) {
.test("client-side-operations-timeout", "WaitQueueTimeoutError does not clear the pool",
"WaitQueueTimeoutError does not clear the pool");

def.skipJira("https://jira.mongodb.org/browse/JAVA-5491")
.testContains("client-side-operations-timeout", "dropIndex")
.when(() -> !serverVersionLessThan(8, 3))
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an upcoming PR that updates these tests? It seems the only change is that the server returns ok:1 since 8.3. It's unfortunate to disable all these checks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah theres a drivers ticket related to this to fix / change the tests themselves.

"socketTimeoutMS is ignored if timeoutMS is set - dropIndex on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"wTimeoutMS is ignored if timeoutMS is set - dropIndex on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"maxTimeMS is ignored if timeoutMS is set - dropIndex on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"socketTimeoutMS is ignored if timeoutMS is set - dropIndexes on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"wTimeoutMS is ignored if timeoutMS is set - dropIndexes on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"maxTimeMS is ignored if timeoutMS is set - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be configured on a MongoDatabase - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be set to 0 on a MongoDatabase - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be configured on a MongoDatabase - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be set to 0 on a MongoDatabase - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be configured on a MongoCollection - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be set to 0 on a MongoCollection - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be configured on a MongoCollection - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be set to 0 on a MongoCollection - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be configured for an operation - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be set to 0 for an operation - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be configured for an operation - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be set to 0 for an operation - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be configured on a MongoClient - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be set to 0 on a MongoClient - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be configured on a MongoClient - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be set to 0 on a MongoClient - dropIndexes on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"socketTimeoutMS is ignored if timeoutMS is set - dropIndex on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"wTimeoutMS is ignored if timeoutMS is set - dropIndex on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"maxTimeMS is ignored if timeoutMS is set - dropIndex on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"socketTimeoutMS is ignored if timeoutMS is set - dropIndexes on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"wTimeoutMS is ignored if timeoutMS is set - dropIndexes on collection")
.test("client-side-operations-timeout", "operations ignore deprecated timeout options if timeoutMS is set",
"maxTimeMS is ignored if timeoutMS is set - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be configured on a MongoDatabase - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be set to 0 on a MongoDatabase - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be configured on a MongoDatabase - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoDatabase",
"timeoutMS can be set to 0 on a MongoDatabase - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be configured on a MongoCollection - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be set to 0 on a MongoCollection - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be configured on a MongoCollection - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for a MongoCollection",
"timeoutMS can be set to 0 on a MongoCollection - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be configured for an operation - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be set to 0 for an operation - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be configured for an operation - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be overridden for an operation",
"timeoutMS can be set to 0 for an operation - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be configured on a MongoClient - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be set to 0 on a MongoClient - dropIndex on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be configured on a MongoClient - dropIndexes on collection")
.test("client-side-operations-timeout", "timeoutMS can be configured on a MongoClient",
"timeoutMS can be set to 0 on a MongoClient - dropIndexes on collection");

// TODO-JAVA-5712

// collection-management
Expand Down