PYTHON-4396 Unskip failCommand+appName tests on MongoDB 4.4.7+ (#1735)

This commit is contained in:
Shane Harvey 2024-08-08 11:26:25 -07:00 committed by GitHub
parent f17f5e286e
commit 0a578b4452
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 204 additions and 100 deletions

View File

@ -728,9 +728,9 @@ class ClientContext:
def require_failCommand_appName(self, func):
"""Run a test only if the server supports the failCommand appName."""
# SERVER-47195
# SERVER-47195 and SERVER-49336.
return self._require(
lambda: (self.test_commands_enabled and self.version >= (4, 4, -1)),
lambda: (self.test_commands_enabled and self.version >= (4, 4, 7)),
"failCommand appName must be supported",
func=func,
)

View File

@ -730,9 +730,9 @@ class AsyncClientContext:
def require_failCommand_appName(self, func):
"""Run a test only if the server supports the failCommand appName."""
# SERVER-47195
# SERVER-47195 and SERVER-49336.
return self._require(
lambda: (self.test_commands_enabled and self.version >= (4, 4, -1)),
lambda: (self.test_commands_enabled and self.version >= (4, 4, 7)),
"failCommand appName must be supported",
func=func,
)

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
@ -104,7 +104,7 @@
"aggregate"
],
"blockConnection": true,
"blockTimeMS": 55
"blockTimeMS": 250
}
}
}
@ -114,7 +114,7 @@
"object": "collection",
"arguments": {
"pipeline": [],
"timeoutMS": 50
"timeoutMS": 200
},
"expectError": {
"isTimeoutError": true
@ -242,7 +242,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 150
}
}
}
@ -252,7 +252,7 @@
"object": "collection",
"arguments": {
"pipeline": [],
"timeoutMS": 20,
"timeoutMS": 200,
"batchSize": 2,
"maxAwaitTimeMS": 1
},
@ -310,7 +310,7 @@
"object": "collection",
"arguments": {
"pipeline": [],
"timeoutMS": 20
"timeoutMS": 200
},
"saveResultAsEntity": "changeStream"
},
@ -330,7 +330,7 @@
"aggregate"
],
"blockConnection": true,
"blockTimeMS": 12,
"blockTimeMS": 120,
"errorCode": 7,
"errorLabels": [
"ResumableChangeStreamError"
@ -412,7 +412,7 @@
"arguments": {
"pipeline": [],
"maxAwaitTimeMS": 1,
"timeoutMS": 100
"timeoutMS": 200
},
"saveResultAsEntity": "changeStream"
},
@ -431,7 +431,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 150
"blockTimeMS": 250
}
}
}
@ -534,7 +534,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}
@ -544,7 +544,7 @@
"object": "collection",
"arguments": {
"pipeline": [],
"timeoutMS": 10
"timeoutMS": 200
},
"saveResultAsEntity": "changeStream"
},

View File

@ -75,7 +75,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 50
"blockTimeMS": 250
}
}
}
@ -86,7 +86,7 @@
"arguments": {
"filter": {},
"batchSize": 2,
"timeoutMS": 20
"timeoutMS": 200
},
"saveResultAsEntity": "cursor"
},
@ -175,7 +175,7 @@
"killCursors"
],
"blockConnection": true,
"blockTimeMS": 30
"blockTimeMS": 250
}
}
}
@ -186,7 +186,7 @@
"arguments": {
"filter": {},
"batchSize": 2,
"timeoutMS": 20
"timeoutMS": 200
},
"saveResultAsEntity": "cursor"
},
@ -194,7 +194,7 @@
"name": "close",
"object": "cursor",
"arguments": {
"timeoutMS": 40
"timeoutMS": 400
}
}
],
@ -215,7 +215,7 @@
{
"commandStartedEvent": {
"command": {
"killCursors": "collection",
"killCursors": "coll",
"maxTimeMS": {
"$$type": [
"int",

View File

@ -3,11 +3,10 @@
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.9",
"minServerVersion": "4.4.7",
"topologies": [
"single",
"replicaset",
"sharded-replicaset",
"sharded"
],
"serverless": "forbid"
@ -52,7 +51,7 @@
],
"appName": "reduceMaxTimeMSTest",
"blockConnection": true,
"blockTimeMS": 75
"blockTimeMS": 50
}
}
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
@ -21,7 +21,7 @@
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 50
"timeoutMS": 500
},
"useMultipleMongoses": false,
"observeEvents": [
@ -81,6 +81,9 @@
}
}
]
},
"expectError": {
"isClientError": true
}
}
],
@ -109,7 +112,7 @@
"insert"
],
"blockConnection": true,
"blockTimeMS": 30
"blockTimeMS": 300
}
}
}
@ -182,6 +185,21 @@
}
}
}
},
{
"commandStartedEvent": {
"commandName": "abortTransaction",
"databaseName": "admin",
"command": {
"abortTransaction": 1,
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
}
]
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.2",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -11,7 +11,6 @@
{
"minServerVersion": "4.2",
"topologies": [
"replicaset",
"sharded"
]
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -1,6 +1,6 @@
{
"description": "legacy timeouts continue to work if timeoutMS is not set",
"schemaVersion": "1.9",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "4.4"
@ -280,7 +280,7 @@
{
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -17,7 +17,7 @@
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 10
"timeoutMS": 200
},
"useMultipleMongoses": false,
"observeEvents": [
@ -84,7 +84,7 @@
"find"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}
@ -143,7 +143,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 125
}
}
}
@ -153,7 +153,7 @@
"object": "collection",
"arguments": {
"filter": {},
"timeoutMS": 20,
"timeoutMS": 200,
"batchSize": 2
},
"expectError": {
@ -221,7 +221,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 150
}
}
}
@ -232,7 +232,7 @@
"arguments": {
"filter": {},
"timeoutMode": "cursorLifetime",
"timeoutMS": 20,
"timeoutMS": 200,
"batchSize": 2
},
"expectError": {
@ -299,7 +299,7 @@
"find"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}
@ -355,7 +355,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 125
}
}
}
@ -366,7 +366,7 @@
"arguments": {
"filter": {},
"timeoutMode": "iteration",
"timeoutMS": 20,
"timeoutMS": 200,
"batchSize": 2
}
}
@ -427,7 +427,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
@ -21,7 +21,7 @@
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 50
"timeoutMS": 500
},
"useMultipleMongoses": false,
"observeEvents": [
@ -78,7 +78,7 @@
"commitTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -165,7 +165,7 @@
"abortTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -249,7 +249,7 @@
"insert"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -302,6 +302,26 @@
"commandFailedEvent": {
"commandName": "insert"
}
},
{
"commandStartedEvent": {
"commandName": "abortTransaction",
"databaseName": "admin",
"command": {
"abortTransaction": 1,
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandFailedEvent": {
"commandName": "abortTransaction"
}
}
]
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
@ -75,7 +75,7 @@
"commitTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -98,7 +98,7 @@
"name": "commitTransaction",
"object": "session",
"arguments": {
"timeoutMS": 50
"timeoutMS": 500
},
"expectError": {
"isTimeoutError": true
@ -165,7 +165,7 @@
"abortTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -188,7 +188,7 @@
"name": "abortTransaction",
"object": "session",
"arguments": {
"timeoutMS": 50
"timeoutMS": 500
}
}
],
@ -252,7 +252,7 @@
"insert"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -261,7 +261,7 @@
"name": "withTransaction",
"object": "session",
"arguments": {
"timeoutMS": 50,
"timeoutMS": 500,
"callback": [
{
"name": "insertOne",
@ -306,6 +306,26 @@
"commandFailedEvent": {
"commandName": "insert"
}
},
{
"commandStartedEvent": {
"commandName": "abortTransaction",
"databaseName": "admin",
"command": {
"abortTransaction": 1,
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandFailedEvent": {
"commandName": "abortTransaction"
}
}
]
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
@ -47,7 +47,7 @@
"id": "session",
"client": "client",
"sessionOptions": {
"defaultTimeoutMS": 50
"defaultTimeoutMS": 500
}
}
}
@ -78,7 +78,7 @@
"commitTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -165,7 +165,7 @@
"abortTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -249,7 +249,7 @@
"insert"
],
"blockConnection": true,
"blockTimeMS": 60
"blockTimeMS": 600
}
}
}
@ -302,6 +302,26 @@
"commandFailedEvent": {
"commandName": "insert"
}
},
{
"commandStartedEvent": {
"commandName": "abortTransaction",
"databaseName": "admin",
"command": {
"abortTransaction": 1,
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandFailedEvent": {
"commandName": "abortTransaction"
}
}
]
}

View File

@ -17,7 +17,7 @@
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 10
"timeoutMS": 200
},
"useMultipleMongoses": false,
"observeEvents": [
@ -130,7 +130,7 @@
"find"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 300
}
}
}
@ -188,7 +188,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 150
}
}
}
@ -199,7 +199,7 @@
"arguments": {
"filter": {},
"cursorType": "tailableAwait",
"timeoutMS": 20,
"timeoutMS": 250,
"batchSize": 1
},
"saveResultAsEntity": "tailableCursor"
@ -272,7 +272,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 150
}
}
}
@ -283,7 +283,7 @@
"arguments": {
"filter": {},
"cursorType": "tailableAwait",
"timeoutMS": 20,
"timeoutMS": 250,
"batchSize": 1,
"maxAwaitTimeMS": 1
},
@ -354,7 +354,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}

View File

@ -17,7 +17,7 @@
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 10
"timeoutMS": 200
},
"useMultipleMongoses": false,
"observeEvents": [
@ -94,7 +94,7 @@
"find"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}
@ -154,7 +154,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 150
}
}
}
@ -165,7 +165,7 @@
"arguments": {
"filter": {},
"cursorType": "tailable",
"timeoutMS": 20,
"timeoutMS": 200,
"batchSize": 1
},
"saveResultAsEntity": "tailableCursor"
@ -239,7 +239,7 @@
"getMore"
],
"blockConnection": true,
"blockTimeMS": 15
"blockTimeMS": 250
}
}
}

View File

@ -3,7 +3,7 @@
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "4.9",
"minServerVersion": "4.4.7",
"serverless": "forbid",
"topologies": [
"single",

View File

@ -3,7 +3,7 @@
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "4.9",
"minServerVersion": "4.4.7",
"serverless": "forbid",
"topologies": [
"single",

View File

@ -3,7 +3,7 @@
"schemaVersion": "1.11",
"runOnRequirements": [
{
"minServerVersion": "4.9",
"minServerVersion": "4.4",
"serverless": "forbid",
"topologies": [
"replicaset",

View File

@ -3,7 +3,7 @@
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "4.9",
"minServerVersion": "4.4.7",
"serverless": "forbid",
"topologies": [
"single"

View File

@ -1,6 +1,6 @@
{
"description": "cursors are correctly pinned to connections for load-balanced clusters",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"topologies": [
@ -222,7 +222,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
@ -239,7 +242,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
@ -333,7 +339,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
@ -475,7 +484,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
@ -492,7 +504,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
@ -605,7 +620,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
@ -750,7 +768,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
@ -767,7 +788,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
@ -858,7 +882,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
@ -950,7 +977,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": {
"$$type": "string"
@ -1100,7 +1130,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},

View File

@ -1,6 +1,6 @@
{
"description": "state change errors are correctly handled",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"topologies": [
@ -263,7 +263,7 @@
"description": "errors during the initial connection hello are ignored",
"runOnRequirements": [
{
"minServerVersion": "4.9"
"minServerVersion": "4.4.7"
}
],
"operations": [
@ -279,7 +279,6 @@
},
"data": {
"failCommands": [
"ismaster",
"isMaster",
"hello"
],

View File

@ -1,6 +1,6 @@
{
"description": "transactions are correctly pinned to connections for load-balanced clusters",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"topologies": [

View File

@ -413,7 +413,7 @@ class TestPooling(_TestPoolingBase):
# maxConnecting = unbounded: 30+ connections in ~0.140+ seconds
print(len(pool.conns))
@client_context.require_failCommand_fail_point
@client_context.require_failCommand_appName
def test_csot_timeout_message(self):
client = rs_or_single_client(appName="connectionTimeoutApp")
self.addCleanup(client.close)
@ -438,7 +438,7 @@ class TestPooling(_TestPoolingBase):
self.assertTrue("(configured timeouts: timeoutMS: 500.0ms" in str(error.exception))
@client_context.require_failCommand_fail_point
@client_context.require_failCommand_appName
def test_socket_timeout_message(self):
client = rs_or_single_client(socketTimeoutMS=500, appName="connectionTimeoutApp")
self.addCleanup(client.close)
@ -465,10 +465,7 @@ class TestPooling(_TestPoolingBase):
in str(error.exception)
)
@client_context.require_failCommand_fail_point
@client_context.require_version_min(
4, 9, 0
) # configureFailPoint does not allow failure on handshake before 4.9, fixed in SERVER-49336
@client_context.require_failCommand_appName
def test_connection_timeout_message(self):
# Mock a connection creation failing due to timeout.
mock_connection_timeout = {

View File

@ -141,7 +141,6 @@ class TestStreamingProtocol(IntegrationTest):
self.assertEqual(1, len(events))
self.assertGreater(events[0].new_description.round_trip_time, 0)
@client_context.require_version_min(4, 9, -1)
@client_context.require_failCommand_appName
def test_monitor_waits_after_server_check_error(self):
# This test implements: