diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 408a210d9..8f301b827 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1970,18 +1970,27 @@ axes: test_pyopenssl: true batchtime: 10080 # 7 days - - id: requireApiVersion - display_name: "requireApiVersion" + - id: versionedApi + display_name: "versionedApi" values: + # Test against a cluster with requireApiVersion=1. - id: "requireApiVersion1" display_name: "requireApiVersion1" - tags: [ "requireApiVersion_tag" ] + tags: [ "versionedApi_tag" ] variables: # REQUIRE_API_VERSION is set to make drivers-evergreen-tools # start a cluster with the requireApiVersion parameter. REQUIRE_API_VERSION: "1" # MONGODB_API_VERSION is the apiVersion to use in the test suite. MONGODB_API_VERSION: "1" + # Test against a cluster with acceptAPIVersion2 but without + # requireApiVersion, and don't automatically add apiVersion to + # clients created in the test suite. + - id: "acceptAPIVersion2" + display_name: "acceptAPIVersion2" + tags: [ "versionedApi_tag" ] + variables: + ORCHESTRATION_FILE: "versioned-api-testing.json" buildvariants: - matrix_name: "tests-all" @@ -2514,8 +2523,9 @@ buildvariants: platform: ubuntu-16.04 python-version: ["3.6", "3.9"] auth: "auth" - requireApiVersion: "*" - display_name: "requireApiVersion ${python-version}" + versionedApi: "*" + display_name: "Versioned API ${versionedApi} ${python-version}" + batchtime: 10080 # 7 days tasks: # Versioned API was introduced in MongoDB 4.7 - "test-latest-standalone" diff --git a/test/versioned-api/crud-api-version-1-strict.json b/test/versioned-api/crud-api-version-1-strict.json index 5b4ccdb65..9604368a1 100644 --- a/test/versioned-api/crud-api-version-1-strict.json +++ b/test/versioned-api/crud-api-version-1-strict.json @@ -141,6 +141,7 @@ }, { "description": "aggregate on database appends declared API version", + "skipReason": "DRIVERS-1505 $listLocalSessions is not supported in API version 1", "operations": [ { "name": "aggregate", diff --git a/test/versioned-api/test-commands-deprecation-errors.json b/test/versioned-api/test-commands-deprecation-errors.json index f4be168f6..bdbc3f92c 100644 --- a/test/versioned-api/test-commands-deprecation-errors.json +++ b/test/versioned-api/test-commands-deprecation-errors.json @@ -6,7 +6,8 @@ "minServerVersion": "4.7", "serverParameters": { "enableTestCommands": true, - "acceptAPIVersion2": true + "acceptAPIVersion2": true, + "requireApiVersion": false } } ], diff --git a/test/versioned-api/transaction-handling.json b/test/versioned-api/transaction-handling.json index 313135c4b..64e9706b5 100644 --- a/test/versioned-api/transaction-handling.json +++ b/test/versioned-api/transaction-handling.json @@ -227,6 +227,162 @@ ] } ] + }, + { + "description": "Committing a transaction twice does not append server API options", + "runOnRequirements": [ + { + "topologies": [ + "replicaset", + "sharded-replicaset" + ] + } + ], + "operations": [ + { + "name": "startTransaction", + "object": "session" + }, + { + "name": "insertOne", + "object": "collection", + "arguments": { + "session": "session", + "document": { + "_id": 6, + "x": 66 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 6 + } + } + } + }, + { + "name": "insertOne", + "object": "collection", + "arguments": { + "session": "session", + "document": { + "_id": 7, + "x": 77 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 7 + } + } + } + }, + { + "name": "commitTransaction", + "object": "session" + }, + { + "name": "commitTransaction", + "object": "session" + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 6, + "x": 66 + } + ], + "lsid": { + "$$sessionLsid": "session" + }, + "startTransaction": true, + "apiVersion": "1", + "apiStrict": { + "$$unsetOrMatches": false + }, + "apiDeprecationErrors": { + "$$unsetOrMatches": false + } + } + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 7, + "x": 77 + } + ], + "lsid": { + "$$sessionLsid": "session" + }, + "apiVersion": { + "$$exists": false + }, + "apiStrict": { + "$$exists": false + }, + "apiDeprecationErrors": { + "$$exists": false + } + } + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session" + }, + "apiVersion": { + "$$exists": false + }, + "apiStrict": { + "$$exists": false + }, + "apiDeprecationErrors": { + "$$exists": false + } + } + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session" + }, + "apiVersion": { + "$$exists": false + }, + "apiStrict": { + "$$exists": false + }, + "apiDeprecationErrors": { + "$$exists": false + } + } + } + } + ] + } + ] } ] } +