-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Simplify test assumptions for 4.2 minimum server support #1712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9871a01
to
a69b55e
Compare
a69b55e
to
d62c954
Compare
@@ -340,13 +333,13 @@ class AggregateOperationSpecification extends OperationFunctionalSpecification { | |||
BsonDocument explainPlan = execute(operation.asExplainableOperation(QUERY_PLANNER, new BsonDocumentCodec()), async) | |||
|
|||
then: | |||
getKeyPattern(explainPlan.getArray('stages').get(0).asDocument().getDocument('$cursor')) == index | |||
getKeyPattern(explainPlan) == index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change allows the test to pass on 4.2+ so long as it's not sharded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies test assumptions in preparation for a 4.2+ minimum server support by removing outdated server version checks and dead conditionals in the test suite. Key changes include eliminating skip conditions that reference obsolete server versions, simplifying branching logic in test assertions, and streamlining test annotations.
Reviewed Changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
driver-core/src/test/functional/com/mongodb/internal/operation/FindOperationSpecification.groovy | Removed outdated server version based skip for hint tests. |
driver-core/src/test/functional/com/mongodb/internal/operation/FindAndUpdateOperationSpecification.groovy | Simplified skip conditions by removing server version checks that are now redundant. |
driver-core/src/test/functional/com/mongodb/internal/operation/FindAndReplaceOperationSpecification.groovy | Removed conditions that are no longer relevant with new server support assumptions. |
driver-core/src/test/functional/com/mongodb/internal/operation/FindAndDeleteOperationSpecification.groovy | Streamlined skip conditions to only check replica set availability. |
driver-core/src/test/functional/com/mongodb/internal/operation/DropDatabaseOperationSpecification.groovy | Removed legacy server version logic in write concern error tests. |
driver-core/src/test/functional/com/mongodb/internal/operation/DropCollectionOperationSpecification.groovy | Updated skip conditions for write concern error tests by only checking server replica set status. |
driver-core/src/test/functional/com/mongodb/internal/operation/DistinctOperationSpecification.groovy | Removed skip conditions for collation tests no longer relevant under minimum criteria. |
driver-core/src/test/functional/com/mongodb/internal/operation/CreateViewOperationSpecification.groovy | Removed tests based solely on outdated server version checks. |
driver-core/src/test/functional/com/mongodb/internal/operation/CreateIndexesOperationSpecification.groovy | Removed legacy conditions and simplified index creation tests. |
driver-core/src/test/functional/com/mongodb/internal/operation/CreateCollectionOperationSpecification.groovy | Streamlined storage engine options tests by removing redundant conditionals. |
driver-core/src/test/functional/com/mongodb/internal/operation/CountDocumentsOperationSpecification.groovy | Removed conditional assumptions tied to outdated server versions. |
driver-core/src/test/functional/com/mongodb/internal/operation/ChangeStreamOperationSpecification.groovy | Removed skip conditions now rendered obsolete by the new server support level. |
driver-core/src/test/functional/com/mongodb/internal/operation/ChangeStreamOperationProseTestSpecification.groovy | Simplified skip conditions to only verify replica set availability. |
driver-core/src/test/functional/com/mongodb/internal/operation/AggregateToCollectionOperationSpecification.groovy | Removed several skip conditions related to server versions lower than minimum support. |
driver-core/src/test/functional/com/mongodb/internal/operation/AggregateOperationSpecification.groovy | Simplified aggregation tests by removing legacy server version requirements. |
driver-core/src/test/functional/com/mongodb/internal/connection/ScramSha256AuthenticationSpecification.groovy | Updated authentication tests by removing obsolete version checks. |
driver-core/src/test/functional/com/mongodb/client/model/mql/TypeMqlValuesFunctionalTest.java | Removed conditional assumptions based on server version for mql value tests. |
driver-core/src/test/functional/com/mongodb/client/model/FiltersFunctionalSpecification.groovy | Removed outdated version-based skip annotations for filter rendering tests. |
driver-core/src/test/functional/com/mongodb/client/model/AggregatesFunctionalSpecification.groovy | Removed multiple skip conditions to reflect the new minimum supported server version. |
Comments suppressed due to low confidence (2)
driver-core/src/test/functional/com/mongodb/internal/operation/DropDatabaseOperationSpecification.groovy:72
- The conditional assignment based on server version was removed in favor of a constant value of 2. Please confirm that using a fixed write concern value meets the intended test assumptions for all supported server versions.
def w = 2
driver-core/src/test/functional/com/mongodb/internal/connection/ScramSha256AuthenticationSpecification.groovy:45
- The removal of the server version check simplifies the annotation given the new minimum support, but please verify that this change does not inadvertently enable tests on unsupported server versions.
@IgnoreIf({ (!isAuthenticated()) })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just undelete the two tests I commented and only change their corresponding IgnoreIf statements
...functional/com/mongodb/internal/operation/AggregateToCollectionOperationSpecification.groovy
Show resolved
Hide resolved
...functional/com/mongodb/internal/operation/AggregateToCollectionOperationSpecification.groovy
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR cleans up test code by removing obsolete server version checks and related skips now that MongoDB 4.2 is the minimum supported server, and by deleting dead conditionals and unused imports.
- Removed
serverVersionLessThan
/serverVersionAtLeast
imports and always‐false skips - Simplified
@IgnoreIf
annotations to only check clustering conditions - Deleted stale test methods and comments tied to removed version logic
Reviewed Changes
Copilot reviewed 76 out of 76 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
FindAndReplaceOperationSpecification.groovy | Removed import and dead @IgnoreIf checks for older server versions |
FindAndDeleteOperationSpecification.groovy | Simplified ignore conditions, dropped obsolete version import |
DropIndexOperationSpecification.groovy | Removed legacy version skip and import |
DropDatabaseOperationSpecification.groovy | Simplified ignore, removed version imports and updated dead fallback logic |
DropCollectionOperationSpecification.groovy | Deleted version checks and import |
DistinctOperationSpecification.groovy | Removed version‐based skip and import |
CreateViewOperationSpecification.groovy | Deleted outdated view‐version test and imports |
CreateIndexesOperationSpecification.groovy | Stripped obsolete version skips throughout |
CreateCollectionOperationSpecification.groovy | Removed old‐version skip and import |
CountDocumentsOperationSpecification.groovy | Cleaned out version hints and imports |
ChangeStreamOperationSpecification.groovy | Simplified class‐level skip, removed unused version import |
ChangeStreamOperationProseTestSpecification.groovy | Updated skip logic and removed version imports |
AggregateToCollectionOperationSpecification.groovy | Dropped outdated version checks and imports |
AggregateOperationSpecification.groovy | Removed version‐based skips and updated imports |
ScramSha256AuthenticationSpecification.groovy | Cleaned up version skip annotation and import |
TypeMqlValuesFunctionalTest.java | Deleted JUnit assumeTrue for removed version guard |
ArithmeticMqlValuesFunctionalTest.java | Removed leftover version assumption calls |
FiltersFunctionalSpecification.groovy | Stripped version‐based ignores and import |
AggregatesTest.java | Deleted version assumptions around window fields |
AggregatesFunctionalSpecification.groovy | Removed numerous obsolete @IgnoreIf blocks |
Comments suppressed due to low confidence (4)
driver-core/src/test/functional/com/mongodb/internal/operation/DropDatabaseOperationSpecification.groovy:31
- This static import is no longer used after removing server version checks; please remove it to keep imports tidy.
import static com.mongodb.ClusterFixture.isSharded
driver-core/src/test/functional/com/mongodb/internal/operation/DropDatabaseOperationSpecification.groovy:71
- The comment refers to removed version logic and no longer matches the code; please update or delete this stale comment to reflect the current behavior.
// On servers older than 4.0 that don't support this failpoint, use a crazy w value instead
driver-core/src/test/functional/com/mongodb/internal/operation/CreateCollectionOperationSpecification.groovy:33
- After deleting all version‐based conditionals, this import is unused; please remove it.
import static com.mongodb.ClusterFixture.serverVersionLessThan
driver-core/src/test/functional/com/mongodb/internal/operation/ChangeStreamOperationSpecification.groovy:59
- This import is no longer needed now that all serverVersion-based skips have been removed; please delete it.
import static com.mongodb.ClusterFixture.serverVersionLessThan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Only nits: I added a suggestion to remove outdated comments
driver-legacy/src/test/functional/com/mongodb/DBFunctionalSpecification.groovy
Outdated
Show resolved
Hide resolved
...src/test/functional/com/mongodb/internal/operation/DropDatabaseOperationSpecification.groovy
Outdated
Show resolved
Hide resolved
Co-authored-by: Ross Lawley <ross.lawley@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.