Skip to content

test(NODE-4605, NODE-4597, NODE-4618): sync latest change stream unified tests #3402

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 3 commits into from
Sep 12, 2022
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
Original file line number Diff line number Diff line change
@@ -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
}
}
}
]
}
]
}
40 changes: 40 additions & 0 deletions test/spec/change-streams/unified/change-streams-clusterTime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
description: "change-streams-clusterTime"
schemaVersion: "1.3"
createEntities:
- client:
id: &client0 client0
useMultipleMongoses: false
- database:
id: &database0 database0
client: *client0
databaseName: *database0
- collection:
id: &collection0 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 changeStream0
- name: insertOne
object: *collection0
arguments:
document: { _id: 1 }
- name: iterateUntilDocumentOrError
object: *changeStream0
expectResult:
ns: { db: *database0, coll: *collection0 }
clusterTime: { $$exists: true }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "disambiguatedPaths",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"createEntities": [
{
"client": {
Expand Down Expand Up @@ -31,7 +31,8 @@
"sharded-replicaset",
"load-balanced",
"sharded"
]
],
"serverless": "forbid"
}
],
"initialData": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: "disambiguatedPaths"
schemaVersion: "1.3"
schemaVersion: "1.4"
createEntities:
- client:
id: &client0 client0
Expand All @@ -16,6 +16,7 @@ createEntities:
runOnRequirements:
- minServerVersion: "6.1.0"
topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ]
serverless: forbid

initialData:
- collectionName: *collection0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,15 @@
"name": "createChangeStream",
"object": "collection0",
"arguments": {
"pipeline": [],
"pipeline": [
{
"$match": {
"operationType": {
"$ne": "create"
}
}
}
],
"showExpandedEvents": true
},
"saveResultAsEntity": "changeStream0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ tests:
- name: createChangeStream
object: *collection0
arguments:
pipeline: []
pipeline:
# On sharded clusters, the create command run when loading initial
# data sometimes is still reported in the change stream. To avoid
# this, we exclude the create command when creating the change
# stream, but specifically don't exclude other events to still catch
# driver errors.
- $match:
operationType:
$ne: create
showExpandedEvents: true
saveResultAsEntity: &changeStream0 changeStream0
- name: createIndex
Expand Down