diff --git a/build.cake b/build.cake index 656dbaa9028..134248995bb 100644 --- a/build.cake +++ b/build.cake @@ -156,13 +156,6 @@ Task("TestAtlasConnectivity") items: GetFiles("./**/AtlasConnectivity.Tests.csproj"), action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject)); -Task("TestAtlasDataLake") - .IsDependentOn("Build") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"AtlasDataLake\"")); - Task("TestAtlasSearch") .IsDependentOn("Build") .DoesForEach( diff --git a/evergreen/evergreen.yml b/evergreen/evergreen.yml index 9e1a921f7a3..f55c269e032 100644 --- a/evergreen/evergreen.yml +++ b/evergreen/evergreen.yml @@ -650,15 +650,6 @@ functions: script: | DRIVERS_TOOLS=${DRIVERS_TOOLS} OS=${OS} ASSERT_NO_URI_CREDS=true evergreen/run-mongodb-aws-test.sh session-creds - run-atlas-data-lake-test: - - command: shell.exec - type: test - params: - working_dir: mongo-csharp-driver - script: | - ${PREPARE_SHELL} - evergreen/run-atlas-data-lake-test.sh - run-atlas-search-test: - command: shell.exec type: test @@ -1357,12 +1348,6 @@ tasks: FRAMEWORK: net60 REQUIRE_API_VERSION: true - - name: atlas-data-lake-test - commands: - - func: assume-aws-test-secrets-role - - func: bootstrap-mongohoused - - func: run-atlas-data-lake-test - - name: atlas-search-test commands: - func: assume-aws-test-secrets-role @@ -2580,13 +2565,6 @@ buildvariants: tasks: - name: atlas-connectivity-tests -- name: atlas-data-lake-test - display_name: "Atlas Data Lake Tests" - run_on: - - ubuntu2004-large - tasks: - - name: atlas-data-lake-test - - name: atlas-search-test display_name: "Atlas Search Tests" run_on: diff --git a/evergreen/run-atlas-data-lake-test.sh b/evergreen/run-atlas-data-lake-test.sh deleted file mode 100755 index f51463c0940..00000000000 --- a/evergreen/run-atlas-data-lake-test.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit # Exit the script with error if any of the commands fail - -############################################ -# Main Program # -############################################ - -echo "Running Atlas Data Lake driver tests" - -export MONGODB_URI="mongodb://mhuser:pencil@localhost" -export ATLAS_DATA_LAKE_TESTS_ENABLED=true - -./build.sh --target=TestAtlasDataLake diff --git a/specifications/atlas-data-lake-testing/tests/README.md b/specifications/atlas-data-lake-testing/tests/README.md deleted file mode 100644 index 6653fc66a93..00000000000 --- a/specifications/atlas-data-lake-testing/tests/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# 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 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 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. - -### 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/specifications/atlas-data-lake-testing/tests/unified/aggregate.json b/specifications/atlas-data-lake-testing/tests/unified/aggregate.json deleted file mode 100644 index 68a3467c71c..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/aggregate.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "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/specifications/atlas-data-lake-testing/tests/unified/aggregate.yml b/specifications/atlas-data-lake-testing/tests/unified/aggregate.yml deleted file mode 100644 index 54bad5aeaae..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/aggregate.yml +++ /dev/null @@ -1,38 +0,0 @@ -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/specifications/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json b/specifications/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json deleted file mode 100644 index b7515a44182..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "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/specifications/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml b/specifications/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml deleted file mode 100644 index fe3c353879c..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/estimatedDocumentCount.yml +++ /dev/null @@ -1,31 +0,0 @@ -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/specifications/atlas-data-lake-testing/tests/unified/find.json b/specifications/atlas-data-lake-testing/tests/unified/find.json deleted file mode 100644 index d0652dc720f..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/find.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "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/specifications/atlas-data-lake-testing/tests/unified/find.yml b/specifications/atlas-data-lake-testing/tests/unified/find.yml deleted file mode 100644 index 10384f78f4c..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/find.yml +++ /dev/null @@ -1,41 +0,0 @@ -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/specifications/atlas-data-lake-testing/tests/unified/getMore.json b/specifications/atlas-data-lake-testing/tests/unified/getMore.json deleted file mode 100644 index 109b6d3d8e7..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/getMore.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "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/specifications/atlas-data-lake-testing/tests/unified/getMore.yml b/specifications/atlas-data-lake-testing/tests/unified/getMore.yml deleted file mode 100644 index f02fbfe9a18..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/getMore.yml +++ /dev/null @@ -1,48 +0,0 @@ -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/specifications/atlas-data-lake-testing/tests/unified/listCollections.json b/specifications/atlas-data-lake-testing/tests/unified/listCollections.json deleted file mode 100644 index 642e7ed328a..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/listCollections.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "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/specifications/atlas-data-lake-testing/tests/unified/listCollections.yml b/specifications/atlas-data-lake-testing/tests/unified/listCollections.yml deleted file mode 100644 index 2b9cd1cc94f..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/listCollections.yml +++ /dev/null @@ -1,26 +0,0 @@ -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/specifications/atlas-data-lake-testing/tests/unified/listDatabases.json b/specifications/atlas-data-lake-testing/tests/unified/listDatabases.json deleted file mode 100644 index 64506ee54e4..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/listDatabases.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "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/specifications/atlas-data-lake-testing/tests/unified/listDatabases.yml b/specifications/atlas-data-lake-testing/tests/unified/listDatabases.yml deleted file mode 100644 index cb70ee6c73f..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/listDatabases.yml +++ /dev/null @@ -1,22 +0,0 @@ -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/specifications/atlas-data-lake-testing/tests/unified/runCommand.json b/specifications/atlas-data-lake-testing/tests/unified/runCommand.json deleted file mode 100644 index 325b6b3f30a..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/runCommand.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "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" - } - } - ] - } - ] - } - ] -} diff --git a/specifications/atlas-data-lake-testing/tests/unified/runCommand.yml b/specifications/atlas-data-lake-testing/tests/unified/runCommand.yml deleted file mode 100644 index 8ab0d7b478d..00000000000 --- a/specifications/atlas-data-lake-testing/tests/unified/runCommand.yml +++ /dev/null @@ -1,29 +0,0 @@ -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 diff --git a/tests/MongoDB.Driver.Tests/Specifications/UnifiedTestSpecRunner.cs b/tests/MongoDB.Driver.Tests/Specifications/UnifiedTestSpecRunner.cs index be492dfbf53..c5560922882 100644 --- a/tests/MongoDB.Driver.Tests/Specifications/UnifiedTestSpecRunner.cs +++ b/tests/MongoDB.Driver.Tests/Specifications/UnifiedTestSpecRunner.cs @@ -44,14 +44,6 @@ public UnifiedTestSpecRunner(ITestOutputHelper testOutputHelper) [UnifiedTestsTheory("auth.tests.unified")] public void Auth(JsonDrivenTestCase testCase) => Run(testCase); - [Trait("Category", "AtlasDataLake")] - [UnifiedTestsTheory("atlas_data_lake_testing.tests.unified")] - public void AtlasDataLake(JsonDrivenTestCase testCase) - { - RequireEnvironment.Check().EnvironmentVariable("ATLAS_DATA_LAKE_TESTS_ENABLED"); - Run(testCase); - } - [Category("SupportLoadBalancing")] [UnifiedTestsTheory("change_streams.tests.unified")] public void ChangeStreams(JsonDrivenTestCase testCase) => Run(testCase); diff --git a/tests/MongoDB.Driver.Tests/Specifications/atlas-data-lake-testing/prose-tests/AtlasDataLakeProseTests.cs b/tests/MongoDB.Driver.Tests/Specifications/atlas-data-lake-testing/prose-tests/AtlasDataLakeProseTests.cs deleted file mode 100644 index e0fe75bd5f7..00000000000 --- a/tests/MongoDB.Driver.Tests/Specifications/atlas-data-lake-testing/prose-tests/AtlasDataLakeProseTests.cs +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2020-present MongoDB Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -using System.Linq; -using FluentAssertions; -using MongoDB.Bson; -using MongoDB.TestHelpers.XunitExtensions; -using MongoDB.Driver.Core; -using MongoDB.Driver.Core.Events; -using MongoDB.Driver.Core.Misc; -using MongoDB.Driver.Core.TestHelpers.XunitExtensions; -using Xunit; - -namespace MongoDB.Driver.Tests.Specifications.atlas_data_lake_testing.prose_tests -{ - [Trait("Category", "AtlasDataLake")] - public class AtlasDataLakeProseTests - { - [Fact] - public void Driver_should_connect_to_AtlasDataLake_without_authentication() - { - RequireEnvironment.Check().EnvironmentVariable("ATLAS_DATA_LAKE_TESTS_ENABLED"); - - using (var client = DriverTestConfiguration.CreateMongoClient()) - { - client.GetDatabase("admin").RunCommand(new BsonDocument("ping", 1)); - } - } - - [Fact] - public void Driver_should_connect_to_AtlasDataLake_with_SCRAM_SHA_1() - { - RequireEnvironment.Check().EnvironmentVariable("ATLAS_DATA_LAKE_TESTS_ENABLED"); - RequireServer.Check(); - - var connectionString = CoreTestConfiguration.ConnectionString; - var username = connectionString.Username; - var password = connectionString.Password; - var source = connectionString.AuthSource; - - var settings = DriverTestConfiguration.Client.Settings.Clone(); - settings.Credential = MongoCredential.FromComponents(mechanism: "SCRAM-SHA-1", source, username, password); - - using (var client = DriverTestConfiguration.CreateMongoClient(settings)) - { - client.GetDatabase("admin").RunCommand(new BsonDocument("ping", 1)); - } - } - - [Fact] - public void Driver_should_connect_to_AtlasDataLake_with_SCRAM_SHA_256() - { - RequireEnvironment.Check().EnvironmentVariable("ATLAS_DATA_LAKE_TESTS_ENABLED"); - RequireServer.Check().Supports(Feature.ScramSha256Authentication); - - var connectionString = CoreTestConfiguration.ConnectionString; - var username = connectionString.Username; - var password = connectionString.Password; - var source = connectionString.AuthSource; - - var settings = DriverTestConfiguration.Client.Settings.Clone(); - settings.Credential = MongoCredential.FromComponents(mechanism: "SCRAM-SHA-256", source, username, password); - - using (var client = DriverTestConfiguration.CreateMongoClient(settings)) - { - client.GetDatabase("admin").RunCommand(new BsonDocument("ping", 1)); - } - } - - [Fact] - public void KillCursors_should_return_expected_result() - { - RequireEnvironment.Check().EnvironmentVariable("ATLAS_DATA_LAKE_TESTS_ENABLED"); - RequireServer.Check(); - - var databaseName = "test"; - var collectionName = "driverdata"; - - var eventCapturer = new EventCapturer() - .Capture(x => "killCursors" == x.CommandName) - .Capture(x => new[] { "killCursors", "find" }.Contains(x.CommandName)); - - using (var client = DriverTestConfiguration.CreateMongoClient(eventCapturer)) - { - var cursor = client - .GetDatabase(databaseName) - .GetCollection(collectionName) - .Find(new BsonDocument(), new FindOptions { BatchSize = 2 }) - .ToCursor(); - - var findCommandSucceededEvent = eventCapturer.Events.OfType().First(x => x.CommandName == "find"); - var findCommandResult = findCommandSucceededEvent.Reply; - var cursorId = findCommandResult["cursor"]["id"].AsInt64; - var cursorNamespace = CollectionNamespace.FromFullName(findCommandResult["cursor"]["ns"].AsString); - - cursor.Dispose(); - - var killCursorsCommandStartedEvent = eventCapturer.Events.OfType().First(x => x.CommandName == "killCursors"); - var killCursorsCommandSucceededEvent = eventCapturer.Events.OfType().First(x => x.CommandName == "killCursors"); - var killCursorsStartedCommand = killCursorsCommandStartedEvent.Command; - - cursorNamespace.DatabaseNamespace.DatabaseName.Should().Be(killCursorsCommandStartedEvent.DatabaseNamespace.DatabaseName); - cursorNamespace.CollectionName.Should().Be(killCursorsStartedCommand["killCursors"].AsString); - cursorId.Should().Be(killCursorsStartedCommand["cursors"][0].AsInt64); - cursorId.Should().Be(killCursorsCommandSucceededEvent.Reply["cursorsKilled"][0].AsInt64); - } - } - } -} diff --git a/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedTestRunner.cs b/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedTestRunner.cs index 547dbfb4a2b..3b4625bc4f1 100644 --- a/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedTestRunner.cs +++ b/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedTestRunner.cs @@ -125,13 +125,6 @@ public void Run( throw new SkipException($"Test skipped because '{skipReason}'."); } - // should skip on KillOpenTransactions for Atlas Data Lake tests. - // https://github.com/mongodb/specifications/blob/80f88d0af6e47407c03874512e0d9b73708edad5/source/atlas-data-lake-testing/tests/README.md?plain=1#L23 - if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ATLAS_DATA_LAKE_TESTS_ENABLED"))) - { - KillOpenTransactions(DriverTestConfiguration.Client); - } - var lastKnownClusterTime = AddInitialData(DriverTestConfiguration.Client, initialData); _entityMap = UnifiedEntityMap.Create(_eventFormatters, _loggingService.LoggingSettings, async, lastKnownClusterTime); _entityMap.AddRange(entities);