diff --git a/source/crud/tests/unified/aggregate.json b/source/crud/tests/unified/aggregate.json new file mode 100644 index 0000000000..7d7d592d50 --- /dev/null +++ b/source/crud/tests/unified/aggregate.json @@ -0,0 +1,150 @@ +{ + "description": "aggregate", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "aggregate-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "aggregate-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "aggregate with multiple batches works", + "operations": [ + { + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "batchSize": 1 + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "cursor": { + "batchSize": 1 + } + }, + "commandName": "aggregate", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 1 + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 1 + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + } + ] + } + ] + } + ] +} diff --git a/source/crud/tests/unified/aggregate.yml b/source/crud/tests/unified/aggregate.yml new file mode 100644 index 0000000000..f27009a8b9 --- /dev/null +++ b/source/crud/tests/unified/aggregate.yml @@ -0,0 +1,64 @@ +description: "aggregate" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true # ensure cursors pin to a single server + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name aggregate-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + +tests: + - description: "aggregate with multiple batches works" + operations: + - name: aggregate + arguments: + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + batchSize: 1 + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + cursor: { batchSize: 1 } + commandName: aggregate + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 1 + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 1 + commandName: getMore + databaseName: *database0Name + diff --git a/source/crud/tests/unified/find.json b/source/crud/tests/unified/find.json new file mode 100644 index 0000000000..275d5d351a --- /dev/null +++ b/source/crud/tests/unified/find.json @@ -0,0 +1,156 @@ +{ + "description": "find", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "find-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "find-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "tests": [ + { + "description": "find with multiple batches works", + "operations": [ + { + "name": "find", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "commandName": "find", + "databaseName": "find-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "find-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "find-tests" + } + } + ] + } + ] + } + ] +} diff --git a/source/crud/tests/unified/find.yml b/source/crud/tests/unified/find.yml new file mode 100644 index 0000000000..5615f07234 --- /dev/null +++ b/source/crud/tests/unified/find.yml @@ -0,0 +1,68 @@ +description: "find" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true # ensure cursors pin to a single server + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name find-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + +tests: + - description: "find with multiple batches works" + operations: + - name: find + arguments: + filter: { _id: { $gt: 1 } } + batchSize: 2 + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: { _id: { $gt: 1 } } + batchSize: 2 + commandName: find + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 0e4a2c6ae0..d26e6fc902 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -78,6 +78,18 @@ Each YAML file has the following keys: and "sharded". If this field is omitted, the default is all topologies (i.e. ``["single", "replicaset", "sharded"]``). + - ``serverless``: Optional string. Whether or not the test should be run on + serverless instances imitating sharded clusters. Valid values are "require", + "forbid", and "allow". If "require", the test MUST only be run on serverless + instances. If "forbid", the test MUST NOT be run on serverless instances. If + omitted or "allow", this option has no effect. + + The test runner MUST be informed whether or not serverless is being used in + order to determine if this requirement is met (e.g. through an environment + variable or configuration option). Since the serverless proxy imitates a + mongos, the runner is not capable of determining this by issuing a server + command such as ``buildInfo`` or ``hello``. + - ``database_name`` and ``collection_name``: Optional. The database and collection to use for testing. diff --git a/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.json b/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.json index cf6c230ec8..8f670e2a4f 100644 --- a/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.json +++ b/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.7", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.yml b/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.yml index 50ca49dff7..1b8bc8c71f 100644 --- a/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.yml +++ b/source/retryable-reads/tests/changeStreams-client.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/source/retryable-reads/tests/changeStreams-client.watch.json b/source/retryable-reads/tests/changeStreams-client.watch.json index 9a2ccad095..d24c07c68d 100644 --- a/source/retryable-reads/tests/changeStreams-client.watch.json +++ b/source/retryable-reads/tests/changeStreams-client.watch.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.7", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/source/retryable-reads/tests/changeStreams-client.watch.yml b/source/retryable-reads/tests/changeStreams-client.watch.yml index 865619e721..bb5c49f326 100644 --- a/source/retryable-reads/tests/changeStreams-client.watch.yml +++ b/source/retryable-reads/tests/changeStreams-client.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.json b/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.json index eb7df1e264..868eaad4b0 100644 --- a/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.json +++ b/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.7", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.yml b/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.yml index 3926db122c..82637513b5 100644 --- a/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.yml +++ b/source/retryable-reads/tests/changeStreams-db.coll.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/source/retryable-reads/tests/changeStreams-db.coll.watch.json b/source/retryable-reads/tests/changeStreams-db.coll.watch.json index 3408c84236..d29137afa6 100644 --- a/source/retryable-reads/tests/changeStreams-db.coll.watch.json +++ b/source/retryable-reads/tests/changeStreams-db.coll.watch.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.7", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/source/retryable-reads/tests/changeStreams-db.coll.watch.yml b/source/retryable-reads/tests/changeStreams-db.coll.watch.yml index bffa40b5bd..2603076935 100644 --- a/source/retryable-reads/tests/changeStreams-db.coll.watch.yml +++ b/source/retryable-reads/tests/changeStreams-db.coll.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.json b/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.json index e070f56a01..b6f933b815 100644 --- a/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.json +++ b/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.7", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.yml b/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.yml index f8e6de7674..2a323eb300 100644 --- a/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.yml +++ b/source/retryable-reads/tests/changeStreams-db.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/source/retryable-reads/tests/changeStreams-db.watch.json b/source/retryable-reads/tests/changeStreams-db.watch.json index bec09c49b7..d24409d10d 100644 --- a/source/retryable-reads/tests/changeStreams-db.watch.json +++ b/source/retryable-reads/tests/changeStreams-db.watch.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.7", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/source/retryable-reads/tests/changeStreams-db.watch.yml b/source/retryable-reads/tests/changeStreams-db.watch.yml index b180114618..a8c3f6a738 100644 --- a/source/retryable-reads/tests/changeStreams-db.watch.yml +++ b/source/retryable-reads/tests/changeStreams-db.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/source/transactions/tests/README.rst b/source/transactions/tests/README.rst index 66cc823c77..a1b27dcf01 100644 --- a/source/transactions/tests/README.rst +++ b/source/transactions/tests/README.rst @@ -112,6 +112,18 @@ Each YAML file has the following keys: and "sharded". If this field is omitted, the default is all topologies (i.e. ``["single", "replicaset", "sharded"]``). + - ``serverless``: Optional string. Whether or not the test should be run on + serverless instances imitating sharded clusters. Valid values are "require", + "forbid", and "allow". If "require", the test MUST only be run on serverless + instances. If "forbid", the test MUST NOT be run on serverless instances. If + omitted or "allow", this option has no effect. + + The test runner MUST be informed whether or not serverless is being used in + order to determine if this requirement is met (e.g. through an environment + variable or configuration option). Since the serverless proxy imitates a + mongos, the runner is not capable of determining this by issuing a server + command such as ``buildInfo`` or ``hello``. + - ``database_name`` and ``collection_name``: The database and collection to use for testing. diff --git a/source/transactions/tests/legacy/error-labels.json b/source/transactions/tests/legacy/error-labels.json index 2d3eed3ccc..f23be6ac92 100644 --- a/source/transactions/tests/legacy/error-labels.json +++ b/source/transactions/tests/legacy/error-labels.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/source/transactions/tests/legacy/error-labels.yml b/source/transactions/tests/legacy/error-labels.yml index 3fc36c8f0c..f0cfebf172 100644 --- a/source/transactions/tests/legacy/error-labels.yml +++ b/source/transactions/tests/legacy/error-labels.yml @@ -5,6 +5,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/source/transactions/tests/legacy/mongos-pin-auto-tests.py b/source/transactions/tests/legacy/mongos-pin-auto-tests.py index b035c43689..1072ec2907 100644 --- a/source/transactions/tests/legacy/mongos-pin-auto-tests.py +++ b/source/transactions/tests/legacy/mongos-pin-auto-tests.py @@ -17,6 +17,9 @@ - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/source/transactions/tests/legacy/mongos-pin-auto.json b/source/transactions/tests/legacy/mongos-pin-auto.json index f6ede52687..037f212f49 100644 --- a/source/transactions/tests/legacy/mongos-pin-auto.json +++ b/source/transactions/tests/legacy/mongos-pin-auto.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/source/transactions/tests/legacy/mongos-pin-auto.yml b/source/transactions/tests/legacy/mongos-pin-auto.yml index f2b84ac8de..7e2e3e4453 100644 --- a/source/transactions/tests/legacy/mongos-pin-auto.yml +++ b/source/transactions/tests/legacy/mongos-pin-auto.yml @@ -4,6 +4,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/source/transactions/tests/legacy/mongos-recovery-token.json b/source/transactions/tests/legacy/mongos-recovery-token.json index 35ef45a039..3294628f20 100644 --- a/source/transactions/tests/legacy/mongos-recovery-token.json +++ b/source/transactions/tests/legacy/mongos-recovery-token.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/source/transactions/tests/legacy/mongos-recovery-token.yml b/source/transactions/tests/legacy/mongos-recovery-token.yml index 94f32b1d34..28334be177 100644 --- a/source/transactions/tests/legacy/mongos-recovery-token.yml +++ b/source/transactions/tests/legacy/mongos-recovery-token.yml @@ -2,6 +2,8 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't use recovery tokens + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/source/transactions/tests/legacy/pin-mongos.json b/source/transactions/tests/legacy/pin-mongos.json index 8e9d049d04..d089755869 100644 --- a/source/transactions/tests/legacy/pin-mongos.json +++ b/source/transactions/tests/legacy/pin-mongos.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/source/transactions/tests/legacy/pin-mongos.yml b/source/transactions/tests/legacy/pin-mongos.yml index b611e5003a..c1e40d42f7 100644 --- a/source/transactions/tests/legacy/pin-mongos.yml +++ b/source/transactions/tests/legacy/pin-mongos.yml @@ -16,6 +16,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/source/transactions/tests/unified/mongos-unpin.json b/source/transactions/tests/unified/mongos-unpin.json index 33127198a8..012d1dca85 100644 --- a/source/transactions/tests/unified/mongos-unpin.json +++ b/source/transactions/tests/unified/mongos-unpin.json @@ -1,6 +1,6 @@ { "description": "mongos-unpin", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.2", @@ -50,6 +50,11 @@ "tests": [ { "description": "unpin after TransientTransctionError error on commit", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "startTransaction", @@ -138,6 +143,11 @@ }, { "description": "unpin after TransientTransctionError error on abort", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "startTransaction", diff --git a/source/transactions/tests/unified/mongos-unpin.yml b/source/transactions/tests/unified/mongos-unpin.yml index a5d1ecdecc..26632eeb25 100644 --- a/source/transactions/tests/unified/mongos-unpin.yml +++ b/source/transactions/tests/unified/mongos-unpin.yml @@ -1,6 +1,6 @@ description: mongos-unpin -schemaVersion: '1.1' +schemaVersion: '1.4' runOnRequirements: - minServerVersion: '4.2' @@ -34,6 +34,10 @@ _yamlAnchors: tests: - description: unpin after TransientTransctionError error on commit + runOnRequirements: + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + - serverless: "forbid" operations: - &startTransaction name: startTransaction @@ -77,6 +81,10 @@ tests: - *assertNoPinnedServer - description: unpin after TransientTransctionError error on abort + runOnRequirements: + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + - serverless: "forbid" operations: - *startTransaction - *insertOne diff --git a/source/unified-test-format/schema-1.3.json b/source/unified-test-format/schema-1.4.json similarity index 99% rename from source/unified-test-format/schema-1.3.json rename to source/unified-test-format/schema-1.4.json index 3b042d0e13..b5f9f38eee 100644 --- a/source/unified-test-format/schema-1.3.json +++ b/source/unified-test-format/schema-1.4.json @@ -55,6 +55,10 @@ "enum": ["single", "replicaset", "sharded", "sharded-replicaset", "load-balanced"] } }, + "serverless": { + "type": "string", + "enum": ["require", "forbid", "allow"] + }, "serverParameters": { "type": "object", "minProperties": 1 diff --git a/source/unified-test-format/tests/Makefile b/source/unified-test-format/tests/Makefile index cf84e8b783..7f610dccf1 100644 --- a/source/unified-test-format/tests/Makefile +++ b/source/unified-test-format/tests/Makefile @@ -1,4 +1,4 @@ -SCHEMA=../schema-1.3.json +SCHEMA=../schema-1.4.json .PHONY: all invalid valid-fail valid-pass versioned-api load-balancers gridfs transactions HAS_AJV diff --git a/source/unified-test-format/tests/invalid/runOnRequirement-serverless-enum.json b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-enum.json new file mode 100644 index 0000000000..031fa539df --- /dev/null +++ b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-enum.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-serverless-enum", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "serverless": "foo" + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/source/unified-test-format/tests/invalid/runOnRequirement-serverless-enum.yml b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-enum.yml new file mode 100644 index 0000000000..6db134500b --- /dev/null +++ b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-enum.yml @@ -0,0 +1,10 @@ +description: "runOnRequirement-serverless-enum" + +schemaVersion: "1.4" + +runOnRequirements: + - serverless: "foo" + +tests: + - description: "foo" + operations: [] diff --git a/source/unified-test-format/tests/invalid/runOnRequirement-serverless-type.json b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-type.json new file mode 100644 index 0000000000..1aa41712f9 --- /dev/null +++ b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-type.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-serverless-type", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "serverless": 1234 + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/source/unified-test-format/tests/invalid/runOnRequirement-serverless-type.yml b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-type.yml new file mode 100644 index 0000000000..82a7ed31d5 --- /dev/null +++ b/source/unified-test-format/tests/invalid/runOnRequirement-serverless-type.yml @@ -0,0 +1,10 @@ +description: runOnRequirement-serverless-type + +schemaVersion: '1.4' + +runOnRequirements: + - serverless: 1234 + +tests: + - description: foo + operations: [] diff --git a/source/unified-test-format/tests/valid-pass/poc-crud.json b/source/unified-test-format/tests/valid-pass/poc-crud.json index 2ed86d6150..68dffab593 100644 --- a/source/unified-test-format/tests/valid-pass/poc-crud.json +++ b/source/unified-test-format/tests/valid-pass/poc-crud.json @@ -1,6 +1,6 @@ { "description": "poc-crud", - "schemaVersion": "1.0", + "schemaVersion": "1.4", "createEntities": [ { "client": { @@ -406,7 +406,8 @@ "description": "Aggregate with $listLocalSessions", "runOnRequirements": [ { - "minServerVersion": "3.6.0" + "minServerVersion": "3.6.0", + "serverless": "forbid" } ], "operations": [ diff --git a/source/unified-test-format/tests/valid-pass/poc-crud.yml b/source/unified-test-format/tests/valid-pass/poc-crud.yml index 7d101a077a..cc29f9cb2b 100644 --- a/source/unified-test-format/tests/valid-pass/poc-crud.yml +++ b/source/unified-test-format/tests/valid-pass/poc-crud.yml @@ -1,6 +1,6 @@ description: "poc-crud" -schemaVersion: "1.0" +schemaVersion: "1.4" createEntities: - client: @@ -170,6 +170,9 @@ tests: - description: "Aggregate with $listLocalSessions" runOnRequirements: - minServerVersion: "3.6.0" + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + serverless: forbid operations: - name: aggregate object: *database1 diff --git a/source/unified-test-format/unified-test-format.rst b/source/unified-test-format/unified-test-format.rst index cc2117bace..15ab46aeb3 100644 --- a/source/unified-test-format/unified-test-format.rst +++ b/source/unified-test-format/unified-test-format.rst @@ -3,13 +3,13 @@ Unified Test Format =================== :Spec Title: Unified Test Format -:Spec Version: 1.3.0 +:Spec Version: 1.4.0 :Author: Jeremy Mikola :Advisors: Prashant Mital, Isabel Atkinson, Thomas Reggi :Status: Accepted :Type: Standards :Minimum Server Version: N/A -:Last Modified: 2021-04-12 +:Last Modified: 2021-04-19 .. contents:: @@ -391,6 +391,18 @@ The structure of this object is as follows: "sharded" topology, test runners MUST accept any type of sharded cluster (i.e. "sharded" implies "sharded-replicaset", but not vice versa). +- ``serverless``: Optional string. Whether or not the test should be run on + serverless instances imitating sharded clusters. Valid values are "require", + "forbid", and "allow". If "require", the test MUST only be run on serverless + instances. If "forbid", the test MUST NOT be run on serverless instances. If + omitted or "allow", this option has no effect. + + The test runner MUST be informed whether or not serverless is being used in + order to determine if this requirement is met (e.g. through an environment + variable or configuration option). Since the serverless proxy imitates a + mongos, the runner is not capable of determining this by issuing a server + command such as ``buildInfo`` or ``hello``. + - ``serverParameters``: Optional object of server parameters to check against. To check server parameters, drivers send a ``{ getParameter: 1, : 1 }`` command to the server using the @@ -3200,6 +3212,8 @@ spec changes developed in parallel or during the same release cycle. Change Log ========== +:2021-04-19: Introduce ``serverless`` `runOnRequirement`_. + :2021-04-12: Added a ``FindCursor`` entity type, defined a set of cursor operations, added an ``auth`` property to ``runOnRequirements`` and modified the ``topologies`` property to accept diff --git a/source/versioned-api/tests/crud-api-version-1-strict.json b/source/versioned-api/tests/crud-api-version-1-strict.json index 2705b505a8..06738d361e 100644 --- a/source/versioned-api/tests/crud-api-version-1-strict.json +++ b/source/versioned-api/tests/crud-api-version-1-strict.json @@ -1,6 +1,6 @@ { "description": "CRUD Api Version 1 (strict)", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.9" @@ -141,6 +141,11 @@ }, { "description": "aggregate on database appends declared API version", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "aggregate", diff --git a/source/versioned-api/tests/crud-api-version-1-strict.yml b/source/versioned-api/tests/crud-api-version-1-strict.yml index 83b72f756a..9953025248 100644 --- a/source/versioned-api/tests/crud-api-version-1-strict.yml +++ b/source/versioned-api/tests/crud-api-version-1-strict.yml @@ -1,6 +1,6 @@ description: "CRUD Api Version 1 (strict)" -schemaVersion: "1.1" +schemaVersion: "1.4" runOnRequirements: - minServerVersion: "4.9" @@ -62,6 +62,10 @@ tests: <<: *expectedApiVersion - description: "aggregate on database appends declared API version" + runOnRequirements: + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + - serverless: "forbid" operations: - name: aggregate object: *adminDatabase diff --git a/source/versioned-api/tests/crud-api-version-1.json b/source/versioned-api/tests/crud-api-version-1.json index 9171858376..c5ad97dbf4 100644 --- a/source/versioned-api/tests/crud-api-version-1.json +++ b/source/versioned-api/tests/crud-api-version-1.json @@ -1,6 +1,6 @@ { "description": "CRUD Api Version 1", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.9" @@ -141,6 +141,11 @@ }, { "description": "aggregate on database appends declared API version", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "aggregate", diff --git a/source/versioned-api/tests/crud-api-version-1.yml b/source/versioned-api/tests/crud-api-version-1.yml index 3c72e079de..a2b75307f6 100644 --- a/source/versioned-api/tests/crud-api-version-1.yml +++ b/source/versioned-api/tests/crud-api-version-1.yml @@ -1,6 +1,6 @@ description: "CRUD Api Version 1" -schemaVersion: "1.1" +schemaVersion: "1.4" runOnRequirements: - minServerVersion: "4.9" @@ -64,6 +64,10 @@ tests: <<: *expectedApiVersion - description: "aggregate on database appends declared API version" + runOnRequirements: + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + - serverless: forbid operations: - name: aggregate object: *adminDatabase diff --git a/source/versioned-api/tests/runcommand-helper-no-api-version-declared.json b/source/versioned-api/tests/runcommand-helper-no-api-version-declared.json index e901887e4c..17e0126d10 100644 --- a/source/versioned-api/tests/runcommand-helper-no-api-version-declared.json +++ b/source/versioned-api/tests/runcommand-helper-no-api-version-declared.json @@ -1,6 +1,6 @@ { "description": "RunCommand helper: No API version declared", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.9", @@ -29,6 +29,11 @@ "tests": [ { "description": "runCommand does not inspect or change the command document", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "runCommand", @@ -72,6 +77,11 @@ }, { "description": "runCommand does not prevent sending invalid API version declarations", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "runCommand", diff --git a/source/versioned-api/tests/runcommand-helper-no-api-version-declared.yml b/source/versioned-api/tests/runcommand-helper-no-api-version-declared.yml index c735a32a3c..c17481ab1e 100644 --- a/source/versioned-api/tests/runcommand-helper-no-api-version-declared.yml +++ b/source/versioned-api/tests/runcommand-helper-no-api-version-declared.yml @@ -1,6 +1,6 @@ description: "RunCommand helper: No API version declared" -schemaVersion: "1.1" +schemaVersion: "1.4" runOnRequirements: - minServerVersion: "4.9" @@ -19,6 +19,10 @@ createEntities: tests: - description: "runCommand does not inspect or change the command document" + runOnRequirements: + # serverless does not currently reject invalid API versions on + # certain commands (CLOUDP-87926) + - serverless: "forbid" operations: - name: runCommand object: *database @@ -43,6 +47,10 @@ tests: databaseName: *databaseName - description: "runCommand does not prevent sending invalid API version declarations" + runOnRequirements: + # serverless does not currently reject invalid API versions on + # certain commands (CLOUDP-87926) + - serverless: "forbid" operations: - name: runCommand object: *database diff --git a/source/versioned-api/tests/test-commands-strict-mode.json b/source/versioned-api/tests/test-commands-strict-mode.json index 1705ba7bff..9c4ebea785 100644 --- a/source/versioned-api/tests/test-commands-strict-mode.json +++ b/source/versioned-api/tests/test-commands-strict-mode.json @@ -1,12 +1,13 @@ { "description": "Test commands: strict mode", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.9", "serverParameters": { "enableTestCommands": true - } + }, + "serverless": "forbid" } ], "createEntities": [ diff --git a/source/versioned-api/tests/test-commands-strict-mode.yml b/source/versioned-api/tests/test-commands-strict-mode.yml index d7c2c15641..f53b6e6a2f 100644 --- a/source/versioned-api/tests/test-commands-strict-mode.yml +++ b/source/versioned-api/tests/test-commands-strict-mode.yml @@ -1,11 +1,13 @@ description: "Test commands: strict mode" -schemaVersion: "1.1" +schemaVersion: "1.4" runOnRequirements: - minServerVersion: "4.9" serverParameters: enableTestCommands: true + # serverless gives a different error for unrecognized testVersion2 command + serverless: "forbid" createEntities: - client: