Skip to content

Added mongodb/specifications as a git submodule #1670

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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

rozza
Copy link
Member

@rozza rozza commented Apr 1, 2025

  • Sets the specifications submodule to last schemaVersion 1.21 commit.
  • Deleted old copied json tests.
  • Updated test runners to use the new submodule locations
  • Added skips for any tests that haven't been implemented

JAVA-5821

@rozza rozza marked this pull request as draft April 1, 2025 16:06
@rozza rozza marked this pull request as ready for review April 2, 2025 08:31
@rozza rozza requested review from a team, stIncMale and katcharov and removed request for a team April 2, 2025 08:32
Set the specifications submodule to last schemaVersion 1.21 commit
Deleted old copied json tests.
Updated test runners to use the new submodule locations
Added skips for any tests that haven't been implemented

JAVA-5821
@@ -68,10 +67,19 @@ public static Collection<Object[]> getTestData(final String resourcePath) {
return data;
}

public static List<BsonDocument> getSpecTestDocuments(final String resourcePath) {
Copy link
Member Author

Choose a reason for hiding this comment

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

New helper to auto include the specifications location prefix.

}
return files;
}

private static BsonDocument getTestDocumentWithMetaData(final String resourcePath) {
JsonReader jsonReader = new JsonReader(resourcePathToString(resourcePath));
BsonDocument testDocument = new BsonDocumentCodec().decode(jsonReader, DecoderContext.builder().build());
BsonDocument testDocument = BsonDocument.parse(resourcePathToString(resourcePath));
Copy link
Member Author

Choose a reason for hiding this comment

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

Simplification of the parsing code.

@@ -72,6 +72,7 @@ protected ClientEncryption createClientEncryption(final ClientEncryptionSettings

@BeforeEach
public void setUp() {
assumeFalse(() -> true); // https://jira.mongodb.org/browse/JAVA-5837
Copy link
Member Author

Choose a reason for hiding this comment

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

This is required as at the schema version 1.21 commit of the specifications repo we doesn't contain have the test files yet

@@ -474,7 +531,7 @@ public TestApplicator testContains(final String dir, final String fragment) {
* @param test the individual test's "description" field
* @return this
*/
public TestApplicator test(final String dir, final String test) {
public TestApplicator debug(final String dir, final String test) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@katcharov I renamed this method as I found it too easy to use thinking it was a matcher.

@jyemin jyemin self-requested a review April 2, 2025 15:01
Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

I looked at some of the tasks on the patch build and found a handful of tests that are passing on the mainline and skipped in the patch. Easiest way I found to locate them is to filter by Status, including only Skip, then sort Base Status no way to filter by Base Status unfortunately) and scroll to ones with Base Status of Passed. As examples, I found these in test-core:

  • com.mongodb.AuthConnectionStringTest.shouldPassAllOutcomes_should_accept_generic_mechanism_property__GSSAPI__
  • com.mongodb.UriOptionsTest.shouldPassAllOutcomes_Valid_auth_options_are_parsed_correctly__GSSAPI__
  • com.mongodb.UriOptionsTest.shouldPassAllOutcomes_tlsAllowInvalidCertificates_is_parsed_correctly_
  • com.mongodb.internal.connection.ConnectionPoolAsyncTest.shouldPassAllOutcomes_pool-create-min-size-error.json__error_during_minPoolSize_population_clears_pool_
  • com.mongodb.internal.connection.ConnectionPoolTest.shouldPassAllOutcomes_pool-create-min-size-error.json__error_during_minPoolSize_population_clears_pool_

and these in kotlkin-tests:

  • com.mongodb.kotlin.client.coroutine.UnifiedCrudTest.find__Find_with_batchSize_equal_to_limit
  • com.mongodb.kotlin.client.coroutine.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_string_comment
  • com.mongodb.kotlin.client.coroutine.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_document_comment
  • com.mongodb.kotlin.client.UnifiedCrudTest.find__Find_with_batchSize_equal_to_limit
  • com.mongodb.kotlin.client.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_string_comment
  • com.mongodb.kotlin.client.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_document_comment

Not sure of the root cause, but seems worth investigating.

Also, responding to:

Sets the specifications submodule to last schemaVersion 1.21 commit

I assume this will have to be updated to the latest commit before this PR is merged, otherwise we will be missing tests updated made in the last few months?

Update with one other thought: now that we are beholden to the directory structure of the specifications repository, there is a greater risk that a restructuring of that repository could cause us to miss an entire test suite (say, if the directory moves). Is there already a check to ensure that every test runner finds at least one test to consider running, and if not, could one be added?

@katcharov katcharov removed the request for review from stIncMale April 2, 2025 16:05
@rozza
Copy link
Member Author

rozza commented Apr 2, 2025

@jyemin thanks for the review:

  • com.mongodb.AuthConnectionStringTest.shouldPassAllOutcomes_should_accept_generic_mechanism_property__GSSAPI__
    skipped due to JAVA-4278. We don't support forward yet. This was different on main.
  • com.mongodb.UriOptionsTest.shouldPassAllOutcomes_Valid_auth_options_are_parsed_correctly__GSSAPI__
    As previous.
  • com.mongodb.UriOptionsTest.shouldPassAllOutcomes_tlsAllowInvalidCertificates_is_parsed_correctly_
    will fix I took the // Skip because Java driver does not support the tlsAllowInvalidCertificates option code comment in UriOptionsTests literally.
  • com.mongodb.internal.connection.ConnectionPoolAsyncTest.shouldPassAllOutcomes_pool-create-min-size-error.json__error_during_minPoolSize_population_clears_pool_
    events in specifications are in a different order. I had added a comment to code: Events out of order - the driver closes connection first then clears the pool
  • com.mongodb.internal.connection.ConnectionPoolTest.shouldPassAllOutcomes_pool-create-min-size-error.json__error_during_minPoolSize_population_clears_pool_
    As previous.

The kotlin tests:

  • com.mongodb.kotlin.client.coroutine.UnifiedCrudTest.find__Find_with_batchSize_equal_to_limit
    Was skipped for all drivers - I will revert I no longer recall why.
  • com.mongodb.kotlin.client.coroutine.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_string_comment
    Driver does not batch replace and updates together - was modified in main.
  • com.mongodb.kotlin.client.coroutine.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_document_comment
    As previous.
  • com.mongodb.kotlin.client.UnifiedCrudTest.find__Find_with_batchSize_equal_to_limit
    See coroutine
  • com.mongodb.kotlin.client.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_string_comment
    See coroutine
  • com.mongodb.kotlin.client.UnifiedCrudTest.bulkWrite-comment__BulkWrite_with_document_comment
    See coroutine

@rozza
Copy link
Member Author

rozza commented Apr 2, 2025

Also, responding to:

Sets the specifications submodule to last schemaVersion 1.21 commit

I assume this will have to be updated to the latest commit before this PR is merged, otherwise we will be missing tests updated made in the last few months?

No the latest commit contains work we haven't done yet but we can go to the last 1.22 commit which will include tests we have added and I've temporarily skipped. Those are all in progress / blocked by this PR. There is a Java ticker to support 1.23 - JAVA-5792

Update with one other thought: now that we are beholden to the directory structure of the specifications repository, there is a greater risk that a restructuring of that repository could cause us to miss an entire test suite (say, if the directory moves). Is there already a check to ensure that every test runner finds at least one test to consider running, and if not, could one be added?

We definitely could miss new tests - but then there should be a drivers ticket along the change to ensure its included. That would be the manual verification step.

For unified tests - we could remove all runners and just include a single runner. That traverses all directories in source/ and gathers all unified spec tests. That would ensure no unified tests were missed.

I will add an assertion to ensure getTestData / getTestDocuments does not return an empty list.

@rozza rozza requested a review from jyemin April 2, 2025 17:43
@jyemin
Copy link
Collaborator

jyemin commented Apr 2, 2025

All sounds good. Please though take a quick look at other tasks, as there are more in driver-sync that are also skipped in this patch but passing in main. I didn't enumerate them all. Probably good reason for all of them but this is the time to check carefully.

@rozza
Copy link
Member Author

rozza commented Apr 3, 2025

@jyemin all skips are expected - either we modified the tests / tests are different in specifications. Or there is a reason for the skip - eg timeoutMS too small.

More tests will be reintroduced in subsequent prs as the schema support is updated.

Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

Looks great, just a couple of questions left.

* The test is occasionally racy. The "killCursors" command may appear as an additional event. This is unexpected in unified tests,
* but anticipated in reactive streams because an operation timeout error triggers the closure of the stream/publisher.
*/
ignoreExtraCommandEvents(testDescription.contains("timeoutMS is refreshed for getMore - failure"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at the comment, I'm not clear why this is being added to the sync test rather than the reactive one. Can you clarify?

Copy link
Member Author

@rozza rozza Apr 23, 2025

Choose a reason for hiding this comment

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

Thank you - that was copy pasta and wasn't the actual test I should have been ignoring extra events for. Have updated. Test failures can be seen here - Search for: com.mongodb.client.ClientSideOperationTimeoutTest.timeoutMS_behaves_correctly_for_tailable_awaitData_cursors__timeoutMS_is_refreshed_for_getMore_if_maxAwaitTimeMS_is_set

assumeFalse(fileName.equals("pool-clear-interrupting-pending-connections.json"));

// Events out of order - the driver closes connection first then clears the pool.
assumeFalse(fileName.equals("pool-create-min-size-error.json"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we track this with a ticket?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that would be a drivers ticket. I'll look to see if there is a ticket already.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the related Java ticket

@rozza rozza requested a review from jyemin April 23, 2025 12:05
@rozza
Copy link
Member Author

rozza commented Apr 23, 2025

@jyemin I think all other test failures are now not related to specifications.

#1684 fixes the majority of the change stream tests due to changes with the latest mongodb.

@jyemin
Copy link
Collaborator

jyemin commented Apr 23, 2025

Looking good! I had a glance at the latest test run and was wondering about ClientEncryptionCustomEndpointTest.testCustomEndpoint_4.__aws__invalid_amazon_region_in_endpoint_, which is failng on both sync and reactice tasks, but passing on mainline. Do you know what's going on with those tests?

@rozza
Copy link
Member Author

rozza commented Apr 23, 2025

@jyemin those tests appear to also be failing in main:
https://spruce.mongodb.com/version/mongo_java_driver_b7cb24a586ddd164de9672ee1741ce3f3f19f732/test-analysis?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

Bailey commented yesterday in dbx-devs - so possibly seen elsewhere as well.

Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants