From 13601c28722f135331ba78c9b60795bb41a3c671 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 8 Mar 2024 16:28:23 -0500 Subject: [PATCH 1/7] Convert test README from reStructuredText to Markdown --- .../atlas-data-lake-testing/tests/README.md | 66 ++++++++++++++ .../atlas-data-lake-testing/tests/README.rst | 89 ------------------- 2 files changed, 66 insertions(+), 89 deletions(-) create mode 100644 source/atlas-data-lake-testing/tests/README.md delete mode 100644 source/atlas-data-lake-testing/tests/README.rst diff --git a/source/atlas-data-lake-testing/tests/README.md b/source/atlas-data-lake-testing/tests/README.md new file mode 100644 index 0000000000..762550221c --- /dev/null +++ b/source/atlas-data-lake-testing/tests/README.md @@ -0,0 +1,66 @@ +# Atlas Data Lake Tests + +## Introduction + +The YAML and JSON files in this directory are platform-independent tests that drivers can use to assert compatibility +with [Atlas Data Lake](https://www.mongodb.com/docs/datalake/). These tests utilize the +[Unified Test Format](../../unified-test-format/unified-test-format.md). + +Several prose tests, which are not easily expressed in YAML, are also presented in this file. Those tests will need to +be manually implemented by each driver. + +## Test Environment + +Running these integration tests will require a running `mongohoused` with data available in its `test.driverdata` +collection. See the +[ADL directory in drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/atlas_data_lake) +and [10gen/mongohouse README](https://github.com/10gen/mongohouse/blob/master/README.md) for more information. + +The test runner for Atlas Data Lake Testing MUST NOT drop the collection and/or database under test. In contrast +to most other tests, which insert their own data fixtures into an empty collection, the data for these tests is +specified in the `mongohoused` configuration file. + +## Prose Tests + +The following tests MUST be implemented to fully test compatibility with Atlas Data Lake. + +### 1. Support for `killCursors` command + +Test that the driver properly constructs and issues a +[killCursors](https://www.mongodb.com/docs/manual/reference/command/killCursors/) command to Atlas Data Lake. For this +test, configure an APM listener on a client and execute a query on the `test.driverdata` collection that will leave a +cursor open on the server (e.g. specify `batchSize=2` for a query that would match 3+ documents). Drivers MAY iterate +the cursor if necessary to execute the initial `find` command but MUST NOT iterate further to avoid executing a +`getMore`. + +Observe the CommandSucceededEvent event for the `find` command and extract the cursor's ID and namespace from the +response document's `cursor.id` and `cursor.ns` fields, respectively. Destroy the cursor object and observe a +CommandStartedEvent and CommandSucceededEvent for the `killCursors` command. Assert that the cursor ID and target +namespace in the outgoing command match the values from the `find` command's CommandSucceededEvent. When matching the +namespace, note that the `killCursors` field will contain the collection name and the database may be inferred from +either the `$db` field or accessed via the CommandStartedEvent directly. Finally, assert that the `killCursors` +CommandSucceededEvent indicates that the expected cursor was killed in the `cursorsKilled` field. + +Note: this test assumes that drivers only issue a `killCursors` command internally when destroying a cursor that may +still exist on the server. If a driver constructs and issues `killCursors` commands in other ways (e.g. public API), +this test MUST be adapted to test all such code paths. + +### 2. Connect without authentication + +Test that the driver can establish a connection with Atlas Data Lake without authentication. For these tests, create a +MongoClient using a valid connection string without auth credentials and execute a ping command. + +### 3. Connect with authentication + +Test that the driver can establish a connection with Atlas Data Lake with authentication. For these tests, create a +MongoClient using a valid connection string with SCRAM-SHA-1 and credentials from the drivers-evergreen-tools ADL +configuration and execute a ping command. Repeat this test using SCRAM-SHA-256. + +## Changelog + +- 2024-03-08: Convert legacy ADL tests to unified format. Convert test README from reStructuredText to Markdown. + +- 2022-10-05: Add spec front matter + +- 2020-07-15: Link to CRUD test runner implementation and note that the collection under test must not be dropped before + each test. diff --git a/source/atlas-data-lake-testing/tests/README.rst b/source/atlas-data-lake-testing/tests/README.rst deleted file mode 100644 index 2295dc391c..0000000000 --- a/source/atlas-data-lake-testing/tests/README.rst +++ /dev/null @@ -1,89 +0,0 @@ -===================== -Atlas Data Lake Tests -===================== - -:Status: Accepted -:Minimum Server Version: N/A - -.. contents:: - ----- - -Introduction -============ - -The YAML and JSON files in this directory tree are platform-independent tests -that drivers can use to assert compatibility with `Atlas Data Lake `_. - -Running these integration tests will require a running ``mongohoused`` -with data available in its ``test.driverdata`` collection. See the -`ADL directory in drivers-evergreen-tools `_ -and `10gen/mongohouse README `_ -for more information. - -Several prose tests, which are not easily expressed in YAML, are also presented -in this file. Those tests will need to be manually implemented by each driver. - -Test Format -=========== - -The same as the `CRUD Spec Test format <../../crud/tests/README.md#Test-Format>`_. - -Test Runner Implementation -========================== - -The same as the `CRUD Spec Test Runner Implementation <../../crud/tests#test-runner-implementation>`_, -with one notable differences: the test runner for Atlas Data Lake Testing -MUST NOT drop the collection and/or database under test. In contrast to other -CRUD tests, which insert their own data fixtures into an empty collection, data -for these tests is specified in the ``mongohoused`` configuration file. - -Prose Tests -=========== - -The following tests MUST be implemented to fully test compatibility with -Atlas Data Lake. - -#. Test that the driver properly constructs and issues a - `killCursors `_ - command to Atlas Data Lake. For this test, configure an APM listener on a - client and execute a query on the ``test.driverdata`` collection that will - leave a cursor open on the server (e.g. specify ``batchSize=2`` for a query - that would match 3+ documents). Drivers MAY iterate the cursor if necessary - to execute the initial ``find`` command but MUST NOT iterate further to avoid - executing a ``getMore``. - - Observe the CommandSucceededEvent event for the ``find`` command and extract - the cursor's ID and namespace from the response document's ``cursor.id`` and - ``cursor.ns`` fields, respectively. Destroy the cursor object and observe - a CommandStartedEvent and CommandSucceededEvent for the ``killCursors`` - command. Assert that the cursor ID and target namespace in the outgoing - command match the values from the ``find`` command's CommandSucceededEvent. - When matching the namespace, note that the ``killCursors`` field will contain - the collection name and the database may be inferred from either the ``$db`` - field or accessed via the CommandStartedEvent directly. Finally, assert that - the ``killCursors`` CommandSucceededEvent indicates that the expected cursor - was killed in the ``cursorsKilled`` field. - - Note: this test assumes that drivers only issue a ``killCursors`` command - internally when destroying a cursor that may still exist on the server. If - a driver constructs and issues ``killCursors`` commands in other ways (e.g. - public API), this test MUST be adapted to test all such code paths. - -#. Test that the driver can establish a connection with Atlas Data Lake - without authentication. For these tests, create a MongoClient using a - valid connection string without auth credentials and execute a ping - command. - -#. Test that the driver can establish a connection with Atlas Data Lake - with authentication. For these tests, create a MongoClient using a - valid connection string with SCRAM-SHA-1 and credentials from the - drivers-evergreen-tools ADL configuration and execute a ping command. - Repeat this test using SCRAM-SHA-256. - -Changelog -========= - -:2022-10-05: Add spec front matter -:2020-07-15: Link to CRUD test runner implementation and note that the collection - under test must not be dropped before each test. From 08bfecd3fe93c01eacb63499326839a145f5d2cc Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 8 Mar 2024 16:28:39 -0500 Subject: [PATCH 2/7] Convert legacy tests to unified format --- .../tests/unified/aggregate.yml | 38 +++++++++++++++ .../tests/unified/estimatedDocumentCount.yml | 31 ++++++++++++ .../tests/unified/find.yml | 41 ++++++++++++++++ .../tests/unified/getMore.yml | 48 +++++++++++++++++++ .../tests/unified/listCollections.yml | 26 ++++++++++ .../tests/unified/listDatabases.yml | 22 +++++++++ .../tests/unified/runCommand.yml | 29 +++++++++++ 7 files changed, 235 insertions(+) create mode 100644 source/atlas-data-lake-testing/tests/unified/aggregate.yml create mode 100644 source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml create mode 100644 source/atlas-data-lake-testing/tests/unified/find.yml create mode 100644 source/atlas-data-lake-testing/tests/unified/getMore.yml create mode 100644 source/atlas-data-lake-testing/tests/unified/listCollections.yml create mode 100644 source/atlas-data-lake-testing/tests/unified/listDatabases.yml create mode 100644 source/atlas-data-lake-testing/tests/unified/runCommand.yml diff --git a/source/atlas-data-lake-testing/tests/unified/aggregate.yml b/source/atlas-data-lake-testing/tests/unified/aggregate.yml new file mode 100644 index 0000000000..54bad5aeaa --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/aggregate.yml @@ -0,0 +1,38 @@ +description: "aggregate" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name driverdata + +tests: + - description: "Aggregate with pipeline (project, sort, limit)" + operations: + - object: *collection0 + name: aggregate + arguments: + pipeline: + - $project: { _id: 0 } + - $sort: { a: 1 } + - $limit: 2 + expectResult: + - { a: 1, b: 2, c: 3 } + - { a: 2, b: 3, c: 4 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + commandName: aggregate + databaseName: *database0Name diff --git a/source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml b/source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml new file mode 100644 index 0000000000..fe3c353879 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml @@ -0,0 +1,31 @@ +description: "estimatedDocumentCount" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name driverdata + +tests: + - description: "estimatedDocumentCount succeeds" + operations: + - object: *collection0 + name: estimatedDocumentCount + expectResult: 15 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + count: *collection0Name + commandName: count + databaseName: *database0Name diff --git a/source/atlas-data-lake-testing/tests/unified/find.yml b/source/atlas-data-lake-testing/tests/unified/find.yml new file mode 100644 index 0000000000..10384f78f4 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/find.yml @@ -0,0 +1,41 @@ +description: "find" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name driverdata + +tests: + - description: "Find with projection and sort" + operations: + - object: *collection0 + name: find + arguments: + filter: { b: { $gt: 5 } } + projection: { _id: 0 } + sort: { a: 1 } + limit: 5 + expectResult: + - { a: 5, b: 6, c: 7 } + - { a: 6, b: 7, c: 8 } + - { a: 7, b: 8, c: 9 } + - { a: 8, b: 9, c: 10 } + - { a: 9, b: 10, c: 11 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + commandName: find + databaseName: *database0Name diff --git a/source/atlas-data-lake-testing/tests/unified/getMore.yml b/source/atlas-data-lake-testing/tests/unified/getMore.yml new file mode 100644 index 0000000000..f02fbfe9a1 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/getMore.yml @@ -0,0 +1,48 @@ +description: "getMore" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name driverdata + +tests: + - description: "A successful find event with getMore" + operations: + - object: *collection0 + name: find + arguments: + filter: { a: { $gte: 2 } } + sort: { a: 1 } + batchSize: 3 + limit: 4 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: { a: { $gte : 2 } } + sort: { a: 1 } + batchSize: 3 + limit: 4 + commandName: find + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + # collection name will be an internal identifier + collection: { $$type: string } + batchSize: 1 + commandName: getMore + # mongohoused always expects getMores on the "cursors" database + databaseName: cursors diff --git a/source/atlas-data-lake-testing/tests/unified/listCollections.yml b/source/atlas-data-lake-testing/tests/unified/listCollections.yml new file mode 100644 index 0000000000..2b9cd1cc94 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/listCollections.yml @@ -0,0 +1,26 @@ +description: "listCollections" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + +tests: + - description: "ListCollections succeeds" + operations: + - object: *database0 + name: listCollections + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + listCollections: 1 + commandName: listCollections + databaseName: *database0Name diff --git a/source/atlas-data-lake-testing/tests/unified/listDatabases.yml b/source/atlas-data-lake-testing/tests/unified/listDatabases.yml new file mode 100644 index 0000000000..cb70ee6c73 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/listDatabases.yml @@ -0,0 +1,22 @@ +description: "listDatabases" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + +tests: + - description: "ListCollections succeeds" + operations: + - object: *client0 + name: listDatabases + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + listDatabases: 1 + commandName: listDatabases + databaseName: admin diff --git a/source/atlas-data-lake-testing/tests/unified/runCommand.yml b/source/atlas-data-lake-testing/tests/unified/runCommand.yml new file mode 100644 index 0000000000..8ab0d7b478 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/runCommand.yml @@ -0,0 +1,29 @@ +description: "runCommand" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + +tests: + - description: "ping succeeds using runCommand" + operations: + - object: *database0 + name: runCommand + arguments: + command: { ping: 1 } + commandName: ping + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + ping: 1 + commandName: ping + databaseName: *database0Name From 56da1190d35c1529eee294fddb6da7a1eb2f9701 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 8 Mar 2024 16:48:21 -0500 Subject: [PATCH 3/7] Add ADL to unified test format Makefile --- source/unified-test-format/tests/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/unified-test-format/tests/Makefile b/source/unified-test-format/tests/Makefile index 08b26f99dd..0ec0e28404 100644 --- a/source/unified-test-format/tests/Makefile +++ b/source/unified-test-format/tests/Makefile @@ -1,8 +1,8 @@ SCHEMA=../schema-1.19.json -.PHONY: all invalid valid-fail valid-pass versioned-api load-balancers gridfs transactions transactions-convenient-api crud collection-management retryable-reads retryable-writes sessions command-logging-and-monitoring client-side-operations-timeout HAS_AJV +.PHONY: all invalid valid-fail valid-pass atlas-data-lake versioned-api load-balancers gridfs transactions transactions-convenient-api crud collection-management retryable-reads retryable-writes sessions command-logging-and-monitoring client-side-operations-timeout HAS_AJV -all: invalid valid-fail valid-pass versioned-api load-balancers gridfs transactions transactions-convenient-api change-streams crud collection-management retryable-reads retryable-writes sessions command-logging-and-monitoring client-side-operations-timeout client-side-encryption +all: invalid valid-fail valid-pass atlas-data-lake versioned-api load-balancers gridfs transactions transactions-convenient-api change-streams crud collection-management retryable-reads retryable-writes sessions command-logging-and-monitoring client-side-operations-timeout client-side-encryption invalid: HAS_AJV @# Redirect stdout to hide expected validation errors @@ -14,6 +14,9 @@ valid-fail: HAS_AJV valid-pass: HAS_AJV @ajv test -s $(SCHEMA) -d "valid-pass/*.yml" --valid +atlas-data-lake: HAS_AJV + @ajv test -s $(SCHEMA) -d "../../atlas-data-lake-testing/tests/unified/*.yml" --valid + versioned-api: HAS_AJV @ajv test -s $(SCHEMA) -d "../../versioned-api/tests/*.yml" --valid From d940c2bb15b20fb55291252a1dc44194f25c5fdf Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 11 Mar 2024 09:56:03 -0400 Subject: [PATCH 4/7] Generate JSON --- .../tests/unified/aggregate.json | 84 ++++++++++++++++ .../tests/unified/estimatedDocumentCount.json | 56 +++++++++++ .../tests/unified/find.json | 96 +++++++++++++++++++ .../tests/unified/getMore.json | 95 ++++++++++++++++++ .../tests/unified/listCollections.json | 48 ++++++++++ .../tests/unified/listDatabases.json | 41 ++++++++ .../tests/unified/runCommand.json | 54 +++++++++++ 7 files changed, 474 insertions(+) create mode 100644 source/atlas-data-lake-testing/tests/unified/aggregate.json create mode 100644 source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json create mode 100644 source/atlas-data-lake-testing/tests/unified/find.json create mode 100644 source/atlas-data-lake-testing/tests/unified/getMore.json create mode 100644 source/atlas-data-lake-testing/tests/unified/listCollections.json create mode 100644 source/atlas-data-lake-testing/tests/unified/listDatabases.json create mode 100644 source/atlas-data-lake-testing/tests/unified/runCommand.json diff --git a/source/atlas-data-lake-testing/tests/unified/aggregate.json b/source/atlas-data-lake-testing/tests/unified/aggregate.json new file mode 100644 index 0000000000..68a3467c71 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/aggregate.json @@ -0,0 +1,84 @@ +{ + "description": "aggregate", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "driverdata" + } + } + ], + "tests": [ + { + "description": "Aggregate with pipeline (project, sort, limit)", + "operations": [ + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 0 + } + }, + { + "$sort": { + "a": 1 + } + }, + { + "$limit": 2 + } + ] + }, + "expectResult": [ + { + "a": 1, + "b": 2, + "c": 3 + }, + { + "a": 2, + "b": 3, + "c": 4 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "driverdata" + }, + "commandName": "aggregate", + "databaseName": "test" + } + } + ] + } + ] + } + ] +} diff --git a/source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json b/source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json new file mode 100644 index 0000000000..b7515a4418 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json @@ -0,0 +1,56 @@ +{ + "description": "estimatedDocumentCount", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "driverdata" + } + } + ], + "tests": [ + { + "description": "estimatedDocumentCount succeeds", + "operations": [ + { + "object": "collection0", + "name": "estimatedDocumentCount", + "expectResult": 15 + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "count": "driverdata" + }, + "commandName": "count", + "databaseName": "test" + } + } + ] + } + ] + } + ] +} diff --git a/source/atlas-data-lake-testing/tests/unified/find.json b/source/atlas-data-lake-testing/tests/unified/find.json new file mode 100644 index 0000000000..d0652dc720 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/find.json @@ -0,0 +1,96 @@ +{ + "description": "find", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "driverdata" + } + } + ], + "tests": [ + { + "description": "Find with projection and sort", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "b": { + "$gt": 5 + } + }, + "projection": { + "_id": 0 + }, + "sort": { + "a": 1 + }, + "limit": 5 + }, + "expectResult": [ + { + "a": 5, + "b": 6, + "c": 7 + }, + { + "a": 6, + "b": 7, + "c": 8 + }, + { + "a": 7, + "b": 8, + "c": 9 + }, + { + "a": 8, + "b": 9, + "c": 10 + }, + { + "a": 9, + "b": 10, + "c": 11 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "driverdata" + }, + "commandName": "find", + "databaseName": "test" + } + } + ] + } + ] + } + ] +} diff --git a/source/atlas-data-lake-testing/tests/unified/getMore.json b/source/atlas-data-lake-testing/tests/unified/getMore.json new file mode 100644 index 0000000000..109b6d3d8e --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/getMore.json @@ -0,0 +1,95 @@ +{ + "description": "getMore", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "driverdata" + } + } + ], + "tests": [ + { + "description": "A successful find event with getMore", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "a": { + "$gte": 2 + } + }, + "sort": { + "a": 1 + }, + "batchSize": 3, + "limit": 4 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "driverdata", + "filter": { + "a": { + "$gte": 2 + } + }, + "sort": { + "a": 1 + }, + "batchSize": 3, + "limit": 4 + }, + "commandName": "find", + "databaseName": "test" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": { + "$$type": "string" + }, + "batchSize": 1 + }, + "commandName": "getMore", + "databaseName": "cursors" + } + } + ] + } + ] + } + ] +} diff --git a/source/atlas-data-lake-testing/tests/unified/listCollections.json b/source/atlas-data-lake-testing/tests/unified/listCollections.json new file mode 100644 index 0000000000..642e7ed328 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/listCollections.json @@ -0,0 +1,48 @@ +{ + "description": "listCollections", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + } + ], + "tests": [ + { + "description": "ListCollections succeeds", + "operations": [ + { + "object": "database0", + "name": "listCollections" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "listCollections": 1 + }, + "commandName": "listCollections", + "databaseName": "test" + } + } + ] + } + ] + } + ] +} diff --git a/source/atlas-data-lake-testing/tests/unified/listDatabases.json b/source/atlas-data-lake-testing/tests/unified/listDatabases.json new file mode 100644 index 0000000000..64506ee54e --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/listDatabases.json @@ -0,0 +1,41 @@ +{ + "description": "listDatabases", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + } + ], + "tests": [ + { + "description": "ListCollections succeeds", + "operations": [ + { + "object": "client0", + "name": "listDatabases" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "listDatabases": 1 + }, + "commandName": "listDatabases", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/atlas-data-lake-testing/tests/unified/runCommand.json b/source/atlas-data-lake-testing/tests/unified/runCommand.json new file mode 100644 index 0000000000..325b6b3f30 --- /dev/null +++ b/source/atlas-data-lake-testing/tests/unified/runCommand.json @@ -0,0 +1,54 @@ +{ + "description": "runCommand", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + } + ], + "tests": [ + { + "description": "ping succeeds using runCommand", + "operations": [ + { + "object": "database0", + "name": "runCommand", + "arguments": { + "command": { + "ping": 1 + }, + "commandName": "ping" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "ping": 1 + }, + "commandName": "ping", + "databaseName": "test" + } + } + ] + } + ] + } + ] +} From 8f79017e8b49d2c172c9c74eb3ffae3c1ea73a38 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 11 Mar 2024 09:59:57 -0400 Subject: [PATCH 5/7] Do not execute killAllSessions on Atlas Data Lake --- source/atlas-data-lake-testing/tests/README.md | 8 ++++++-- source/unified-test-format/unified-test-format.md | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/atlas-data-lake-testing/tests/README.md b/source/atlas-data-lake-testing/tests/README.md index 762550221c..9b76b3888b 100644 --- a/source/atlas-data-lake-testing/tests/README.md +++ b/source/atlas-data-lake-testing/tests/README.md @@ -9,17 +9,21 @@ with [Atlas Data Lake](https://www.mongodb.com/docs/datalake/). These tests util Several prose tests, which are not easily expressed in YAML, are also presented in this file. Those tests will need to be manually implemented by each driver. -## Test Environment +## Test Considerations Running these integration tests will require a running `mongohoused` with data available in its `test.driverdata` collection. See the [ADL directory in drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/atlas_data_lake) and [10gen/mongohouse README](https://github.com/10gen/mongohouse/blob/master/README.md) for more information. -The test runner for Atlas Data Lake Testing MUST NOT drop the collection and/or database under test. In contrast +The test runner for Atlas Data Lake testing MUST NOT drop the collection and/or database under test. In contrast to most other tests, which insert their own data fixtures into an empty collection, the data for these tests is specified in the `mongohoused` configuration file. +Additionally, the test runner MUST NOT execute `killAllSessions` (see: +[Terminating Open Transactions](../../unified-test-format/unified-test-format.md#terminating-open-transactions)) when +connected to Atlas Data Lake. + ## Prose Tests The following tests MUST be implemented to fully test compatibility with Atlas Data Lake. diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index c84e23207f..df33a913b6 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -3119,6 +3119,8 @@ impossible to guarantee that an existing transaction will not block test executi SHOULD either ignore Unauthorized(13) command failures or avoid calling `killAllSessions` altogether when connected to Atlas (e.g. by detecting `mongodb.net` in the hostname or allowing the test runner to be configured externally). +Test runners MUST NOT execute `killAllSessions` when connected to Atlas Data Lake. + ##### MigrationConflict Errors on Sharded Clusters Following [SERVER-82353](https://jira.mongodb.org/browse/SERVER-82353), drivers may encounter MigrationConflict errors @@ -3391,6 +3393,8 @@ other specs *and* collating spec changes developed in parallel or during the sam ## Changelog +- 2024-03-11: Note that `killAllSessions` should not be executed on Atlas Data Lake + - 2024-02-27: Document `onPrimaryTransactionalWrite` fail point, which is used in retryable writes tests. - 2024-02-23: Require test runners to gossip cluster time from internal MongoClient to each session entity. From ddd11408d3f7e808e56f927a5291094dff3c9a84 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 11 Mar 2024 10:17:26 -0400 Subject: [PATCH 6/7] Fix Markdown formatting --- source/atlas-data-lake-testing/tests/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/atlas-data-lake-testing/tests/README.md b/source/atlas-data-lake-testing/tests/README.md index 9b76b3888b..f6ade52de1 100644 --- a/source/atlas-data-lake-testing/tests/README.md +++ b/source/atlas-data-lake-testing/tests/README.md @@ -16,9 +16,9 @@ collection. See the [ADL directory in drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/atlas_data_lake) and [10gen/mongohouse README](https://github.com/10gen/mongohouse/blob/master/README.md) for more information. -The test runner for Atlas Data Lake testing MUST NOT drop the collection and/or database under test. In contrast -to most other tests, which insert their own data fixtures into an empty collection, the data for these tests is -specified in the `mongohoused` configuration file. +The test runner for Atlas Data Lake testing MUST NOT drop the collection and/or database under test. In contrast to most +other tests, which insert their own data fixtures into an empty collection, the data for these tests is specified in the +`mongohoused` configuration file. Additionally, the test runner MUST NOT execute `killAllSessions` (see: [Terminating Open Transactions](../../unified-test-format/unified-test-format.md#terminating-open-transactions)) when From fc37bf82cd86fc020e70a90365be0058abc86b92 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 11 Mar 2024 10:39:35 -0400 Subject: [PATCH 7/7] Remove legacy test files --- .../tests/aggregate.json | 53 --------------- .../tests/aggregate.yml | 23 ------- .../tests/estimatedDocumentCount.json | 27 -------- .../tests/estimatedDocumentCount.yml | 18 ----- .../atlas-data-lake-testing/tests/find.json | 65 ------------------- source/atlas-data-lake-testing/tests/find.yml | 27 -------- .../tests/getMore.json | 57 ---------------- .../atlas-data-lake-testing/tests/getMore.yml | 35 ---------- .../tests/listCollections.json | 25 ------- .../tests/listCollections.yml | 17 ----- .../tests/listDatabases.json | 24 ------- .../tests/listDatabases.yml | 15 ----- .../tests/runCommand.json | 31 --------- .../tests/runCommand.yml | 20 ------ 14 files changed, 437 deletions(-) delete mode 100644 source/atlas-data-lake-testing/tests/aggregate.json delete mode 100644 source/atlas-data-lake-testing/tests/aggregate.yml delete mode 100644 source/atlas-data-lake-testing/tests/estimatedDocumentCount.json delete mode 100644 source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml delete mode 100644 source/atlas-data-lake-testing/tests/find.json delete mode 100644 source/atlas-data-lake-testing/tests/find.yml delete mode 100644 source/atlas-data-lake-testing/tests/getMore.json delete mode 100644 source/atlas-data-lake-testing/tests/getMore.yml delete mode 100644 source/atlas-data-lake-testing/tests/listCollections.json delete mode 100644 source/atlas-data-lake-testing/tests/listCollections.yml delete mode 100644 source/atlas-data-lake-testing/tests/listDatabases.json delete mode 100644 source/atlas-data-lake-testing/tests/listDatabases.yml delete mode 100644 source/atlas-data-lake-testing/tests/runCommand.json delete mode 100644 source/atlas-data-lake-testing/tests/runCommand.yml diff --git a/source/atlas-data-lake-testing/tests/aggregate.json b/source/atlas-data-lake-testing/tests/aggregate.json deleted file mode 100644 index 99995bca41..0000000000 --- a/source/atlas-data-lake-testing/tests/aggregate.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "collection_name": "driverdata", - "database_name": "test", - "tests": [ - { - "description": "Aggregate with pipeline (project, sort, limit)", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 0 - } - }, - { - "$sort": { - "a": 1 - } - }, - { - "$limit": 2 - } - ] - }, - "result": [ - { - "a": 1, - "b": 2, - "c": 3 - }, - { - "a": 2, - "b": 3, - "c": 4 - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "driverdata" - } - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/aggregate.yml b/source/atlas-data-lake-testing/tests/aggregate.yml deleted file mode 100644 index bbe813987d..0000000000 --- a/source/atlas-data-lake-testing/tests/aggregate.yml +++ /dev/null @@ -1,23 +0,0 @@ -collection_name: &collection_name "driverdata" -database_name: &database_name "test" - -tests: - - - description: "Aggregate with pipeline (project, sort, limit)" - operations: - - - object: collection - name: aggregate - arguments: - pipeline: - - $project: { _id: 0 } - - $sort: { a: 1 } - - $limit: 2 - result: - - { a: 1, b: 2, c: 3 } - - { a: 2, b: 3, c: 4 } - expectations: - - - command_started_event: - command: - aggregate: *collection_name diff --git a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json b/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json deleted file mode 100644 index 997a3ab3fc..0000000000 --- a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "collection_name": "driverdata", - "database_name": "test", - "tests": [ - { - "description": "estimatedDocumentCount succeeds", - "operations": [ - { - "object": "collection", - "name": "estimatedDocumentCount", - "result": 15 - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "count": "driverdata" - }, - "command_name": "count", - "database_name": "test" - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml b/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml deleted file mode 100644 index 64c6bbd04f..0000000000 --- a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml +++ /dev/null @@ -1,18 +0,0 @@ -collection_name: &collection_name "driverdata" -database_name: &database_name "test" - -tests: - - - description: "estimatedDocumentCount succeeds" - operations: - - - object: collection - name: estimatedDocumentCount - result: 15 - expectations: - - - command_started_event: - command: - count: *collection_name - command_name: count - database_name: *database_name diff --git a/source/atlas-data-lake-testing/tests/find.json b/source/atlas-data-lake-testing/tests/find.json deleted file mode 100644 index 8a3468a135..0000000000 --- a/source/atlas-data-lake-testing/tests/find.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "collection_name": "driverdata", - "database_name": "test", - "tests": [ - { - "description": "Find with projection and sort", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": { - "b": { - "$gt": 5 - } - }, - "projection": { - "_id": 0 - }, - "sort": { - "a": 1 - }, - "limit": 5 - }, - "result": [ - { - "a": 5, - "b": 6, - "c": 7 - }, - { - "a": 6, - "b": 7, - "c": 8 - }, - { - "a": 7, - "b": 8, - "c": 9 - }, - { - "a": 8, - "b": 9, - "c": 10 - }, - { - "a": 9, - "b": 10, - "c": 11 - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "driverdata" - } - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/find.yml b/source/atlas-data-lake-testing/tests/find.yml deleted file mode 100644 index ed0f9fd530..0000000000 --- a/source/atlas-data-lake-testing/tests/find.yml +++ /dev/null @@ -1,27 +0,0 @@ -collection_name: &collection_name "driverdata" -database_name: &database_name "test" - -tests: - - - description: "Find with projection and sort" - operations: - - - object: collection - name: find - arguments: - filter: { b: { $gt: 5 } } - projection: { _id: 0 } - sort: { a: 1 } - limit: 5 - result: - - {"a": 5, "b": 6, "c": 7} - - {"a": 6, "b": 7, "c": 8} - - {"a": 7, "b": 8, "c": 9} - - {"a": 8, "b": 9, "c": 10} - - {"a": 9, "b": 10, "c": 11} - expectations: - - - command_started_event: - command: - find: *collection_name - diff --git a/source/atlas-data-lake-testing/tests/getMore.json b/source/atlas-data-lake-testing/tests/getMore.json deleted file mode 100644 index e2e1d4788a..0000000000 --- a/source/atlas-data-lake-testing/tests/getMore.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "collection_name": "driverdata", - "database_name": "test", - "tests": [ - { - "description": "A successful find event with getMore", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": { - "a": { - "$gte": 2 - } - }, - "sort": { - "a": 1 - }, - "batchSize": 3, - "limit": 4 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "driverdata", - "filter": { - "a": { - "$gte": 2 - } - }, - "sort": { - "a": 1 - }, - "batchSize": 3, - "limit": 4 - }, - "command_name": "find", - "database_name": "test" - } - }, - { - "command_started_event": { - "command": { - "batchSize": 1 - }, - "command_name": "getMore", - "database_name": "cursors" - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/getMore.yml b/source/atlas-data-lake-testing/tests/getMore.yml deleted file mode 100644 index c16c1224c5..0000000000 --- a/source/atlas-data-lake-testing/tests/getMore.yml +++ /dev/null @@ -1,35 +0,0 @@ -collection_name: &collection_name "driverdata" -database_name: &database_name "test" - -tests: - - - description: "A successful find event with getMore" - operations: - - - object: collection - name: find - arguments: - filter: { a: { $gte: 2 }} - sort: { a: 1 } - batchSize: 3 - limit: 4 - expectations: - - - command_started_event: - command: - find: *collection_name - filter: { a: { $gte : 2 }} - sort: { a: 1 } - batchSize: 3 - limit: 4 - command_name: "find" - database_name: *database_name - - - command_started_event: - command: - # Assertions for "getMore" and "collection" fields are omitted, as they will have arbitrary values - # TODO: Those assertions can be added after wildcard matchers are available via SPEC-1215 - batchSize: 1 - command_name: "getMore" - # mongohoused always expects getMores on the "cursors" database - database_name: "cursors" diff --git a/source/atlas-data-lake-testing/tests/listCollections.json b/source/atlas-data-lake-testing/tests/listCollections.json deleted file mode 100644 index e419f7b3e9..0000000000 --- a/source/atlas-data-lake-testing/tests/listCollections.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "database_name": "test", - "tests": [ - { - "description": "ListCollections succeeds", - "operations": [ - { - "name": "listCollections", - "object": "database" - } - ], - "expectations": [ - { - "command_started_event": { - "command_name": "listCollections", - "database_name": "test", - "command": { - "listCollections": 1 - } - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/listCollections.yml b/source/atlas-data-lake-testing/tests/listCollections.yml deleted file mode 100644 index 2b1fedcddb..0000000000 --- a/source/atlas-data-lake-testing/tests/listCollections.yml +++ /dev/null @@ -1,17 +0,0 @@ -database_name: &database_name "test" - -tests: - - - description: "ListCollections succeeds" - operations: - - - name: listCollections - object: database - expectations: - - - command_started_event: - command_name: "listCollections" - database_name: *database_name - command: - listCollections: 1 - diff --git a/source/atlas-data-lake-testing/tests/listDatabases.json b/source/atlas-data-lake-testing/tests/listDatabases.json deleted file mode 100644 index 6458148e49..0000000000 --- a/source/atlas-data-lake-testing/tests/listDatabases.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "tests": [ - { - "description": "ListDatabases succeeds", - "operations": [ - { - "name": "listDatabases", - "object": "client" - } - ], - "expectations": [ - { - "command_started_event": { - "command_name": "listDatabases", - "database_name": "admin", - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/listDatabases.yml b/source/atlas-data-lake-testing/tests/listDatabases.yml deleted file mode 100644 index b6e565b90f..0000000000 --- a/source/atlas-data-lake-testing/tests/listDatabases.yml +++ /dev/null @@ -1,15 +0,0 @@ -tests: - - - description: "ListDatabases succeeds" - operations: - - - name: listDatabases - object: client - expectations: - - - command_started_event: - command_name: "listDatabases" - database_name: "admin" - command: - listDatabases: 1 - diff --git a/source/atlas-data-lake-testing/tests/runCommand.json b/source/atlas-data-lake-testing/tests/runCommand.json deleted file mode 100644 index d81ff1a64b..0000000000 --- a/source/atlas-data-lake-testing/tests/runCommand.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "database_name": "test", - "tests": [ - { - "description": "ping succeeds using runCommand", - "operations": [ - { - "name": "runCommand", - "object": "database", - "command_name": "ping", - "arguments": { - "command": { - "ping": 1 - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command_name": "ping", - "database_name": "test", - "command": { - "ping": 1 - } - } - } - ] - } - ] -} diff --git a/source/atlas-data-lake-testing/tests/runCommand.yml b/source/atlas-data-lake-testing/tests/runCommand.yml deleted file mode 100644 index 14435c28d5..0000000000 --- a/source/atlas-data-lake-testing/tests/runCommand.yml +++ /dev/null @@ -1,20 +0,0 @@ -database_name: &database_name "test" - -tests: - - - description: "ping succeeds using runCommand" - operations: - - - name: runCommand - object: database - command_name: ping - arguments: - command: - ping: 1 - expectations: - - - command_started_event: - command_name: ping - database_name: *database_name - command: - ping: 1