Skip to content

PYTHON-3712 Deprecate sharded-replicaset topology type and clean up redundant runOnRequirements #2232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ def is_topology_type(self, topologies):
"single",
"replicaset",
"sharded",
"sharded-replicaset",
"load-balanced",
}
if unknown:
Expand All @@ -693,16 +692,6 @@ def is_topology_type(self, topologies):
return True
if "sharded" in topologies and self.is_mongos:
return True
if "sharded-replicaset" in topologies and self.is_mongos:
shards = client_context.client.config.shards.find().to_list()
for shard in shards:
# For a 3-member RS-backed sharded cluster, shard['host']
# will be 'replicaName/ip1:port1,ip2:port2,ip3:port3'
# Otherwise it will be 'ip1:port1'
host_spec = shard["host"]
if not len(host_spec.split("/")) > 1:
return False
return True
return False

def require_cluster_type(self, topologies=None):
Expand Down
11 changes: 0 additions & 11 deletions test/asynchronous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@ async def is_topology_type(self, topologies):
"single",
"replicaset",
"sharded",
"sharded-replicaset",
"load-balanced",
}
if unknown:
Expand All @@ -695,16 +694,6 @@ async def is_topology_type(self, topologies):
return True
if "sharded" in topologies and self.is_mongos:
return True
if "sharded-replicaset" in topologies and self.is_mongos:
shards = await async_client_context.client.config.shards.find().to_list()
for shard in shards:
# For a 3-member RS-backed sharded cluster, shard['host']
# will be 'replicaName/ip1:port1,ip2:port2,ip3:port3'
# Otherwise it will be 'ip1:port1'
host_spec = shard["host"]
if not len(host_spec.split("/")) > 1:
return False
return True
return False

def require_cluster_type(self, topologies=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"minServerVersion": "4.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove "sharded-replicaset" from a .py file somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"load-balanced",
"sharded"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"minServerVersion": "6.1.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
],
Expand Down
4 changes: 2 additions & 2 deletions test/change_streams/unified/change-streams-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"minServerVersion": "4.1.11",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down Expand Up @@ -190,7 +190,7 @@
"minServerVersion": "4.2",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "6.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "3.6",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "4.3.1",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"minServerVersion": "6.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded"
]
],
"serverless": "forbid"
}
],
"createEntities": [
Expand Down Expand Up @@ -462,7 +462,6 @@
"runOnRequirements": [
{
"topologies": [
"sharded-replicaset",
"sharded"
]
}
Expand Down
138 changes: 137 additions & 1 deletion test/csot/tailable-awaitData.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
"minServerVersion": "4.4",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down Expand Up @@ -417,6 +418,141 @@
]
}
]
},
{
"description": "apply remaining timeoutMS if less than maxAwaitTimeMS",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"getMore"
],
"blockConnection": true,
"blockTimeMS": 30
}
}
}
},
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {
"_id": 1
},
"cursorType": "tailableAwait",
"batchSize": 1,
"maxAwaitTimeMS": 100,
"timeoutMS": 200
},
"saveResultAsEntity": "tailableCursor"
},
{
"name": "iterateOnce",
"object": "tailableCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "tailableCursor",
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"ignoreExtraEvents": true,
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test"
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"maxTimeMS": {
"$$lte": 100
}
}
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"maxTimeMS": {
"$$lte": 70
}
}
}
}
]
}
]
},
{
"description": "apply maxAwaitTimeMS if less than remaining timeout",
"operations": [
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {},
"cursorType": "tailableAwait",
"batchSize": 1,
"maxAwaitTimeMS": 100,
"timeoutMS": 200
},
"saveResultAsEntity": "tailableCursor"
},
{
"name": "iterateOnce",
"object": "tailableCursor"
},
{
"name": "iterateOnce",
"object": "tailableCursor"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test"
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"maxTimeMS": {
"$$lte": 100
}
}
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
{
"topologies": [
"single",
"sharded",
"sharded-replicaset"
"sharded"
],
"serverless": "forbid"
}
Expand Down
3 changes: 1 addition & 2 deletions test/run_command/unified/runCommand.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@
{
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
]
Expand Down Expand Up @@ -493,7 +492,7 @@
{
"minServerVersion": "4.2",
"topologies": [
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/sessions/driver-sessions-dirty-session-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
"minServerVersion": "4.1.8",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion test/sessions/snapshot-sessions-unsupported-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "5.0",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion test/sessions/snapshot-sessions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "5.0",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
Expand Down
16 changes: 13 additions & 3 deletions test/unified-test-format/valid-pass/operator-lte.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"arguments": {
"document": {
"_id": 1,
"y": 1
"x": 2,
"y": 3,
"z": 4
}
}
}
Expand All @@ -58,10 +60,18 @@
"documents": [
{
"_id": {
"$$lte": 1
"$$lte": 2
},
"x": {
"$$lte": 2.1
},
"y": {
"$$lte": 2
"$$lte": {
"$numberLong": "3"
}
},
"z": {
"$$lte": 4
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions test/versioned-api/transaction-handling.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "4.9",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down Expand Up @@ -92,7 +92,7 @@
{
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down Expand Up @@ -221,7 +221,7 @@
{
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down
Loading