Skip to content

Sync valid-pass/valid-fail tests from unified test specification #1517

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
Oct 10, 2024
Merged
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,36 @@
{
"description": "kmsProviders-missing_aws_kms_credentials",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"aws": {
"accessKeyId": "accessKeyId"
}
}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"description": "kmsProviders-missing_azure_kms_credentials",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"azure": {
"tenantId": "tenantId"
}
}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"description": "kmsProviders-missing_gcp_kms_credentials",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"gcp": {
"email": "email"
}
}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"description": "clientEncryptionOpts-no_kms",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"description": "collectionData-createOptions",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"serverless": "forbid"
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "database0",
"createOptions": {
"capped": true,
"size": 4096
},
"documents": [
{
"_id": 1,
"x": 11
}
]
}
],
"tests": [
{
"description": "collection is created with the correct options",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$collStats": {
"storageStats": {}
}
},
{
"$project": {
"capped": "$storageStats.capped",
"maxSize": "$storageStats.maxSize"
}
}
]
},
"expectResult": [
{
"capped": true,
"maxSize": 4096
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"description": "createEntities-operation",
"schemaVersion": "1.9",
"tests": [
{
"description": "createEntities operation",
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client1",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database1",
"client": "client1",
"databaseName": "database1"
}
},
{
"collection": {
"id": "collection1",
"database": "database1",
"collectionName": "coll1"
}
}
]
}
},
{
"name": "deleteOne",
"object": "collection1",
"arguments": {
"filter": {
"_id": 1
}
}
}
],
"expectEvents": [
{
"client": "client1",
"events": [
{
"commandStartedEvent": {
"command": {
"delete": "coll1",
"deletes": [
{
"q": {
"_id": 1
},
"limit": 1
}
]
},
"commandName": "delete",
"databaseName": "database1"
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
{
"description": "entity-commandCursor",
"schemaVersion": "1.3",
"createEntities": [
{
"client": {
"id": "client",
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "db",
"client": "client",
"databaseName": "db"
}
},
{
"collection": {
"id": "collection",
"database": "db",
"collectionName": "collection"
}
}
],
"initialData": [
{
"collectionName": "collection",
"databaseName": "db",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
}
]
}
],
"tests": [
{
"description": "runCursorCommand creates and exhausts cursor by running getMores",
"operations": [
{
"name": "runCursorCommand",
"object": "db",
"arguments": {
"commandName": "find",
"batchSize": 2,
"command": {
"find": "collection",
"filter": {},
"batchSize": 2
}
},
"expectResult": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
}
]
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "collection",
"filter": {},
"batchSize": 2,
"$db": "db",
"lsid": {
"$$exists": true
}
},
"commandName": "find"
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "collection",
"$db": "db",
"lsid": {
"$$exists": true
}
},
"commandName": "getMore"
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "collection",
"$db": "db",
"lsid": {
"$$exists": true
}
},
"commandName": "getMore"
}
}
]
}
]
},
{
"description": "createCommandCursor creates a cursor and stores it as an entity that can be iterated one document at a time",
"operations": [
{
"name": "createCommandCursor",
"object": "db",
"arguments": {
"commandName": "find",
"batchSize": 2,
"command": {
"find": "collection",
"filter": {},
"batchSize": 2
}
},
"saveResultAsEntity": "myRunCommandCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "myRunCommandCursor",
"expectResult": {
"_id": 1,
"x": 11
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "myRunCommandCursor",
"expectResult": {
"_id": 2,
"x": 22
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "myRunCommandCursor",
"expectResult": {
"_id": 3,
"x": 33
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "myRunCommandCursor",
"expectResult": {
"_id": 4,
"x": 44
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "myRunCommandCursor",
"expectResult": {
"_id": 5,
"x": 55
}
}
]
},
{
"description": "createCommandCursor's cursor can be closed and will perform a killCursors operation",
"operations": [
{
"name": "createCommandCursor",
"object": "db",
"arguments": {
"commandName": "find",
"batchSize": 2,
"command": {
"find": "collection",
"filter": {},
"batchSize": 2
}
},
"saveResultAsEntity": "myRunCommandCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "myRunCommandCursor",
"expectResult": {
"_id": 1,
"x": 11
}
},
{
"name": "close",
"object": "myRunCommandCursor"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "collection",
"filter": {},
"batchSize": 2,
"$db": "db",
"lsid": {
"$$exists": true
}
},
"commandName": "find"
}
},
{
"commandStartedEvent": {
"command": {
"killCursors": "collection",
"cursors": {
"$$type": "array"
}
},
"commandName": "killCursors"
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"description": "entity-cursor-iterateOnce",
"schemaVersion": "1.9",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"databaseName": "database0",
"collectionName": "coll0",
"documents": [
{
"_id": 1
},
{
"_id": 2
},
{
"_id": 3
}
]
}
],
"tests": [
{
"description": "iterateOnce",
"operations": [
{
"name": "createFindCursor",
"object": "collection0",
"arguments": {
"filter": {},
"batchSize": 2
},
"saveResultAsEntity": "cursor0"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0",
"expectResult": {
"_id": 1
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0",
"expectResult": {
"_id": 2
}
},
{
"name": "iterateOnce",
"object": "cursor0"
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {},
"batchSize": 2
},
"commandName": "find",
"databaseName": "database0"
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
"commandName": "getMore"
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -109,7 +109,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"ns": {
"$$type": "string"
@@ -126,7 +129,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
@@ -138,7 +144,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"ns": {
"$$type": "string"
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"description": "expectedEventsForClient-topologyDescriptionChangedEvent",
"schemaVersion": "1.20",
"runOnRequirements": [
{
"topologies": [
"replicaset"
],
"minServerVersion": "4.4"
}
],
"tests": [
{
"description": "can assert on values of newDescription and previousDescription fields",
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"uriOptions": {
"directConnection": true
},
"observeEvents": [
"topologyDescriptionChangedEvent"
]
}
}
]
}
},
{
"name": "waitForEvent",
"object": "testRunner",
"arguments": {
"client": "client",
"event": {
"topologyDescriptionChangedEvent": {}
},
"count": 1
}
}
],
"expectEvents": [
{
"client": "client",
"eventType": "sdam",
"ignoreExtraEvents": true,
"events": [
{
"topologyDescriptionChangedEvent": {
"previousDescription": {
"type": "Unknown"
},
"newDescription": {
"type": "Single"
}
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"description": "kmsProviders-explicit_kms_credentials",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"aws": {
"accessKeyId": "accessKeyId",
"secretAccessKey": "secretAccessKey"
},
"azure": {
"tenantId": "tenantId",
"clientId": "clientId",
"clientSecret": "clientSecret"
},
"gcp": {
"email": "email",
"privateKey": "cHJpdmF0ZUtleQo="
},
"kmip": {
"endpoint": "endpoint"
},
"local": {
"key": "a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5"
}
}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"description": "kmsProviders-mixed_kms_credential_fields",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"aws": {
"accessKeyId": "accessKeyId",
"secretAccessKey": {
"$$placeholder": 1
}
},
"azure": {
"tenantId": "tenantId",
"clientId": {
"$$placeholder": 1
},
"clientSecret": {
"$$placeholder": 1
}
},
"gcp": {
"email": "email",
"privateKey": {
"$$placeholder": 1
}
}
}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"description": "kmsProviders-placeholder_kms_credentials",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"aws": {
"accessKeyId": {
"$$placeholder": 1
},
"secretAccessKey": {
"$$placeholder": 1
}
},
"azure": {
"tenantId": {
"$$placeholder": 1
},
"clientId": {
"$$placeholder": 1
},
"clientSecret": {
"$$placeholder": 1
}
},
"gcp": {
"email": {
"$$placeholder": 1
},
"privateKey": {
"$$placeholder": 1
}
},
"kmip": {
"endpoint": {
"$$placeholder": 1
}
},
"local": {
"key": {
"$$placeholder": 1
}
}
}
}
}
}
],
"tests": [
{
"description": "",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"description": "kmsProviders-unconfigured_kms",
"schemaVersion": "1.8",
"runOnRequirements": [
{
"csfle": true
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"clientEncryption": {
"id": "clientEncryption0",
"clientEncryptionOpts": {
"keyVaultClient": "client0",
"keyVaultNamespace": "keyvault.datakeys",
"kmsProviders": {
"aws": {},
"azure": {},
"gcp": {},
"kmip": {},
"local": {}
}
}
}
}
],
"tests": [
{
"description": "",
"skipReason": "DRIVERS-2280: waiting on driver support for on-demand credentials",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"description": "matches-lte-operator",
"schemaVersion": "1.9",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0Name"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "database0Name",
"documents": []
}
],
"tests": [
{
"description": "special lte matching operator",
"operations": [
{
"name": "insertOne",
"object": "collection0",
"arguments": {
"document": {
"_id": 1,
"y": 1
}
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"insert": "coll0",
"documents": [
{
"_id": {
"$$lte": 1
},
"y": {
"$$lte": 2
}
}
]
},
"commandName": "insert",
"databaseName": "database0Name"
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -322,7 +322,7 @@
"minServerVersion": "4.1.0",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
],
"serverless": "forbid"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
{
"description": "poc-retryable-writes",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"topologies": [
"replicaset"
]
}
],
"createEntities": [
{
"client": {
@@ -79,6 +71,14 @@
"tests": [
{
"description": "FindOneAndUpdate is committed on first attempt",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"topologies": [
"replicaset"
]
}
],
"operations": [
{
"name": "failPoint",
@@ -132,6 +132,14 @@
},
{
"description": "FindOneAndUpdate is not committed on first attempt",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"topologies": [
"replicaset"
]
}
],
"operations": [
{
"name": "failPoint",
@@ -188,6 +196,14 @@
},
{
"description": "FindOneAndUpdate is never committed",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"topologies": [
"replicaset"
]
}
],
"operations": [
{
"name": "failPoint",
@@ -245,15 +261,10 @@
"description": "InsertMany succeeds after PrimarySteppedDown",
"runOnRequirements": [
{
"minServerVersion": "4.0",
"topologies": [
"replicaset"
]
},
{
"minServerVersion": "4.1.7",
"minServerVersion": "4.3.1",
"topologies": [
"sharded-replicaset"
"replicaset",
"sharded"
]
}
],
@@ -345,7 +356,7 @@
{
"minServerVersion": "4.1.7",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],
@@ -406,15 +417,10 @@
"description": "InsertOne fails after multiple retryable writeConcernErrors",
"runOnRequirements": [
{
"minServerVersion": "4.0",
"topologies": [
"replicaset"
]
},
{
"minServerVersion": "4.1.7",
"minServerVersion": "4.3.1",
"topologies": [
"sharded-replicaset"
"replicaset",
"sharded"
]
}
],
@@ -433,6 +439,9 @@
"failCommands": [
"insert"
],
"errorLabels": [
"RetryableWriteError"
],
"writeConcernError": {
"code": 91,
"errmsg": "Replication is being shut down"
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@
{
"minServerVersion": "4.1.8",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
{
"minServerVersion": "4.1.8",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
{
"minServerVersion": "4.1.8",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
{
"minServerVersion": "4.1.8",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],
@@ -93,7 +93,7 @@
"minServerVersion": "4.3.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
@@ -203,7 +203,7 @@
"minServerVersion": "4.3.4",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],
Original file line number Diff line number Diff line change
@@ -31,6 +31,13 @@ protected void skips(final String fileDescription, final String testDescription)
assumeFalse(testDescription.equals("InsertOne fails after multiple retryable writeConcernErrors") && serverVersionLessThan(4, 4),
"MongoDB releases prior to 4.4 incorrectly add errorLabels as a field within the writeConcernError document "
+ "instead of as a top-level field. Rather than handle that in code, we skip the test on older server versions.");
// Feature to be implemented in scope of JAVA-5389
assumeFalse(fileDescription.equals("expectedEventsForClient-topologyDescriptionChangedEvent"));
// Feature to be implemented in scope JAVA-4862
assumeFalse(fileDescription.equals("entity-commandCursor"));
// To be investigated in JAVA-5631
assumeFalse(fileDescription.equals("kmsProviders-explicit_kms_credentials"));
assumeFalse(fileDescription.equals("kmsProviders-mixed_kms_credential_fields"));
}

private static Collection<Arguments> data() throws URISyntaxException, IOException {