From 201c8940c8681ef3717f82d12e219eb61236b393 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:26 -0500 Subject: [PATCH 01/13] Revert "CXX-3261 temporarily restrict updateDescription tests to 8.1 or older (#1365)" This reverts commit 2e9c16451ead482bf93be2763eb4a03344d5bf8f. --- .../unified/change-streams-pre_and_post_images.json | 1 - data/change-streams/unified/change-streams.json | 1 - 2 files changed, 2 deletions(-) diff --git a/data/change-streams/unified/change-streams-pre_and_post_images.json b/data/change-streams/unified/change-streams-pre_and_post_images.json index 015dc9efd1..e62fc03459 100644 --- a/data/change-streams/unified/change-streams-pre_and_post_images.json +++ b/data/change-streams/unified/change-streams-pre_and_post_images.json @@ -4,7 +4,6 @@ "runOnRequirements": [ { "minServerVersion": "6.0.0", - "maxServerVersion": "8.1.0", "topologies": [ "replicaset", "sharded", diff --git a/data/change-streams/unified/change-streams.json b/data/change-streams/unified/change-streams.json index b6484a8b2e..c8b60ed4e2 100644 --- a/data/change-streams/unified/change-streams.json +++ b/data/change-streams/unified/change-streams.json @@ -4,7 +4,6 @@ "runOnRequirements": [ { "minServerVersion": "3.6", - "maxServerVersion": "8.1", "topologies": [ "replicaset" ], From 9af8dfd2412885b7080f7b5a8a77f964e0f01fd1 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:26 -0500 Subject: [PATCH 02/13] CXX-2493 sync change streams unified spec tests with 9652564e --- .../change-streams-showExpandedEvents.json | 507 ++++++++++++++++++ 1 file changed, 507 insertions(+) create mode 100644 data/change-streams/unified/change-streams-showExpandedEvents.json diff --git a/data/change-streams/unified/change-streams-showExpandedEvents.json b/data/change-streams/unified/change-streams-showExpandedEvents.json new file mode 100644 index 0000000000..9dd6f4d04d --- /dev/null +++ b/data/change-streams/unified/change-streams-showExpandedEvents.json @@ -0,0 +1,507 @@ +{ + "description": "change-streams-showExpandedEvents", + "schemaVersion": "1.7", + "runOnRequirements": [ + { + "minServerVersion": "6.0.0", + "topologies": [ + "replicaset", + "sharded-replicaset", + "sharded" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ], + "ignoreCommandMonitoringEvents": [ + "killCursors" + ], + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + }, + { + "database": { + "id": "database1", + "client": "client0", + "databaseName": "database1" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "collection1" + } + }, + { + "database": { + "id": "shardedDb", + "client": "client0", + "databaseName": "shardedDb" + } + }, + { + "database": { + "id": "adminDb", + "client": "client0", + "databaseName": "admin" + } + }, + { + "collection": { + "id": "shardedCollection", + "database": "shardedDb", + "collectionName": "shardedCollection" + } + } + ], + "initialData": [ + { + "collectionName": "collection0", + "databaseName": "database0", + "documents": [] + } + ], + "tests": [ + { + "description": "when provided, showExpandedEvents is sent as a part of the aggregate command", + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "showExpandedEvents": true + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "when omitted, showExpandedEvents is not sent as a part of the aggregate command", + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "showExpandedEvents": { + "$$exists": false + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "when showExpandedEvents is true, new fields on change stream events are handled appropriately", + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "a": 1 + } + } + }, + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, + { + "name": "rename", + "object": "collection0", + "arguments": { + "to": "foo", + "dropTarget": true + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "collectionUUID": { + "$$exists": true + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "createIndexes", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "operationDescription": { + "$$exists": true + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "rename", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "to": { + "db": "database0", + "coll": "foo" + }, + "operationDescription": { + "dropTarget": { + "$$exists": true + }, + "to": { + "db": "database0", + "coll": "foo" + } + } + } + } + ] + }, + { + "description": "when showExpandedEvents is true, createIndex events are reported", + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "createIndexes" + } + } + ] + }, + { + "description": "when showExpandedEvents is true, dropIndexes events are reported", + "operations": [ + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "dropIndex", + "object": "collection0", + "arguments": { + "name": "x_1" + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "dropIndexes" + } + } + ] + }, + { + "description": "when showExpandedEvents is true, create events are reported", + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createChangeStream", + "object": "database0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "create" + } + } + ] + }, + { + "description": "when showExpandedEvents is true, create events on views are reported", + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createChangeStream", + "object": "database0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "foo", + "viewOn": "testName" + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "create" + } + } + ] + }, + { + "description": "when showExpandedEvents is true, modify events are reported", + "operations": [ + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_2" + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "runCommand", + "object": "database0", + "arguments": { + "command": { + "collMod": "collection0" + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "modify" + } + } + ] + }, + { + "description": "when showExpandedEvents is true, shardCollection events are reported", + "runOnRequirements": [ + { + "topologies": [ + "sharded-replicaset", + "sharded" + ] + } + ], + "operations": [ + { + "name": "dropCollection", + "object": "shardedDb", + "arguments": { + "collection": "shardedCollection" + } + }, + { + "name": "createCollection", + "object": "shardedDb", + "arguments": { + "collection": "shardedCollection" + } + }, + { + "name": "createChangeStream", + "object": "shardedCollection", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "runCommand", + "object": "adminDb", + "arguments": { + "command": { + "shardCollection": "shardedDb.shardedCollection", + "key": { + "_id": 1 + } + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "shardCollection" + } + } + ] + } + ] +} From ed957cf129664fdd933725e1a4bfb246a0c051d3 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:27 -0500 Subject: [PATCH 03/13] CXX-2493 sync change streams unified spec tests with 8da1a899 --- .../unified/change-streams-showExpandedEvents.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/change-streams/unified/change-streams-showExpandedEvents.json b/data/change-streams/unified/change-streams-showExpandedEvents.json index 9dd6f4d04d..fe852b5443 100644 --- a/data/change-streams/unified/change-streams-showExpandedEvents.json +++ b/data/change-streams/unified/change-streams-showExpandedEvents.json @@ -436,7 +436,8 @@ "arguments": { "command": { "collMod": "collection0" - } + }, + "commandName": "collMod" } }, { @@ -491,7 +492,8 @@ "key": { "_id": 1 } - } + }, + "commandName": "shardCollection" } }, { From e2cfce6885e124d1714b04fa24bb306eb4c3e9a2 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:27 -0500 Subject: [PATCH 04/13] CXX-2555 sync change streams unified spec tests with 046db449 --- .../change-streams-disambiguatedPaths.json | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 data/change-streams/unified/change-streams-disambiguatedPaths.json diff --git a/data/change-streams/unified/change-streams-disambiguatedPaths.json b/data/change-streams/unified/change-streams-disambiguatedPaths.json new file mode 100644 index 0000000000..9a639801ee --- /dev/null +++ b/data/change-streams/unified/change-streams-disambiguatedPaths.json @@ -0,0 +1,251 @@ +{ + "description": "disambiguatedPaths", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + } + ], + "runOnRequirements": [ + { + "minServerVersion": "6.1.0", + "topologies": [ + "replicaset", + "sharded-replicaset", + "load-balanced", + "sharded" + ] + } + ], + "initialData": [ + { + "collectionName": "collection0", + "databaseName": "database0", + "documents": [] + } + ], + "tests": [ + { + "description": "disambiguatedPaths is not present when showExpandedEvents is false/unset", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": { + "1": 1 + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "a.1": 2 + } + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "updateDescription": { + "updatedFields": { + "$$exists": true + }, + "removedFields": { + "$$exists": true + }, + "truncatedArrays": { + "$$exists": true + }, + "disambiguatedPaths": { + "$$exists": false + } + } + } + } + ] + }, + { + "description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": { + "1": 1 + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "a.1": 2 + } + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "updateDescription": { + "updatedFields": { + "$$exists": true + }, + "removedFields": { + "$$exists": true + }, + "truncatedArrays": { + "$$exists": true + }, + "disambiguatedPaths": { + "a.1": [ + "a", + "1" + ] + } + } + } + } + ] + }, + { + "description": "disambiguatedPaths returns array indices as integers", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": [ + { + "1": 1 + } + ] + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "a.0.1": 2 + } + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "updateDescription": { + "updatedFields": { + "$$exists": true + }, + "removedFields": { + "$$exists": true + }, + "truncatedArrays": { + "$$exists": true + }, + "disambiguatedPaths": { + "a.0.1": [ + "a", + { + "$$type": "int" + }, + "1" + ] + } + } + } + } + ] + } + ] +} From 41d69670f637383d75cda7d256a3de02795629b0 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:27 -0500 Subject: [PATCH 05/13] CXX-2570 sync change streams unified spec tests with 51741620 --- .../unified/change-streams-showExpandedEvents.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/data/change-streams/unified/change-streams-showExpandedEvents.json b/data/change-streams/unified/change-streams-showExpandedEvents.json index fe852b5443..3eed2f534a 100644 --- a/data/change-streams/unified/change-streams-showExpandedEvents.json +++ b/data/change-streams/unified/change-streams-showExpandedEvents.json @@ -275,7 +275,15 @@ "name": "createChangeStream", "object": "collection0", "arguments": { - "pipeline": [], + "pipeline": [ + { + "$match": { + "operationType": { + "$ne": "create" + } + } + } + ], "showExpandedEvents": true }, "saveResultAsEntity": "changeStream0" From d1764a18ca04cdf27beddcc03184c083792146d5 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:28 -0500 Subject: [PATCH 06/13] CXX-2571 sync change streams unified spec tests with d9a0e7b2 --- .../unified/change-streams-clusterTime.json | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 data/change-streams/unified/change-streams-clusterTime.json diff --git a/data/change-streams/unified/change-streams-clusterTime.json b/data/change-streams/unified/change-streams-clusterTime.json new file mode 100644 index 0000000000..3411d4e27e --- /dev/null +++ b/data/change-streams/unified/change-streams-clusterTime.json @@ -0,0 +1,81 @@ +{ + "description": "change-streams-clusterTime", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + } + ], + "runOnRequirements": [ + { + "minServerVersion": "4.0.0", + "topologies": [ + "replicaset", + "sharded-replicaset", + "load-balanced", + "sharded" + ] + } + ], + "initialData": [ + { + "collectionName": "collection0", + "databaseName": "database0", + "documents": [] + } + ], + "tests": [ + { + "description": "clusterTime is present", + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "ns": { + "db": "database0", + "coll": "collection0" + }, + "clusterTime": { + "$$exists": true + } + } + } + ] + } + ] +} From dfbc9cbd609243bf570222a9b432613fee968c9e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:28 -0500 Subject: [PATCH 07/13] CXX-2572 sync change streams unified spec tests with 9a8abe81 --- .../unified/change-streams-disambiguatedPaths.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/change-streams/unified/change-streams-disambiguatedPaths.json b/data/change-streams/unified/change-streams-disambiguatedPaths.json index 9a639801ee..91d8e66da2 100644 --- a/data/change-streams/unified/change-streams-disambiguatedPaths.json +++ b/data/change-streams/unified/change-streams-disambiguatedPaths.json @@ -1,6 +1,6 @@ { "description": "disambiguatedPaths", - "schemaVersion": "1.3", + "schemaVersion": "1.4", "createEntities": [ { "client": { @@ -31,7 +31,8 @@ "sharded-replicaset", "load-balanced", "sharded" - ] + ], + "serverless": "forbid" } ], "initialData": [ From 04cff596550d34586b3fe7f57edc123beb2fbd0d Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:28 -0500 Subject: [PATCH 08/13] CXX-2571 sync change streams unified spec tests with 1a3b359a --- data/change-streams/unified/change-streams-clusterTime.json | 5 +++-- .../unified/change-streams-showExpandedEvents.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/data/change-streams/unified/change-streams-clusterTime.json b/data/change-streams/unified/change-streams-clusterTime.json index 3411d4e27e..55b4ae3fbc 100644 --- a/data/change-streams/unified/change-streams-clusterTime.json +++ b/data/change-streams/unified/change-streams-clusterTime.json @@ -1,6 +1,6 @@ { "description": "change-streams-clusterTime", - "schemaVersion": "1.3", + "schemaVersion": "1.4", "createEntities": [ { "client": { @@ -31,7 +31,8 @@ "sharded-replicaset", "load-balanced", "sharded" - ] + ], + "serverless": "forbid" } ], "initialData": [ diff --git a/data/change-streams/unified/change-streams-showExpandedEvents.json b/data/change-streams/unified/change-streams-showExpandedEvents.json index 3eed2f534a..a59a818493 100644 --- a/data/change-streams/unified/change-streams-showExpandedEvents.json +++ b/data/change-streams/unified/change-streams-showExpandedEvents.json @@ -8,7 +8,8 @@ "replicaset", "sharded-replicaset", "sharded" - ] + ], + "serverless": "forbid" } ], "createEntities": [ From 4d5d8ba8d6a8fd9fd68e570ac03a1cc48ea1dbaf Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:29 -0500 Subject: [PATCH 09/13] CXX-2690 sync change streams unified spec tests with 474ddfcc --- data/change-streams/unified/change-streams-clusterTime.json | 1 - .../unified/change-streams-disambiguatedPaths.json | 1 - .../unified/change-streams-showExpandedEvents.json | 2 -- 3 files changed, 4 deletions(-) diff --git a/data/change-streams/unified/change-streams-clusterTime.json b/data/change-streams/unified/change-streams-clusterTime.json index 55b4ae3fbc..2b09e548f1 100644 --- a/data/change-streams/unified/change-streams-clusterTime.json +++ b/data/change-streams/unified/change-streams-clusterTime.json @@ -28,7 +28,6 @@ "minServerVersion": "4.0.0", "topologies": [ "replicaset", - "sharded-replicaset", "load-balanced", "sharded" ], diff --git a/data/change-streams/unified/change-streams-disambiguatedPaths.json b/data/change-streams/unified/change-streams-disambiguatedPaths.json index 91d8e66da2..e6cc5ef66e 100644 --- a/data/change-streams/unified/change-streams-disambiguatedPaths.json +++ b/data/change-streams/unified/change-streams-disambiguatedPaths.json @@ -28,7 +28,6 @@ "minServerVersion": "6.1.0", "topologies": [ "replicaset", - "sharded-replicaset", "load-balanced", "sharded" ], diff --git a/data/change-streams/unified/change-streams-showExpandedEvents.json b/data/change-streams/unified/change-streams-showExpandedEvents.json index a59a818493..b9594e0c1e 100644 --- a/data/change-streams/unified/change-streams-showExpandedEvents.json +++ b/data/change-streams/unified/change-streams-showExpandedEvents.json @@ -6,7 +6,6 @@ "minServerVersion": "6.0.0", "topologies": [ "replicaset", - "sharded-replicaset", "sharded" ], "serverless": "forbid" @@ -463,7 +462,6 @@ "runOnRequirements": [ { "topologies": [ - "sharded-replicaset", "sharded" ] } From 501ac5c59e391974ee8e6985e1027be6404873e4 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:29 -0500 Subject: [PATCH 10/13] CXX-3211 sync change streams unified spec tests with 449d0397 --- .../unified/change-streams-nsType.json | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 data/change-streams/unified/change-streams-nsType.json diff --git a/data/change-streams/unified/change-streams-nsType.json b/data/change-streams/unified/change-streams-nsType.json new file mode 100644 index 0000000000..1861c9a5e0 --- /dev/null +++ b/data/change-streams/unified/change-streams-nsType.json @@ -0,0 +1,145 @@ +{ + "description": "change-streams-nsType", + "schemaVersion": "1.7", + "runOnRequirements": [ + { + "minServerVersion": "8.1.0", + "topologies": [ + "replicaset", + "sharded" + ], + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + } + ], + "tests": [ + { + "description": "nsType is present when creating collections", + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createChangeStream", + "object": "database0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "create", + "nsType": "collection" + } + } + ] + }, + { + "description": "nsType is present when creating timeseries", + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createChangeStream", + "object": "database0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "foo", + "timeseries": { + "timeField": "time", + "metaField": "meta", + "granularity": "minutes" + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "create", + "nsType": "timeseries" + } + } + ] + }, + { + "description": "nsType is present when creating views", + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "foo" + } + }, + { + "name": "createChangeStream", + "object": "database0", + "arguments": { + "pipeline": [], + "showExpandedEvents": true + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "foo", + "viewOn": "testName" + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "create", + "nsType": "view" + } + } + ] + } + ] +} From 24cca98e02ea14d36fbceca0c13d04701e513f04 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:29 -0500 Subject: [PATCH 11/13] CXX-3261 sync change streams unified spec tests with 0aee4aad --- .../change-streams-disambiguatedPaths.json | 64 ------------------- .../unified/change-streams.json | 12 +++- 2 files changed, 11 insertions(+), 65 deletions(-) diff --git a/data/change-streams/unified/change-streams-disambiguatedPaths.json b/data/change-streams/unified/change-streams-disambiguatedPaths.json index e6cc5ef66e..a8667b5436 100644 --- a/data/change-streams/unified/change-streams-disambiguatedPaths.json +++ b/data/change-streams/unified/change-streams-disambiguatedPaths.json @@ -42,70 +42,6 @@ } ], "tests": [ - { - "description": "disambiguatedPaths is not present when showExpandedEvents is false/unset", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": { - "1": 1 - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "a.1": 2 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "updateDescription": { - "updatedFields": { - "$$exists": true - }, - "removedFields": { - "$$exists": true - }, - "truncatedArrays": { - "$$exists": true - }, - "disambiguatedPaths": { - "$$exists": false - } - } - } - } - ] - }, { "description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present", "operations": [ diff --git a/data/change-streams/unified/change-streams.json b/data/change-streams/unified/change-streams.json index c8b60ed4e2..a155d85b6e 100644 --- a/data/change-streams/unified/change-streams.json +++ b/data/change-streams/unified/change-streams.json @@ -181,7 +181,12 @@ "field": "array", "newSize": 2 } - ] + ], + "disambiguatedPaths": { + "$$unsetOrMatches": { + "$$exists": true + } + } } } } @@ -1408,6 +1413,11 @@ "$$unsetOrMatches": { "$$exists": true } + }, + "disambiguatedPaths": { + "$$unsetOrMatches": { + "$$exists": true + } } } } From 0e85f76dc9369e87934181377de5e9c8defbed0e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:29 -0500 Subject: [PATCH 12/13] Update test_files.txt --- data/change-streams/unified/test_files.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/change-streams/unified/test_files.txt b/data/change-streams/unified/test_files.txt index 7dbb53b335..e3bd673a07 100644 --- a/data/change-streams/unified/test_files.txt +++ b/data/change-streams/unified/test_files.txt @@ -1,5 +1,9 @@ +change-streams-clusterTime.json +change-streams-disambiguatedPaths.json change-streams-errors.json +change-streams-nsType.json change-streams-pre_and_post_images.json change-streams-resume-allowlist.json change-streams-resume-errorLabels.json +change-streams-showExpandedEvents.json change-streams.json From 4380e0e17389754b78f3de6d8f93f7b1ac1f3840 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 1 Apr 2025 15:58:30 -0500 Subject: [PATCH 13/13] CXX-2493 skip currently unsupported spec tests (showExpandedEvents) --- src/mongocxx/test/spec/unified_tests/runner.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mongocxx/test/spec/unified_tests/runner.cpp b/src/mongocxx/test/spec/unified_tests/runner.cpp index 4bd7e92c1e..36ead24608 100644 --- a/src/mongocxx/test/spec/unified_tests/runner.cpp +++ b/src/mongocxx/test/spec/unified_tests/runner.cpp @@ -1361,7 +1361,16 @@ TEST_CASE("CRUD unified format spec automated tests", "[unified_format_specs]") } TEST_CASE("change streams unified format spec automated tests", "[unified_format_specs]") { - run_unified_format_tests_in_env_dir("CHANGE_STREAMS_UNIFIED_TESTS_PATH"); + std::set const unsupported_tests = { + // Waiting on CXX-2493 (showExpandedEvents). + "change-streams-disambiguatedPaths.json", + // Waiting on CXX-2493 (showExpandedEvents). + "change-streams-nsType.json", + // Waiting on CXX-2493 (showExpandedEvents). + "change-streams-showExpandedEvents.json", + }; + + run_unified_format_tests_in_env_dir("CHANGE_STREAMS_UNIFIED_TESTS_PATH", unsupported_tests); } TEST_CASE("retryable reads unified format spec automated tests", "[unified_format_specs]") {