PYTHON-2482 Test Versioned API with a server started with acceptAPIVersion2 (#545)

This commit is contained in:
Shane Harvey 2021-01-14 14:08:58 -08:00 committed by GitHub
parent dea4b90193
commit 112812928b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 174 additions and 6 deletions

View File

@ -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"

View File

@ -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",

View File

@ -6,7 +6,8 @@
"minServerVersion": "4.7",
"serverParameters": {
"enableTestCommands": true,
"acceptAPIVersion2": true
"acceptAPIVersion2": true,
"requireApiVersion": false
}
}
],

View File

@ -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
}
}
}
}
]
}
]
}
]
}