From d92327a5bf5d40fde4a15d65e65a2c2c652a8537 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Thu, 15 Jul 2021 15:08:51 +0200 Subject: [PATCH 1/2] test: lb support spec test changes --- test/functional/change_stream_spec.test.js | 3 +- .../unified-spec-runner/operations.ts | 3 +- test/spec/change-stream/README.rst | 20 +- .../{ => legacy}/change-streams-errors.json | 8 +- .../{ => legacy}/change-streams-errors.yml | 4 +- .../change-streams-resume-errorLabels.json | 54 +- .../change-streams-resume-errorLabels.yml | 18 + .../change-streams-resume-whitelist.json | 3 +- .../change-streams-resume-whitelist.yml | 1 + .../{ => legacy}/change-streams.json | 2 +- .../{ => legacy}/change-streams.yml | 2 +- .../change-stream/unified/change-streams.json | 116 ++ .../change-stream/unified/change-streams.yml | 72 + .../initial-dns-seedlist-discovery/README.rst | 14 +- .../loadBalanced-replicaSet-errors.json | 7 + .../loadBalanced-replicaSet-errors.yml | 6 + .../loadBalanced-true-multiple-hosts.json | 7 + .../loadBalanced-true-multiple-hosts.yml | 5 + .../loadBalanced-true-txt.json | 13 + .../loadBalanced-true-txt.yml | 10 + test/spec/load-balancers/README.rst | 68 + test/spec/load-balancers/cursors.json | 1228 +++++++++++++ test/spec/load-balancers/cursors.yml | 503 ++++++ .../spec/load-balancers/event-monitoring.json | 184 ++ test/spec/load-balancers/event-monitoring.yml | 99 + .../lb-connection-establishment.json | 58 + .../lb-connection-establishment.yml | 36 + .../non-lb-connection-establishment.json | 92 + .../non-lb-connection-establishment.yml | 56 + .../load-balancers/sdam-error-handling.json | 508 ++++++ .../load-balancers/sdam-error-handling.yml | 270 +++ .../spec/load-balancers/server-selection.json | 82 + test/spec/load-balancers/server-selection.yml | 50 + test/spec/load-balancers/transactions.json | 1606 +++++++++++++++++ test/spec/load-balancers/transactions.yml | 592 ++++++ .../load-balancers/wait-queue-timeouts.json | 153 ++ .../load-balancers/wait-queue-timeouts.yml | 82 + test/spec/retryable-reads/README.rst | 23 +- .../aggregate-serverErrors.json | 3 +- .../aggregate-serverErrors.yml | 2 +- test/spec/retryable-reads/aggregate.json | 3 +- test/spec/retryable-reads/aggregate.yml | 2 +- ...angeStreams-client.watch-serverErrors.json | 3 +- ...hangeStreams-client.watch-serverErrors.yml | 2 +- .../changeStreams-client.watch.json | 3 +- .../changeStreams-client.watch.yml | 2 +- ...ngeStreams-db.coll.watch-serverErrors.json | 3 +- ...angeStreams-db.coll.watch-serverErrors.yml | 2 +- .../changeStreams-db.coll.watch.json | 3 +- .../changeStreams-db.coll.watch.yml | 2 +- .../changeStreams-db.watch-serverErrors.json | 3 +- .../changeStreams-db.watch-serverErrors.yml | 2 +- .../changeStreams-db.watch.json | 3 +- .../changeStreams-db.watch.yml | 2 +- .../retryable-reads/count-serverErrors.json | 3 +- .../retryable-reads/count-serverErrors.yml | 2 +- test/spec/retryable-reads/count.json | 3 +- test/spec/retryable-reads/count.yml | 2 +- .../countDocuments-serverErrors.json | 3 +- .../countDocuments-serverErrors.yml | 2 +- test/spec/retryable-reads/countDocuments.json | 3 +- test/spec/retryable-reads/countDocuments.yml | 2 +- .../distinct-serverErrors.json | 3 +- .../retryable-reads/distinct-serverErrors.yml | 2 +- test/spec/retryable-reads/distinct.json | 3 +- test/spec/retryable-reads/distinct.yml | 2 +- .../retryable-reads/find-serverErrors.json | 3 +- .../retryable-reads/find-serverErrors.yml | 2 +- test/spec/retryable-reads/find.json | 3 +- test/spec/retryable-reads/find.yml | 2 +- .../retryable-reads/findOne-serverErrors.json | 3 +- .../retryable-reads/findOne-serverErrors.yml | 2 +- test/spec/retryable-reads/findOne.json | 3 +- test/spec/retryable-reads/findOne.yml | 2 +- .../gridfs-download-serverErrors.json | 3 +- .../gridfs-download-serverErrors.yml | 2 +- .../spec/retryable-reads/gridfs-download.json | 3 +- test/spec/retryable-reads/gridfs-download.yml | 2 +- .../gridfs-downloadByName-serverErrors.json | 3 +- .../gridfs-downloadByName-serverErrors.yml | 2 +- .../gridfs-downloadByName.json | 3 +- .../retryable-reads/gridfs-downloadByName.yml | 2 +- .../listCollectionNames-serverErrors.json | 3 +- .../listCollectionNames-serverErrors.yml | 2 +- .../retryable-reads/listCollectionNames.json | 3 +- .../retryable-reads/listCollectionNames.yml | 2 +- .../listCollectionObjects-serverErrors.json | 3 +- .../listCollectionObjects-serverErrors.yml | 2 +- .../listCollectionObjects.json | 3 +- .../retryable-reads/listCollectionObjects.yml | 2 +- .../listCollections-serverErrors.json | 3 +- .../listCollections-serverErrors.yml | 2 +- .../spec/retryable-reads/listCollections.json | 3 +- test/spec/retryable-reads/listCollections.yml | 2 +- .../listDatabaseNames-serverErrors.json | 3 +- .../listDatabaseNames-serverErrors.yml | 2 +- .../retryable-reads/listDatabaseNames.json | 3 +- .../retryable-reads/listDatabaseNames.yml | 2 +- .../listDatabaseObjects-serverErrors.json | 3 +- .../listDatabaseObjects-serverErrors.yml | 2 +- .../retryable-reads/listDatabaseObjects.json | 3 +- .../retryable-reads/listDatabaseObjects.yml | 2 +- .../listDatabases-serverErrors.json | 3 +- .../listDatabases-serverErrors.yml | 2 +- test/spec/retryable-reads/listDatabases.json | 3 +- test/spec/retryable-reads/listDatabases.yml | 2 +- .../listIndexNames-serverErrors.json | 3 +- .../listIndexNames-serverErrors.yml | 2 +- test/spec/retryable-reads/listIndexNames.json | 3 +- test/spec/retryable-reads/listIndexNames.yml | 2 +- .../listIndexes-serverErrors.json | 3 +- .../listIndexes-serverErrors.yml | 2 +- test/spec/retryable-reads/listIndexes.json | 3 +- test/spec/retryable-reads/listIndexes.yml | 2 +- test/spec/retryable-reads/mapReduce.json | 3 +- test/spec/retryable-reads/mapReduce.yml | 2 +- test/spec/retryable-writes/README.rst | 14 +- .../bulkWrite-errorLabels.json | 3 +- .../bulkWrite-errorLabels.yml | 2 +- .../bulkWrite-serverErrors.json | 3 +- .../bulkWrite-serverErrors.yml | 2 +- test/spec/retryable-writes/deleteMany.json | 3 +- test/spec/retryable-writes/deleteMany.yml | 2 +- .../deleteOne-errorLabels.json | 3 +- .../deleteOne-errorLabels.yml | 2 +- .../deleteOne-serverErrors.json | 3 +- .../deleteOne-serverErrors.yml | 2 +- .../findOneAndDelete-errorLabels.json | 3 +- .../findOneAndDelete-errorLabels.yml | 2 +- .../findOneAndDelete-serverErrors.json | 3 +- .../findOneAndDelete-serverErrors.yml | 2 +- .../findOneAndReplace-errorLabels.json | 3 +- .../findOneAndReplace-errorLabels.yml | 2 +- .../findOneAndReplace-serverErrors.json | 3 +- .../findOneAndReplace-serverErrors.yml | 2 +- .../findOneAndUpdate-errorLabels.json | 3 +- .../findOneAndUpdate-errorLabels.yml | 2 +- .../findOneAndUpdate-serverErrors.json | 3 +- .../findOneAndUpdate-serverErrors.yml | 2 +- .../insertMany-errorLabels.json | 3 +- .../insertMany-errorLabels.yml | 2 +- .../insertMany-serverErrors.json | 3 +- .../insertMany-serverErrors.yml | 2 +- .../insertOne-errorLabels.json | 3 +- .../insertOne-errorLabels.yml | 2 +- .../insertOne-serverErrors.json | 3 +- .../insertOne-serverErrors.yml | 2 +- .../replaceOne-errorLabels.json | 3 +- .../replaceOne-errorLabels.yml | 2 +- .../replaceOne-serverErrors.json | 3 +- .../replaceOne-serverErrors.yml | 2 +- test/spec/retryable-writes/updateMany.json | 3 +- test/spec/retryable-writes/updateMany.yml | 2 +- .../updateOne-errorLabels.json | 3 +- .../updateOne-errorLabels.yml | 2 +- .../updateOne-serverErrors.json | 3 +- .../updateOne-serverErrors.yml | 2 +- .../load-balanced/discover_load_balancer.json | 28 + .../load-balanced/discover_load_balancer.yml | 22 + .../monitoring/load_balancer.json | 93 + .../monitoring/load_balancer.yml | 65 + .../LoadBalanced/read/Nearest.json | 35 + .../LoadBalanced/read/Nearest.yml | 16 + .../LoadBalanced/read/Primary.json | 30 + .../LoadBalanced/read/Primary.yml | 14 + .../LoadBalanced/read/PrimaryPreferred.json | 35 + .../LoadBalanced/read/PrimaryPreferred.yml | 16 + .../LoadBalanced/read/Secondary.json | 35 + .../LoadBalanced/read/Secondary.yml | 16 + .../LoadBalanced/read/SecondaryPreferred.json | 35 + .../LoadBalanced/read/SecondaryPreferred.yml | 16 + .../LoadBalanced/write/Nearest.json | 35 + .../LoadBalanced/write/Nearest.yml | 16 + .../LoadBalanced/write/Primary.json | 30 + .../LoadBalanced/write/Primary.yml | 14 + .../LoadBalanced/write/PrimaryPreferred.json | 35 + .../LoadBalanced/write/PrimaryPreferred.yml | 16 + .../LoadBalanced/write/Secondary.json | 35 + .../LoadBalanced/write/Secondary.yml | 16 + .../write/SecondaryPreferred.json | 35 + .../LoadBalanced/write/SecondaryPreferred.yml | 16 + ...client-storeEventsAsEntities-minItems.json | 18 + ...-client-storeEventsAsEntities-minItems.yml | 12 + ...ity-client-storeEventsAsEntities-type.json | 18 + ...tity-client-storeEventsAsEntities-type.yml | 12 + ...ectionCheckOutFailedEvent-reason-type.json | 23 + ...nectionCheckOutFailedEvent-reason-type.yml | 13 + ...kOutStartedEvent-additionalProperties.json | 23 + ...ckOutStartedEvent-additionalProperties.yml | 13 + ...onCheckedInEvent-additionalProperties.json | 23 + ...ionCheckedInEvent-additionalProperties.yml | 13 + ...nCheckedOutEvent-additionalProperties.json | 23 + ...onCheckedOutEvent-additionalProperties.yml | 13 + ...ent-connectionClosedEvent-reason-type.json | 23 + ...vent-connectionClosedEvent-reason-type.yml | 13 + ...tionCreatedEvent-additionalProperties.json | 23 + ...ctionCreatedEvent-additionalProperties.yml | 13 + ...ectionReadyEvent-additionalProperties.json | 23 + ...nectionReadyEvent-additionalProperties.yml | 13 + ...nt-poolClearedEvent-hasServiceId-type.json | 23 + ...ent-poolClearedEvent-hasServiceId-type.yml | 13 + ...-poolClosedEvent-additionalProperties.json | 23 + ...t-poolClosedEvent-additionalProperties.yml | 13 + ...poolCreatedEvent-additionalProperties.json | 23 + ...-poolCreatedEvent-additionalProperties.yml | 13 + ...t-poolReadyEvent-additionalProperties.json | 23 + ...nt-poolReadyEvent-additionalProperties.yml | 13 + ...ctedCommandEvent-additionalProperties.json | 27 + ...ectedCommandEvent-additionalProperties.yml | 15 + ...t-commandFailedEvent-commandName-type.json | 29 + ...nt-commandFailedEvent-commandName-type.yml | 16 + ...-commandFailedEvent-hasServiceId-type.json | 29 + ...t-commandFailedEvent-hasServiceId-type.yml | 16 + ...mandStartedEvent-additionalProperties.json | 29 + ...mmandStartedEvent-additionalProperties.yml | 16 + ...vent-commandStartedEvent-command-type.json | 29 + ...Event-commandStartedEvent-command-type.yml | 16 + ...-commandStartedEvent-commandName-type.json | 29 + ...t-commandStartedEvent-commandName-type.yml | 16 + ...commandStartedEvent-databaseName-type.json | 29 + ...-commandStartedEvent-databaseName-type.yml | 16 + ...commandStartedEvent-hasServiceId-type.json | 29 + ...-commandStartedEvent-hasServiceId-type.yml | 16 + ...ommandSucceededEvent-commandName-type.json | 29 + ...commandSucceededEvent-commandName-type.yml | 16 + ...mmandSucceededEvent-hasServiceId-type.json | 29 + ...ommandSucceededEvent-hasServiceId-type.yml | 16 + ...vent-commandSucceededEvent-reply-type.json | 29 + ...Event-commandSucceededEvent-reply-type.yml | 16 + .../expectedCommandEvent-maxProperties.json | 28 + .../expectedCommandEvent-maxProperties.yml | 16 + .../expectedCommandEvent-minProperties.json | 25 + .../expectedCommandEvent-minProperties.yml | 15 + ...dEventsForClient-additionalProperties.json | 15 +- ...edEventsForClient-additionalProperties.yml | 12 +- ...pectedEventsForClient-client-required.json | 11 +- ...xpectedEventsForClient-client-required.yml | 8 +- .../expectedEventsForClient-client-type.json | 13 +- .../expectedEventsForClient-client-type.yml | 10 +- ...xpectedEventsForClient-eventType-enum.json | 24 + ...expectedEventsForClient-eventType-enum.yml | 15 + ...xpectedEventsForClient-eventType-type.json | 24 + ...expectedEventsForClient-eventType-type.yml | 15 + .../expectedEventsForClient-events-items.json | 15 +- .../expectedEventsForClient-events-items.yml | 10 +- ...pectedEventsForClient-events-required.json | 11 +- ...xpectedEventsForClient-events-required.yml | 8 +- .../expectedEventsForClient-events-type.json | 13 +- .../expectedEventsForClient-events-type.yml | 10 +- ...-events_conflicts_with_cmap_eventType.json | 28 + ...t-events_conflicts_with_cmap_eventType.yml | 16 + ...ents_conflicts_with_command_eventType.json | 28 + ...vents_conflicts_with_command_eventType.yml | 16 + ...ents_conflicts_with_default_eventType.json | 27 + ...vents_conflicts_with_default_eventType.yml | 15 + ...ltAndError-conflicts_with_expectError.json | 19 + ...ultAndError-conflicts_with_expectError.yml | 12 + ...tAndError-conflicts_with_expectResult.json | 17 + ...ltAndError-conflicts_with_expectResult.yml | 11 + ...ror-conflicts_with_saveResultAsEntity.json | 17 + ...rror-conflicts_with_saveResultAsEntity.yml | 11 + .../invalid/runOnRequirement-auth-type.json | 15 + .../invalid/runOnRequirement-auth-type.yml | 10 + ...reEventsAsEntity-additionalProperties.json | 26 + ...oreEventsAsEntity-additionalProperties.yml | 15 + .../storeEventsAsEntity-events-enum.json | 25 + .../storeEventsAsEntity-events-enum.yml | 14 + .../storeEventsAsEntity-events-minItems.json | 23 + .../storeEventsAsEntity-events-minItems.yml | 14 + .../storeEventsAsEntity-events-required.json | 22 + .../storeEventsAsEntity-events-required.yml | 13 + .../storeEventsAsEntity-events-type.json | 23 + .../storeEventsAsEntity-events-type.yml | 14 + .../storeEventsAsEntity-id-required.json | 24 + .../storeEventsAsEntity-id-required.yml | 13 + .../invalid/storeEventsAsEntity-id-type.json | 25 + .../invalid/storeEventsAsEntity-id-type.yml | 14 + .../assertNumberConnectionsCheckedOut.json | 63 + .../assertNumberConnectionsCheckedOut.yml | 38 + ...ntsAsEntities-conflict_with_client_id.json | 28 + ...entsAsEntities-conflict_with_client_id.yml | 16 + ...ities-conflict_within_different_array.json | 43 + ...tities-conflict_within_different_array.yml | 19 + ...AsEntities-conflict_within_same_array.json | 36 + ...sAsEntities-conflict_within_same_array.yml | 16 + .../valid-fail/entity-find-cursor.json | 62 + .../valid-fail/entity-find-cursor.yml | 37 + .../valid-fail/ignoreResultAndError.json | 72 + .../valid-fail/ignoreResultAndError.yml | 43 + .../valid-fail/operation-failure.json | 56 + .../valid-fail/operation-failure.yml | 31 + .../assertNumberConnectionsCheckedOut.json | 27 + .../assertNumberConnectionsCheckedOut.yml | 17 + .../valid-pass/entity-client-cmap-events.json | 71 + .../valid-pass/entity-client-cmap-events.yml | 40 + .../entity-client-storeEventsAsEntities.json | 67 + .../entity-client-storeEventsAsEntities.yml | 37 + .../valid-pass/entity-find-cursor.json | 182 ++ .../valid-pass/entity-find-cursor.yml | 89 + .../expectedEventsForClient-eventType.json | 126 ++ .../expectedEventsForClient-eventType.yml | 66 + .../valid-pass/ignoreResultAndError.json | 59 + .../valid-pass/ignoreResultAndError.yml | 34 + .../valid-pass/poc-command-monitoring.json | 3 +- .../valid-pass/poc-command-monitoring.yml | 3 +- .../valid-pass/poc-crud.json | 446 ----- .../valid-pass/poc-crud.yml | 183 -- .../valid-pass/poc-retryable-reads.yml | 6 +- .../valid-pass/poc-retryable-writes.yml | 4 +- test/spec/uri-options/connection-options.json | 67 + test/spec/uri-options/connection-options.yml | 58 + test/spec/versioned-api/README.rst | 37 + test/unit/core/mongodb_srv.test.js | 4 +- test/unit/sdam/server_selection/spec.test.js | 8 +- test/unit/sdam/spec.test.js | 5 +- 315 files changed, 10133 insertions(+), 890 deletions(-) rename test/spec/change-stream/{ => legacy}/change-streams-errors.json (96%) rename test/spec/change-stream/{ => legacy}/change-streams-errors.yml (97%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-errorLabels.json (98%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-errorLabels.yml (98%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-whitelist.json (99%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-whitelist.yml (99%) rename test/spec/change-stream/{ => legacy}/change-streams.json (99%) rename test/spec/change-stream/{ => legacy}/change-streams.yml (99%) create mode 100644 test/spec/change-stream/unified/change-streams.json create mode 100644 test/spec/change-stream/unified/change-streams.yml create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml create mode 100644 test/spec/load-balancers/README.rst create mode 100644 test/spec/load-balancers/cursors.json create mode 100644 test/spec/load-balancers/cursors.yml create mode 100644 test/spec/load-balancers/event-monitoring.json create mode 100644 test/spec/load-balancers/event-monitoring.yml create mode 100644 test/spec/load-balancers/lb-connection-establishment.json create mode 100644 test/spec/load-balancers/lb-connection-establishment.yml create mode 100644 test/spec/load-balancers/non-lb-connection-establishment.json create mode 100644 test/spec/load-balancers/non-lb-connection-establishment.yml create mode 100644 test/spec/load-balancers/sdam-error-handling.json create mode 100644 test/spec/load-balancers/sdam-error-handling.yml create mode 100644 test/spec/load-balancers/server-selection.json create mode 100644 test/spec/load-balancers/server-selection.yml create mode 100644 test/spec/load-balancers/transactions.json create mode 100644 test/spec/load-balancers/transactions.yml create mode 100644 test/spec/load-balancers/wait-queue-timeouts.json create mode 100644 test/spec/load-balancers/wait-queue-timeouts.yml create mode 100644 test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json create mode 100644 test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml create mode 100644 test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json create mode 100644 test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml create mode 100644 test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json create mode 100644 test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-find-cursor.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-find-cursor.yml create mode 100644 test/spec/unified-test-format/valid-fail/ignoreResultAndError.json create mode 100644 test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml create mode 100644 test/spec/unified-test-format/valid-fail/operation-failure.json create mode 100644 test/spec/unified-test-format/valid-fail/operation-failure.yml create mode 100644 test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json create mode 100644 test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml create mode 100644 test/spec/unified-test-format/valid-pass/entity-find-cursor.json create mode 100644 test/spec/unified-test-format/valid-pass/entity-find-cursor.yml create mode 100644 test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json create mode 100644 test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml create mode 100644 test/spec/unified-test-format/valid-pass/ignoreResultAndError.json create mode 100644 test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml delete mode 100644 test/spec/unified-test-format/valid-pass/poc-crud.json delete mode 100644 test/spec/unified-test-format/valid-pass/poc-crud.yml create mode 100644 test/spec/versioned-api/README.rst diff --git a/test/functional/change_stream_spec.test.js b/test/functional/change_stream_spec.test.js index 57a47239992..d124f46c82b 100644 --- a/test/functional/change_stream_spec.test.js +++ b/test/functional/change_stream_spec.test.js @@ -1,5 +1,6 @@ 'use strict'; +const path = require('path'); const chai = require('chai'); const loadSpecTests = require('../spec').loadSpecTests; const camelCase = require('lodash.camelcase'); @@ -28,7 +29,7 @@ describe('Change Stream Spec', function () { return new Promise(r => gc.close(() => r())); }); - loadSpecTests('change-stream').forEach(suite => { + loadSpecTests(path.join('change-stream', 'legacy')).forEach(suite => { const ALL_DBS = [suite.database_name, suite.database2_name]; describe(suite.name, () => { diff --git a/test/functional/unified-spec-runner/operations.ts b/test/functional/unified-spec-runner/operations.ts index 40aa0f864ab..a4dda6f5ed8 100644 --- a/test/functional/unified-spec-runner/operations.ts +++ b/test/functional/unified-spec-runner/operations.ts @@ -180,7 +180,8 @@ operations.set('assertNumberConnectionsCheckedOut', async ({ entities, operation const pool = server.s.pool; return count + pool.currentCheckedOutCount; }, 0); - expect(checkedOutConnections).to.equal(operation.arguments.connections); + // TODO: Durran: Fix in NODE-3011 + expect(checkedOutConnections || 0).to.equal(operation.arguments.connections); }); operations.set('bulkWrite', async ({ entities, operation }) => { diff --git a/test/spec/change-stream/README.rst b/test/spec/change-stream/README.rst index 1dff2b66195..4e3bfbc94aa 100644 --- a/test/spec/change-stream/README.rst +++ b/test/spec/change-stream/README.rst @@ -18,6 +18,15 @@ drivers can use to prove their conformance to the Change Streams Spec. Several prose tests, which are not easily expressed in YAML, are also presented in this file. Those tests will need to be manually implemented by each driver. +Subdirectories for Test Formats +------------------------------- + +This document describes the legacy format for change streams tests. +Tests in this legacy format are located under ``./legacy/``. + +New change streams tests should be written in the `unified test format <../../unified-test-format/unified-test-format.rst>`__ +and placed under ``./unified/``. + Spec Test Format ================ @@ -33,14 +42,14 @@ Each YAML file has the following keys: - ``description``: The name of the test. - ``minServerVersion``: The minimum server version to run this test against. If not present, assume there is no minimum server version. - ``maxServerVersion``: Reserved for later use - - ``failPoint``(optional): The configureFailPoint command document to run to configure a fail point on the primary server. + - ``failPoint``: Optional configureFailPoint command document to run to configure a fail point on the primary server. - ``target``: The entity on which to run the change stream. Valid values are: - ``collection``: Watch changes on collection ``database_name.collection_name`` - ``database``: Watch changes on database ``database_name`` - ``client``: Watch changes on entire clusters - ``topology``: An array of server topologies against which to run the test. - Valid topologies are ``single``, ``replicaset``, and ``sharded``. + Valid topologies are ``single``, ``replicaset``, ``sharded``, and "load-balanced". - ``changeStreamPipeline``: An array of additional aggregation pipeline stages to add to the change stream - ``changeStreamOptions``: Additional options to add to the changeStream - ``operations``: Array of documents, each describing an operation. Each document has the following fields: @@ -133,6 +142,11 @@ For each YAML file, for each element in ``tests``: - For each (``expected``, ``idx``) in ``expectations`` - If ``actual[idx]`` is a ``killCursors`` event, skip it and move to ``actual[idx+1]``. - Else assert that ``actual[idx]`` MATCHES ``expected`` + - Note: the change stream test command event expectations cover a + prefix subset of all command events published by the driver. + The test runner MUST verify that, if there are N expectations, that the + first N events published by the driver match the expectations, and + MUST NOT inspect any subsequent events published by the driver. - Close the MongoClient ``client`` @@ -171,7 +185,7 @@ The following tests have not yet been automated, but MUST still be tested. All t #. ``ChangeStream`` must continuously track the last seen ``resumeToken`` #. ``ChangeStream`` will throw an exception if the server response is missing the resume token (if wire version is < 8, this is a driver-side error; for 8+, this is a server-side error) #. After receiving a ``resumeToken``, ``ChangeStream`` will automatically resume one time on a resumable error with the initial pipeline and options, except for the addition/update of a ``resumeToken``. -#. ``ChangeStream`` will not attempt to resume on any error encountered while executing an ``aggregate`` command. Note that retryable reads may retry ``aggregate`` commands. Drivers should be careful to distinguish retries from resume attempts. Alternatively, drivers may specify `retryReads=false` or avoid using a [retryable error](../../retryable-reads/retryable-reads.rst#retryable-error) for this test. +#. ``ChangeStream`` will not attempt to resume on any error encountered while executing an ``aggregate`` command. Note that retryable reads may retry ``aggregate`` commands. Drivers should be careful to distinguish retries from resume attempts. Alternatively, drivers may specify ``retryReads=false`` or avoid using a `retryable error <../../retryable-reads/retryable-reads.rst#retryable-error>`_ for this test. #. **Removed** #. ``ChangeStream`` will perform server selection before attempting to resume, using initial ``readPreference`` #. Ensure that a cursor returned from an aggregate command with a cursor id and an initial empty batch is not closed on the driver side. diff --git a/test/spec/change-stream/change-streams-errors.json b/test/spec/change-stream/legacy/change-streams-errors.json similarity index 96% rename from test/spec/change-stream/change-streams-errors.json rename to test/spec/change-stream/legacy/change-streams-errors.json index 19cbc742880..7b3fa80689c 100644 --- a/test/spec/change-stream/change-streams-errors.json +++ b/test/spec/change-stream/legacy/change-streams-errors.json @@ -14,7 +14,7 @@ "changeStreamPipeline": [], "changeStreamOptions": {}, "operations": [], - "expectations": [], + "expectations": null, "result": { "error": { "code": 40573 @@ -78,7 +78,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [ { @@ -125,7 +126,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, diff --git a/test/spec/change-stream/change-streams-errors.yml b/test/spec/change-stream/legacy/change-streams-errors.yml similarity index 97% rename from test/spec/change-stream/change-streams-errors.yml rename to test/spec/change-stream/legacy/change-streams-errors.yml index 2e518c1e362..661ccabdb14 100644 --- a/test/spec/change-stream/change-streams-errors.yml +++ b/test/spec/change-stream/legacy/change-streams-errors.yml @@ -12,7 +12,7 @@ tests: changeStreamPipeline: [] changeStreamOptions: {} operations: [] - expectations: [] + expectations: ~ result: error: code: 40573 @@ -57,6 +57,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: - $project: { _id: 0 } @@ -86,6 +87,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: diff --git a/test/spec/change-stream/change-streams-resume-errorLabels.json b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.json similarity index 98% rename from test/spec/change-stream/change-streams-resume-errorLabels.json rename to test/spec/change-stream/legacy/change-streams-resume-errorLabels.json index cf8957b21f2..4d1f52d9724 100644 --- a/test/spec/change-stream/change-streams-resume-errorLabels.json +++ b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.json @@ -18,7 +18,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -111,7 +112,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -204,7 +206,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -297,7 +300,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -390,7 +394,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -483,7 +488,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -576,7 +582,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -669,7 +676,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -762,7 +770,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -855,7 +864,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -948,7 +958,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1041,7 +1052,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1134,7 +1146,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1227,7 +1240,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1320,7 +1334,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1413,7 +1428,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1512,7 +1528,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1608,7 +1625,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, diff --git a/test/spec/change-stream/change-streams-resume-errorLabels.yml b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml similarity index 98% rename from test/spec/change-stream/change-streams-resume-errorLabels.yml rename to test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml index 94570a1457a..91e1ae8913e 100644 --- a/test/spec/change-stream/change-streams-resume-errorLabels.yml +++ b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml @@ -15,6 +15,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -78,6 +79,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -141,6 +143,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -204,6 +207,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -267,6 +271,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -330,6 +335,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -393,6 +399,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -456,6 +463,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -519,6 +527,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -582,6 +591,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -645,6 +655,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -708,6 +719,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -771,6 +783,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -834,6 +847,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -897,6 +911,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -960,6 +975,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -1026,6 +1042,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -1090,6 +1107,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: diff --git a/test/spec/change-stream/change-streams-resume-whitelist.json b/test/spec/change-stream/legacy/change-streams-resume-whitelist.json similarity index 99% rename from test/spec/change-stream/change-streams-resume-whitelist.json rename to test/spec/change-stream/legacy/change-streams-resume-whitelist.json index 39f883ee5ec..76920d8d3b9 100644 --- a/test/spec/change-stream/change-streams-resume-whitelist.json +++ b/test/spec/change-stream/legacy/change-streams-resume-whitelist.json @@ -20,7 +20,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, diff --git a/test/spec/change-stream/change-streams-resume-whitelist.yml b/test/spec/change-stream/legacy/change-streams-resume-whitelist.yml similarity index 99% rename from test/spec/change-stream/change-streams-resume-whitelist.yml rename to test/spec/change-stream/legacy/change-streams-resume-whitelist.yml index 2d92f295913..b851ac9eb59 100644 --- a/test/spec/change-stream/change-streams-resume-whitelist.yml +++ b/test/spec/change-stream/legacy/change-streams-resume-whitelist.yml @@ -15,6 +15,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: diff --git a/test/spec/change-stream/change-streams.json b/test/spec/change-stream/legacy/change-streams.json similarity index 99% rename from test/spec/change-stream/change-streams.json rename to test/spec/change-stream/legacy/change-streams.json index 4aeb2c7f70c..54b76af0a3d 100644 --- a/test/spec/change-stream/change-streams.json +++ b/test/spec/change-stream/legacy/change-streams.json @@ -82,7 +82,7 @@ } } ], - "expectations": [], + "expectations": null, "result": { "success": [ { diff --git a/test/spec/change-stream/change-streams.yml b/test/spec/change-stream/legacy/change-streams.yml similarity index 99% rename from test/spec/change-stream/change-streams.yml rename to test/spec/change-stream/legacy/change-streams.yml index 8037e9913ea..52009447732 100644 --- a/test/spec/change-stream/change-streams.yml +++ b/test/spec/change-stream/legacy/change-streams.yml @@ -58,7 +58,7 @@ tests: arguments: document: x: 1 - expectations: [] + expectations: ~ result: success: - diff --git a/test/spec/change-stream/unified/change-streams.json b/test/spec/change-stream/unified/change-streams.json new file mode 100644 index 00000000000..adaf00de2d9 --- /dev/null +++ b/test/spec/change-stream/unified/change-streams.json @@ -0,0 +1,116 @@ +{ + "description": "change-streams", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + } + ], + "initialData": [ + { + "collectionName": "collection0", + "databaseName": "database0", + "documents": [] + } + ], + "tests": [ + { + "description": "Test array truncation", + "runOnRequirements": [ + { + "minServerVersion": "4.7", + "topologies": [ + "replicaset" + ] + } + ], + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": 1, + "array": [ + "foo", + { + "a": "bar" + }, + 1, + 2, + 3 + ] + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$set": { + "array": [ + "foo", + { + "a": "bar" + } + ] + } + } + ] + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "updateDescription": { + "updatedFields": {}, + "removedFields": [], + "truncatedArrays": [ + { + "field": "array", + "newSize": 2 + } + ] + } + } + } + ] + } + ] +} diff --git a/test/spec/change-stream/unified/change-streams.yml b/test/spec/change-stream/unified/change-streams.yml new file mode 100644 index 00000000000..d8567db473e --- /dev/null +++ b/test/spec/change-stream/unified/change-streams.yml @@ -0,0 +1,72 @@ +description: "change-streams" +schemaVersion: "1.0" +createEntities: + - client: + id: &client0 client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: *database0 + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: *collection0 +initialData: + - collectionName: *collection0 + databaseName: *database0 + documents: [] +tests: + - description: "Test array truncation" + runOnRequirements: + - minServerVersion: "4.7" + topologies: [replicaset] + operations: + - name: insertOne + object: *collection0 + arguments: + document: { + "_id": 1, + "a": 1, + "array": ["foo", {"a": "bar"}, 1, 2, 3] + } + - name: createChangeStream + object: *collection0 + arguments: + pipeline: [] + saveResultAsEntity: &changeStream0 changeStream0 + - name: updateOne + object: *collection0 + arguments: + filter: { + "_id": 1 + } + update: [ + { + "$set": { + "array": ["foo", {"a": "bar"}] + } + } + ] + - name: iterateUntilDocumentOrError + object: *changeStream0 + expectResult: { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + # It is up to the MongoDB server to decide how to report a change. + # This expectation is based on the current MongoDB server behavior. + # Alternatively, we could have used a set of possible expectations of which only one + # must be satisfied, but the unified test format does not support this. + "updateDescription": { + "updatedFields": {}, + "removedFields": [], + "truncatedArrays": [ + { + "field": "array", + "newSize": 2 + } + ] + } + } diff --git a/test/spec/initial-dns-seedlist-discovery/README.rst b/test/spec/initial-dns-seedlist-discovery/README.rst index 6072deb7381..47bb75b4f67 100644 --- a/test/spec/initial-dns-seedlist-discovery/README.rst +++ b/test/spec/initial-dns-seedlist-discovery/README.rst @@ -8,9 +8,13 @@ to prove their conformance to the Initial DNS Seedlist Discovery spec. Test Setup ---------- -Start a three-node replica set on localhost, on ports 27017, 27018, and 27019, -with replica set name "repl0". The replica set MUST be started with SSL -enabled. +The tests in the ``replica-set`` directory MUST be executed against a +three-node replica set on localhost ports 27017, 27018, and 27019 with +replica set name ``repl0``. The tests in ``load-balanced`` MUST be executed +against a load-balanced sharded cluster with the mongos servers running on +localhost ports 27017 and 27018 and load balancers, shard servers, and config +servers running on any open ports. In both cases, the clusters MUST be +started with SSL enabled. To run the tests that accompany this spec, you need to configure the SRV and TXT records with a real name server. The following records are required for @@ -41,6 +45,8 @@ these tests:: _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc. _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc. _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. + _mongodb._tcp.test20.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. + _mongodb._tcp.test21.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. Record TTL Class Text test5.test.build.10gen.cc. 86400 IN TXT "replicaSet=repl0&authSource=thisDB" @@ -50,6 +56,8 @@ these tests:: test8.test.build.10gen.cc. 86400 IN TXT "authSource" test10.test.build.10gen.cc. 86400 IN TXT "socketTimeoutMS=500" test11.test.build.10gen.cc. 86400 IN TXT "replicaS" "et=rep" "l0" + test20.test.build.10gen.cc. 86400 IN TXT "loadBalanced=true" + test21.test.build.10gen.cc. 86400 IN TXT "loadBalanced=false" Note that ``test4`` is omitted deliberately to test what happens with no SRV record. ``test9`` is missing because it was deleted during the development of diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json new file mode 100644 index 00000000000..9ed5ff22c22 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json @@ -0,0 +1,7 @@ +{ + "uri": "mongodb+srv://test20.test.build.10gen.cc/?replicaSet=replset", + "seeds": [], + "hosts": [], + "error": true, + "comment": "Should fail because loadBalanced=true is incompatible with replicaSet" +} diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml new file mode 100644 index 00000000000..208c6a97390 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml @@ -0,0 +1,6 @@ +# The TXT record for test20.test.build.10gen.cc contains loadBalanced=true. +uri: "mongodb+srv://test20.test.build.10gen.cc/?replicaSet=replset" +seeds: [] +hosts: [] +error: true +comment: Should fail because loadBalanced=true is incompatible with replicaSet diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json new file mode 100644 index 00000000000..f425c06b305 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json @@ -0,0 +1,7 @@ +{ + "uri": "mongodb+srv://test1.test.build.10gen.cc/?loadBalanced=true", + "seeds": [], + "hosts": [], + "error": true, + "comment": "Should fail because loadBalanced is true but the SRV record resolves to multiple hosts" +} diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml new file mode 100644 index 00000000000..c8276c1b7ec --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml @@ -0,0 +1,5 @@ +uri: "mongodb+srv://test1.test.build.10gen.cc/?loadBalanced=true" +seeds: [] +hosts: [] +error: true +comment: Should fail because loadBalanced is true but the SRV record resolves to multiple hosts diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json new file mode 100644 index 00000000000..0117b3e9cba --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json @@ -0,0 +1,13 @@ +{ + "uri": "mongodb+srv://test20.test.build.10gen.cc/", + "seeds": [ + "localhost.test.build.10gen.cc:27017" + ], + "hosts": [ + "localhost.test.build.10gen.cc:27017" + ], + "options": { + "loadBalanced": true, + "ssl": true + } +} diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml new file mode 100644 index 00000000000..bbf9e8c5996 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml @@ -0,0 +1,10 @@ +uri: "mongodb+srv://test20.test.build.10gen.cc/" +seeds: + - localhost.test.build.10gen.cc:27017 +hosts: + # In LB mode, the driver does not do server discovery, so the hostname does + # not get resolved to localhost:27017. + - localhost.test.build.10gen.cc:27017 +options: + loadBalanced: true + ssl: true diff --git a/test/spec/load-balancers/README.rst b/test/spec/load-balancers/README.rst new file mode 100644 index 00000000000..3975e7b0b7f --- /dev/null +++ b/test/spec/load-balancers/README.rst @@ -0,0 +1,68 @@ +=========================== +Load Balancer Support Tests +=========================== + +.. contents:: + +---- + +Introduction +============ + +This document describes how drivers should create load balanced clusters for +testing and how tests should be executed for such clusters. + +Testing Requirements +==================== + +For each server version that supports load balanced clusters, drivers MUST +add two Evergreen tasks: one with a sharded cluster with both authentication +and TLS enabled and one with a sharded cluster with authentication and TLS +disabled. In each task, the sharded cluster MUST be configured with two +mongos nodes running on localhost ports 27017 and 27018. The shard and config +servers may run on any free ports. Each task MUST also start up two TCP load +balancers operating in round-robin mode: one fronting both mongos servers and +one fronting a single mongos. + +Load Balancer Configuration +--------------------------- + +Drivers MUST use the ``run-load-balancer.sh`` script in +``drivers-evergreen-tools`` to start the TCP load balancers for Evergreen +tasks. This script MUST be run after the backing sharded cluster has already +been started. The script writes the URIs of the load balancers to a YAML +expansions file, which can be read by drivers via the ``expansions.update`` +Evergreen command. This will store the URIs into the ``SINGLE_MONGOS_LB_URI`` +and ``MULTI_MONGOS_LB_URI`` environment variables. + +Test Runner Configuration +------------------------- + +If the backing sharded cluster is configured with TLS enabled, drivers MUST +add the relevant TLS options to both ``SINGLE_MONGOS_LB_URI`` and +``MULTI_MONGOS_LB_URI`` to ensure that test clients can connect to the +cluster. Drivers MUST use the final URI stored in ``SINGLE_MONGOS_LB_URI`` +(with additional TLS options if required) to configure internal clients for +test runners (e.g. the internal MongoClient described by the `Unified Test +Format spec <../../unified-test-format/unified-test-format.rst>`__). + +In addition to modifying load balancer URIs, drivers MUST also mock server +support for returning a ``serviceId`` field in ``hello`` or legacy ``hello`` +command responses when running tests against a load-balanced cluster. This +can be done by using the value of ``topologyVersion.processId`` to set +``serviceId``. This MUST be done for all connections established by the test +runner, including those made by any internal clients. + +Tests +====== + +The YAML and JSON files in this directory contain platform-independent tests +written in the `Unified Test Format +<../../unified-test-format/unified-test-format.rst>`_. Drivers MUST run the +following test suites against a load balanced cluster: + +#. All test suites written in the Unified Test Format +#. Retryable Reads +#. Retryable Writes +#. Change Streams +#. Initial DNS Seedlist Discovery diff --git a/test/spec/load-balancers/cursors.json b/test/spec/load-balancers/cursors.json new file mode 100644 index 00000000000..43e4fbb4f61 --- /dev/null +++ b/test/spec/load-balancers/cursors.json @@ -0,0 +1,1228 @@ +{ + "description": "cursors are correctly pinned to connections for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent", + "connectionReadyEvent", + "connectionClosedEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + }, + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "coll1" + } + }, + { + "collection": { + "id": "collection2", + "database": "database0", + "collectionName": "coll2" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + }, + { + "collectionName": "coll1", + "databaseName": "database0Name", + "documents": [] + }, + { + "collectionName": "coll2", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "no connection is pinned if all documents are returned in the initial batch", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {} + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {} + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connections are returned when the cursor is drained", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 2 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 3 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "close", + "object": "cursor0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connections are returned to the pool when the cursor is closed", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connections are not returned after an network error during getMore", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "closeConnection": true + } + } + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 2 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectError": { + "isClientError": true + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandFailedEvent": { + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + } + ] + } + ] + }, + { + "description": "pinned connections are returned after a network error during a killCursors request", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "killCursors" + ], + "closeConnection": true + } + } + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandFailedEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + } + ] + } + ] + }, + { + "description": "pinned connections are not returned to the pool after a non-network error on getMore", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 7 + } + } + } + }, + { + "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": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectError": { + "errorCode": 7 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandFailedEvent": { + "commandName": "getMore" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "aggregate pins the cursor to a connection", + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [], + "batchSize": 2 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "cursor": { + "batchSize": 2 + } + }, + "commandName": "aggregate" + } + }, + { + "commandSucceededEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "listCollections pins the cursor to a connection", + "operations": [ + { + "name": "listCollections", + "object": "database0", + "arguments": { + "filter": {}, + "batchSize": 2 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "listCollections": 1, + "cursor": { + "batchSize": 2 + } + }, + "commandName": "listCollections", + "databaseName": "database0Name" + } + }, + { + "commandSucceededEvent": { + "commandName": "listCollections" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": { + "$$type": "string" + } + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "listIndexes pins the cursor to a connection", + "operations": [ + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "y": 1 + }, + "name": "y_1" + } + }, + { + "name": "listIndexes", + "object": "collection0", + "arguments": { + "batchSize": 2 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "createIndexes": "coll0", + "indexes": [ + { + "name": "x_1", + "key": { + "x": 1 + } + } + ] + }, + "commandName": "createIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "command": { + "createIndexes": "coll0", + "indexes": [ + { + "name": "y_1", + "key": { + "y": 1 + } + } + ] + }, + "commandName": "createIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "command": { + "listIndexes": "coll0", + "cursor": { + "batchSize": 2 + } + }, + "commandName": "listIndexes", + "databaseName": "database0Name" + } + }, + { + "commandSucceededEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "change streams pin to a connection", + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "changeStream0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandSucceededEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/cursors.yml b/test/spec/load-balancers/cursors.yml new file mode 100644 index 00000000000..0797d0c93a1 --- /dev/null +++ b/test/spec/load-balancers/cursors.yml @@ -0,0 +1,503 @@ +description: cursors are correctly pinned to connections for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - commandStartedEvent + - commandSucceededEvent + - commandFailedEvent + - connectionReadyEvent + - connectionClosedEvent + - connectionCheckedOutEvent + - connectionCheckedInEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: &collection1Name coll1 + - collection: + id: &collection2 collection2 + database: *database0 + collectionName: &collection2Name coll2 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - collectionName: *collection1Name + databaseName: *database0Name + documents: [] + - collectionName: *collection2Name + databaseName: *database0Name + documents: [] + +tests: + - description: no connection is pinned if all documents are returned in the initial batch + operations: + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + saveResultAsEntity: &cursor0 cursor0 + - &assertConnectionNotPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: {} + commandName: find + - commandSucceededEvent: + reply: + cursor: + id: 0 + firstBatch: { $$type: array } + ns: { $$type: string } + commandName: find + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connections are returned when the cursor is drained + operations: + - &createAndSaveCursor + name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - &assertConnectionPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 1 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 2 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 3 } + - *assertConnectionNotPinned + - &closeCursor + name: close + object: *cursor0 + expectEvents: + - client: *client0 + events: + - &findWithBatchSizeStarted + commandStartedEvent: + command: + find: *collection0Name + filter: {} + batchSize: 2 + commandName: find + - &findWithBatchSizeSucceeded + commandSucceededEvent: + reply: + cursor: + id: { $$type: long } + firstBatch: { $$type: array } + ns: { $$type: string } + commandName: find + - &getMoreStarted + commandStartedEvent: + command: + getMore: { $$type: long } + collection: *collection0Name + commandName: getMore + - &getMoreSucceeded + commandSucceededEvent: + reply: + cursor: + id: 0 + ns: { $$type: string } + nextBatch: { $$type: array } + commandName: getMore + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connections are returned to the pool when the cursor is closed + operations: + - *createAndSaveCursor + - *assertConnectionPinned + - *closeCursor + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - &killCursorsStarted + commandStartedEvent: + commandName: killCursors + - &killCursorsSucceeded + commandSucceededEvent: + commandName: killCursors + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + # If a network error occurs during a getMore request, the connection must remain pinned. and drivers must not + # attempt to send a killCursors command when the cursor is closed because the connection is no longer valid. + - description: pinned connections are not returned after an network error during getMore + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ getMore ] + closeConnection: true + - *createAndSaveCursor + - *assertConnectionPinned + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 1 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 2 + # Third next() call should perform a getMore. + - name: iterateUntilDocumentOrError + object: *cursor0 + expectError: + # Network errors are considered client-side errors per the unified test format spec. + isClientError: true + - *assertConnectionPinned + - *closeCursor # Execute a close operation to actually release the connection. + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - *getMoreStarted + - &getMoreFailed + commandFailedEvent: + commandName: getMore + - client: *client0 + eventType: cmap + events: + # Events to set the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the find command + getMore. + - connectionCheckedOutEvent: {} + # Events for the close() operation. + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + + - description: pinned connections are returned after a network error during a killCursors request + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ killCursors ] + closeConnection: true + - *createAndSaveCursor + - *assertConnectionPinned + - *closeCursor + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - *killCursorsStarted + - commandFailedEvent: + commandName: killCursors + - client: *client0 + eventType: cmap + events: + # Events to set the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the find command + killCursors. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + + - description: pinned connections are not returned to the pool after a non-network error on getMore + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ getMore ] + errorCode: &hostNotFoundCode 7 # This is not a state change error code, so it should not cause SDAM changes. + - *createAndSaveCursor + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 1 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 2 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectError: + errorCode: *hostNotFoundCode + - *assertConnectionPinned + - *closeCursor + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - *getMoreStarted + - *getMoreFailed + - *killCursorsStarted + - *killCursorsSucceeded + - client: *client0 + eventType: cmap + events: + # Events to set the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the find command + getMore + killCursors. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + # Basic tests for cursor-creating commands besides "find". We don't need to replicate the full set of tests defined + # above for each such command. Instead, only one test is needed per command to ensure that the pinned connection is + # correctly passed down to the server. + # + # Each test creates a cursor with a small batch size and fully iterates it. Because drivers do not publish CMAP + # events when using pinned connections, each test asserts that only one set of ready/checkout/checkin events are + # published. + + - description: aggregate pins the cursor to a connection + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: [] + batchSize: 2 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + cursor: + batchSize: 2 + commandName: aggregate + - commandSucceededEvent: + commandName: aggregate + - *getMoreStarted + - *getMoreSucceeded + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: listCollections pins the cursor to a connection + operations: + - name: listCollections + object: *database0 + arguments: + filter: {} + batchSize: 2 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + listCollections: 1 + cursor: + batchSize: 2 + commandName: listCollections + databaseName: *database0Name + - commandSucceededEvent: + commandName: listCollections + # Write out the event for getMore rather than using the getMoreStarted anchor because the "collection" field + # is not equal to *collection0Name as the command is not executed against a collection. + - commandStartedEvent: + command: + getMore: { $$type: long } + collection: { $$type: string } + commandName: getMore + - *getMoreSucceeded + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: listIndexes pins the cursor to a connection + operations: + # There is an automatic index on _id so we create two more indexes to force multiple batches with batchSize=2. + - name: createIndex + object: *collection0 + arguments: + keys: &x1IndexSpec { x: 1 } + name: &x1IndexName x_1 + - name: createIndex + object: *collection0 + arguments: + keys: &y1IndexSpec { y: 1 } + name: &y1IndexName y_1 + - name: listIndexes + object: *collection0 + arguments: + batchSize: 2 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + createIndexes: *collection0Name + indexes: + - name: *x1IndexName + key: *x1IndexSpec + commandName: createIndexes + - commandSucceededEvent: + commandName: createIndexes + - commandStartedEvent: + command: + createIndexes: *collection0Name + indexes: + - name: *y1IndexName + key: *y1IndexSpec + commandName: createIndexes + - commandSucceededEvent: + commandName: createIndexes + - commandStartedEvent: + command: + listIndexes: *collection0Name + cursor: + batchSize: 2 + commandName: listIndexes + databaseName: *database0Name + - commandSucceededEvent: + commandName: listIndexes + - *getMoreStarted + - *getMoreSucceeded + - client: *client0 + eventType: cmap + events: + # Events for first createIndexes. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for second createIndexes. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for listIndexes and getMore. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: change streams pin to a connection + operations: + - name: createChangeStream + object: *collection0 + arguments: + pipeline: [] + saveResultAsEntity: &changeStream0 changeStream0 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 + - name: close + object: *changeStream0 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: aggregate + - commandSucceededEvent: + commandName: aggregate + - commandStartedEvent: + commandName: killCursors + - commandSucceededEvent: + commandName: killCursors + - client: *client0 + eventType: cmap + events: + # Events for creating the change stream. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for closing the change stream. + - connectionCheckedInEvent: {} diff --git a/test/spec/load-balancers/event-monitoring.json b/test/spec/load-balancers/event-monitoring.json new file mode 100644 index 00000000000..938c70bf388 --- /dev/null +++ b/test/spec/load-balancers/event-monitoring.json @@ -0,0 +1,184 @@ +{ + "description": "monitoring events include correct fields", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "uriOptions": { + "retryReads": false + }, + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent", + "poolClearedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "databaseName": "database0", + "collectionName": "coll0", + "documents": [] + } + ], + "tests": [ + { + "description": "command started and succeeded events include serviceId", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert", + "hasServiceId": true + } + }, + { + "commandSucceededEvent": { + "commandName": "insert", + "hasServiceId": true + } + } + ] + } + ] + }, + { + "description": "command failed events include serviceId", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "$or": true + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "find", + "hasServiceId": true + } + }, + { + "commandFailedEvent": { + "commandName": "find", + "hasServiceId": true + } + } + ] + } + ] + }, + { + "description": "poolClearedEvent events include serviceId", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "closeConnection": true + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": {} + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "find", + "hasServiceId": true + } + }, + { + "commandFailedEvent": { + "commandName": "find", + "hasServiceId": true + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolClearedEvent": { + "hasServiceId": true + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/event-monitoring.yml b/test/spec/load-balancers/event-monitoring.yml new file mode 100644 index 00000000000..52be457f68e --- /dev/null +++ b/test/spec/load-balancers/event-monitoring.yml @@ -0,0 +1,99 @@ +description: monitoring events include correct fields + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + uriOptions: + retryReads: false + observeEvents: + - commandStartedEvent + - commandSucceededEvent + - commandFailedEvent + - poolClearedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0 + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - databaseName: *database0Name + collectionName: *collection0Name + documents: [] + +tests: + - description: command started and succeeded events include serviceId + operations: + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: insert + hasServiceId: true + - commandSucceededEvent: + commandName: insert + hasServiceId: true + + - description: command failed events include serviceId + operations: + - name: find + object: *collection0 + arguments: + filter: { $or: true } + expectError: + isError: true + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: find + hasServiceId: true + - commandFailedEvent: + commandName: find + hasServiceId: true + + - description: poolClearedEvent events include serviceId + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [find] + closeConnection: true + - name: find + object: *collection0 + arguments: + filter: {} + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: find + hasServiceId: true + - commandFailedEvent: + commandName: find + hasServiceId: true + - client: *client0 + eventType: cmap + events: + - poolClearedEvent: + hasServiceId: true diff --git a/test/spec/load-balancers/lb-connection-establishment.json b/test/spec/load-balancers/lb-connection-establishment.json new file mode 100644 index 00000000000..0eaadf30c20 --- /dev/null +++ b/test/spec/load-balancers/lb-connection-establishment.json @@ -0,0 +1,58 @@ +{ + "description": "connection establishment for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "uriOptions": { + "loadBalanced": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + } + ], + "tests": [ + { + "description": "operations against load balancers fail if URI contains loadBalanced=false", + "skipReason": "servers have not implemented LB support yet so they will not fail the connection handshake in this case", + "operations": [ + { + "name": "runCommand", + "object": "database0", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/lb-connection-establishment.yml b/test/spec/load-balancers/lb-connection-establishment.yml new file mode 100644 index 00000000000..46e5d781f3e --- /dev/null +++ b/test/spec/load-balancers/lb-connection-establishment.yml @@ -0,0 +1,36 @@ +description: connection establishment for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + uriOptions: + # Explicitly set loadBalanced to false to override the option from the global URI. + loadBalanced: false + observeEvents: + - commandStartedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0 + +tests: + - description: operations against load balancers fail if URI contains loadBalanced=false + skipReason: servers have not implemented LB support yet so they will not fail the connection handshake in this case + operations: + - name: runCommand + object: *database0 + arguments: + commandName: ping + command: { ping: 1 } + expectError: + isClientError: false + expectEvents: + # No events should be published because the server fails the connection handshake, so the "ping" command is never + # sent. + - client: *client0 + events: [] diff --git a/test/spec/load-balancers/non-lb-connection-establishment.json b/test/spec/load-balancers/non-lb-connection-establishment.json new file mode 100644 index 00000000000..6aaa7bdf98b --- /dev/null +++ b/test/spec/load-balancers/non-lb-connection-establishment.json @@ -0,0 +1,92 @@ +{ + "description": "connection establishment if loadBalanced is specified for non-load balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "single", + "sharded" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "lbTrueClient", + "useMultipleMongoses": false, + "uriOptions": { + "loadBalanced": true + } + } + }, + { + "database": { + "id": "lbTrueDatabase", + "client": "lbTrueClient", + "databaseName": "lbTrueDb" + } + }, + { + "client": { + "id": "lbFalseClient", + "uriOptions": { + "loadBalanced": false + } + } + }, + { + "database": { + "id": "lbFalseDatabase", + "client": "lbFalseClient", + "databaseName": "lbFalseDb" + } + } + ], + "_yamlAnchors": { + "runCommandArguments": [ + { + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + } + } + ] + }, + "tests": [ + { + "description": "operations against non-load balanced clusters fail if URI contains loadBalanced=true", + "operations": [ + { + "name": "runCommand", + "object": "lbTrueDatabase", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectError": { + "errorContains": "Driver attempted to initialize in load balancing mode, but the server does not support this mode" + } + } + ] + }, + { + "description": "operations against non-load balanced clusters succeed if URI contains loadBalanced=false", + "operations": [ + { + "name": "runCommand", + "object": "lbFalseDatabase", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + } + } + ] + } + ] +} diff --git a/test/spec/load-balancers/non-lb-connection-establishment.yml b/test/spec/load-balancers/non-lb-connection-establishment.yml new file mode 100644 index 00000000000..e805549ac0d --- /dev/null +++ b/test/spec/load-balancers/non-lb-connection-establishment.yml @@ -0,0 +1,56 @@ +description: connection establishment if loadBalanced is specified for non-load balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + # Don't run on replica sets because the URI used to configure the clients will contain multiple hosts and the + # replicaSet option, which will cause an error when constructing the lbTrueClient entity. + - topologies: [ single, sharded ] + +createEntities: + - client: + id: &lbTrueClient lbTrueClient + # Restrict to a single mongos to ensure there are not multiple hosts in the URI, which would conflict with + # loadBalanced=true. + useMultipleMongoses: false + uriOptions: + loadBalanced: true + - database: + id: &lbTrueDatabase lbTrueDatabase + client: *lbTrueClient + databaseName: &lbTrueDatabaseName lbTrueDb + - client: + id: &lbFalseClient lbFalseClient + uriOptions: + loadBalanced: false + - database: + id: &lbFalseDatabase lbFalseDatabase + client: *lbFalseClient + databaseName: &lbFalseDatabaseName lbFalseDb + +_yamlAnchors: + runCommandArguments: + - &pingArguments + arguments: + commandName: ping + command: { ping: 1 } + +tests: + # These tests assert that drivers behave correctly if loadBalanced=true/false for non-load balanced clusters. Existing + # spec tests should cover the case where loadBalanced is unset. + + # If the server is not configured to be behind a load balancer and the URI contains loadBalanced=true, the driver + # should error during the connection handshake because the server's hello response does not contain a serviceId field. + - description: operations against non-load balanced clusters fail if URI contains loadBalanced=true + operations: + - name: runCommand + object: *lbTrueDatabase + <<: *pingArguments + expectError: + errorContains: Driver attempted to initialize in load balancing mode, but the server does not support this mode + + - description: operations against non-load balanced clusters succeed if URI contains loadBalanced=false + operations: + - name: runCommand + object: *lbFalseDatabase + <<: *pingArguments diff --git a/test/spec/load-balancers/sdam-error-handling.json b/test/spec/load-balancers/sdam-error-handling.json new file mode 100644 index 00000000000..63aabc04dba --- /dev/null +++ b/test/spec/load-balancers/sdam-error-handling.json @@ -0,0 +1,508 @@ +{ + "description": "state change errors are correctly handled", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "_yamlAnchors": { + "observedEvents": [ + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedInEvent", + "connectionClosedEvent", + "poolClearedEvent" + ] + }, + "createEntities": [ + { + "client": { + "id": "failPointClient", + "useMultipleMongoses": false + } + }, + { + "client": { + "id": "singleClient", + "useMultipleMongoses": false, + "uriOptions": { + "appname": "lbSDAMErrorTestClient", + "retryWrites": false + }, + "observeEvents": [ + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedInEvent", + "connectionClosedEvent", + "poolClearedEvent" + ] + } + }, + { + "database": { + "id": "singleDB", + "client": "singleClient", + "databaseName": "singleDB" + } + }, + { + "collection": { + "id": "singleColl", + "database": "singleDB", + "collectionName": "singleColl" + } + }, + { + "client": { + "id": "multiClient", + "useMultipleMongoses": true, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedInEvent", + "connectionClosedEvent", + "poolClearedEvent" + ] + } + }, + { + "database": { + "id": "multiDB", + "client": "multiClient", + "databaseName": "multiDB" + } + }, + { + "collection": { + "id": "multiColl", + "database": "multiDB", + "collectionName": "multiColl" + } + } + ], + "initialData": [ + { + "collectionName": "singleColl", + "databaseName": "singleDB", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + }, + { + "collectionName": "multiColl", + "databaseName": "multiDB", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "only connections for a specific serviceId are closed when pools are cleared", + "operations": [ + { + "name": "createFindCursor", + "object": "multiColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "createFindCursor", + "object": "multiColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor1" + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "close", + "object": "cursor1" + }, + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "multiClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11600 + } + } + } + }, + { + "name": "insertOne", + "object": "multiColl", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "errorCode": 11600 + } + }, + { + "name": "insertOne", + "object": "multiColl", + "arguments": { + "document": { + "x": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "multiClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "poolClearedEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "stale" + } + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "errors during the initial connection hello are ignore", + "runOnRequirements": [ + { + "minServerVersion": "4.9" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "failPointClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "isMaster" + ], + "closeConnection": true, + "appName": "lbSDAMErrorTestClient" + } + } + } + }, + { + "name": "insertOne", + "object": "singleColl", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "singleClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionCheckOutFailedEvent": { + "reason": "connectionError" + } + } + ] + } + ] + }, + { + "description": "errors during authentication are processed", + "runOnRequirements": [ + { + "auth": true + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "failPointClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "saslContinue" + ], + "closeConnection": true, + "appName": "lbSDAMErrorTestClient" + } + } + } + }, + { + "name": "insertOne", + "object": "singleColl", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "singleClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "poolClearedEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionCheckOutFailedEvent": { + "reason": "connectionError" + } + } + ] + } + ] + }, + { + "description": "stale errors are ignored", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "failPointClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "getMore" + ], + "closeConnection": true + } + } + } + }, + { + "name": "createFindCursor", + "object": "singleColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "createFindCursor", + "object": "singleColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor1" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectError": { + "isClientError": true + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor1" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor1" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor1", + "expectError": { + "isClientError": true + } + }, + { + "name": "close", + "object": "cursor1" + } + ], + "expectEvents": [ + { + "client": "singleClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "poolClearedEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/sdam-error-handling.yml b/test/spec/load-balancers/sdam-error-handling.yml new file mode 100644 index 00000000000..9ed1b226fb8 --- /dev/null +++ b/test/spec/load-balancers/sdam-error-handling.yml @@ -0,0 +1,270 @@ +description: state change errors are correctly handled + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +_yamlAnchors: + observedEvents: &observedEvents + - connectionCreatedEvent + - connectionReadyEvent + - connectionCheckedOutEvent + - connectionCheckOutFailedEvent + - connectionCheckedInEvent + - connectionClosedEvent + - poolClearedEvent + +createEntities: + - client: + id: &failPointClient failPointClient + useMultipleMongoses: false + - client: + id: &singleClient singleClient + useMultipleMongoses: false + uriOptions: + appname: &singleClientAppName lbSDAMErrorTestClient + retryWrites: false + observeEvents: *observedEvents + - database: + id: &singleDB singleDB + client: *singleClient + databaseName: &singleDBName singleDB + - collection: + id: &singleColl singleColl + database: *singleDB + collectionName: &singleCollName singleColl + - client: + id: &multiClient multiClient + useMultipleMongoses: true + uriOptions: + retryWrites: false + observeEvents: *observedEvents + - database: + id: &multiDB multiDB + client: *multiClient + databaseName: &multiDBName multiDB + - collection: + id: &multiColl multiColl + database: *multiDB + collectionName: &multiCollName multiColl + +initialData: + - collectionName: *singleCollName + databaseName: *singleDBName + documents: + - _id: 1 + - _id: 2 + - _id: 3 + - collectionName: *multiCollName + databaseName: *multiDBName + documents: + - _id: 1 + - _id: 2 + - _id: 3 + +tests: + - description: only connections for a specific serviceId are closed when pools are cleared + operations: + # Create two cursors to force two connections. + - name: createFindCursor + object: *multiColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: createFindCursor + object: *multiColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor1 cursor1 + # Close both cursors to return the connections to the pool. + - name: close + object: *cursor0 + - name: close + object: *cursor1 + # Fail an operation with a state change error. + - name: failPoint + object: testRunner + arguments: + client: *multiClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [insert] + errorCode: &errorCode 11600 # InterruptedAtShutdown + - name: insertOne + object: *multiColl + arguments: + document: { x: 1 } + expectError: + errorCode: *errorCode + # Do another operation to ensure the relevant connection has been closed. + - name: insertOne + object: *multiColl + arguments: + document: { x: 1 } + expectEvents: + - client: *multiClient + eventType: cmap + events: + # Create cursors. + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Close cursors. + - connectionCheckedInEvent: {} + - connectionCheckedInEvent: {} + # Set failpoint. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # First insertOne. + - connectionCheckedOutEvent: {} + - poolClearedEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: stale + # Second insertOne. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + # This test uses singleClient to ensure that connection attempts are routed + # to the same mongos on which the failpoint is set. + - description: errors during the initial connection hello are ignore + runOnRequirements: + # Server version 4.9+ is needed to set a fail point on the initial + # connection handshake with the appName filter due to SERVER-49336. + - minServerVersion: '4.9' + operations: + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [isMaster] + closeConnection: true + appName: *singleClientAppName + - name: insertOne + object: *singleColl + arguments: + document: { x: 1 } + expectError: + isClientError: true + expectEvents: + - client: *singleClient + eventType: cmap + events: + - connectionCreatedEvent: {} + - connectionClosedEvent: + reason: error + - connectionCheckOutFailedEvent: + reason: connectionError + + - description: errors during authentication are processed + runOnRequirements: + - auth: true + operations: + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [saslContinue] + closeConnection: true + appName: *singleClientAppName + - name: insertOne + object: *singleColl + arguments: + document: { x: 1 } + expectError: + isClientError: true + expectEvents: + - client: *singleClient + eventType: cmap + events: + - connectionCreatedEvent: {} + - poolClearedEvent: {} + - connectionClosedEvent: + reason: error + - connectionCheckOutFailedEvent: + reason: connectionError + + - description: stale errors are ignored + operations: + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 2 } + data: + failCommands: [getMore] + closeConnection: true + # Force two connections to be checked out from the pool. + - name: createFindCursor + object: *singleColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: createFindCursor + object: *singleColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor1 cursor1 + # Iterate cursor0 three times to force a network error. + - name: iterateUntilDocumentOrError + object: *cursor0 + - name: iterateUntilDocumentOrError + object: *cursor0 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectError: + isClientError: true + - name: close + object: *cursor0 + # Iterate cursor1 three times to force a network error. + - name: iterateUntilDocumentOrError + object: *cursor1 + - name: iterateUntilDocumentOrError + object: *cursor1 + - name: iterateUntilDocumentOrError + object: *cursor1 + expectError: + isClientError: true + - name: close + object: *cursor1 + expectEvents: + - client: *singleClient + eventType: cmap + events: + # Events for creating both cursors. + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for iterating and closing the first cursor. The failed + # getMore should cause a poolClearedEvent to be published. + - poolClearedEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: {} + # Events for iterating and closing the second cursor. The failed + # getMore should not clear the pool because the connection's + # generation number is stale. + - connectionCheckedInEvent: {} + - connectionClosedEvent: {} diff --git a/test/spec/load-balancers/server-selection.json b/test/spec/load-balancers/server-selection.json new file mode 100644 index 00000000000..00c7e4c95b4 --- /dev/null +++ b/test/spec/load-balancers/server-selection.json @@ -0,0 +1,82 @@ +{ + "description": "server selection for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0", + "collectionOptions": { + "readPreference": { + "mode": "secondaryPreferred" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "$readPreference is sent for load-balanced clusters", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "$readPreference": { + "mode": "secondaryPreferred" + } + }, + "commandName": "find", + "databaseName": "database0Name" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/server-selection.yml b/test/spec/load-balancers/server-selection.yml new file mode 100644 index 00000000000..5c5c9a9a126 --- /dev/null +++ b/test/spec/load-balancers/server-selection.yml @@ -0,0 +1,50 @@ +description: server selection for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - commandStartedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + collectionOptions: + readPreference: + # Use secondaryPreferred to ensure that operations can succeed even if the shards are only comprised of one + # server. + mode: &readPrefMode secondaryPreferred + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: $readPreference is sent for load-balanced clusters + operations: + - name: find + object: *collection0 + arguments: + filter: {} + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: {} + $readPreference: + mode: *readPrefMode + commandName: find + databaseName: *database0Name diff --git a/test/spec/load-balancers/transactions.json b/test/spec/load-balancers/transactions.json new file mode 100644 index 00000000000..add24538482 --- /dev/null +++ b/test/spec/load-balancers/transactions.json @@ -0,0 +1,1606 @@ +{ + "description": "transactions are correctly pinned to connections for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent", + "connectionReadyEvent", + "connectionClosedEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent" + ] + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "_yamlAnchors": { + "documents": [ + { + "_id": 4 + } + ] + }, + "tests": [ + { + "description": "sessions are reused in LB mode", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "assertSameLsidOnLastTwoCommands", + "object": "testRunner", + "arguments": { + "client": "client0" + } + } + ] + }, + { + "description": "all operations go to the same mongos", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "transaction can be committed multiple times", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is not released after a non-transient CRUD error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 51 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + }, + "expectError": { + "errorCode": 51, + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is not released after a non-transient commit error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 51 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0", + "expectError": { + "errorCode": 51, + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a non-transient abort error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 51 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient non-network CRUD error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 24 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + }, + "expectError": { + "errorCode": 24, + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient network CRUD error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + }, + "expectError": { + "isClientError": true, + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient non-network commit error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 24 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0", + "expectError": { + "errorCode": 24, + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient network commit error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0", + "ignoreResultAndError": true + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient non-network abort error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 24 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient network abort error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released on successful abort", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is returned when a new transaction is started", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is returned when a non-transaction operation uses the session", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "a connection can be shared by a transaction and a cursor", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2, + "session": "session0" + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/transactions.yml b/test/spec/load-balancers/transactions.yml new file mode 100644 index 00000000000..90f9d4a09ed --- /dev/null +++ b/test/spec/load-balancers/transactions.yml @@ -0,0 +1,592 @@ +description: transactions are correctly pinned to connections for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + # Do not observe commandSucceededEvent or commandFailedEvent because we cannot guarantee success or failure of + # commands like commitTransaction and abortTransaction in a multi-mongos load-balanced setup. + - commandStartedEvent + - connectionReadyEvent + - connectionClosedEvent + - connectionCheckedOutEvent + - connectionCheckedInEvent + - session: + id: &session0 session0 + client: *client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + +_yamlAnchors: + documents: + - &insertDocument + _id: 4 + +tests: + - description: sessions are reused in LB mode + operations: + - &nonTransactionalInsert + name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + - *nonTransactionalInsert + - name: assertSameLsidOnLastTwoCommands + object: testRunner + arguments: + client: *client0 + + - description: all operations go to the same mongos + operations: + - &startTransaction + name: startTransaction + object: *session0 + - &transactionalInsert + name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + session: *session0 + - &assertConnectionPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 + - *transactionalInsert + - *transactionalInsert + - *transactionalInsert + - *transactionalInsert + - *transactionalInsert + - *assertConnectionPinned + - &commitTransaction + name: commitTransaction + object: *session0 + expectEvents: + - client: *client0 + events: + - &insertStarted + commandStartedEvent: + commandName: insert + - *insertStarted + - *insertStarted + - *insertStarted + - *insertStarted + - *insertStarted + - &commitStarted + commandStartedEvent: + commandName: commitTransaction + - client: *client0 + eventType: cmap + events: + # The connection is never checked back in. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + + - description: transaction can be committed multiple times + operations: + - *startTransaction + - *transactionalInsert + - *assertConnectionPinned + - *commitTransaction + - *assertConnectionPinned + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *assertConnectionPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - *commitStarted + - *commitStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + + - description: pinned connection is not released after a non-transient CRUD error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ insert ] + errorCode: &nonTransientErrorCode 51 # ManualInterventionRequired + - *startTransaction + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + session: *session0 + expectError: &nonTransientExpectedError + errorCode: *nonTransientErrorCode + errorLabelsOmit: [ TransientTransactionError ] + - *assertConnectionPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the fail point. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the transactional insert. + - connectionCheckedOutEvent: {} + + - description: pinned connection is not released after a non-transient commit error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ commitTransaction ] + errorCode: *nonTransientErrorCode + - *startTransaction + - *transactionalInsert + - name: commitTransaction + object: *session0 + expectError: *nonTransientExpectedError + - *assertConnectionPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the fail point. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the transactional insert and commit. + - connectionCheckedOutEvent: {} + + # Errors during abort are different than errors during commit and CRUD operations because the pinned connection is + # always released after abort. + - description: pinned connection is released after a non-transient abort error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ abortTransaction ] + errorCode: &nonTransientErrorCode 51 # ManualInterventionRequired + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - &assertConnectionNotPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - *insertStarted + - &abortStarted + commandStartedEvent: + commandName: abortTransaction + - client: *client0 + eventType: cmap + events: + # Events for setting the fail point. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the transactional insert and abort. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient non-network CRUD error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ insert ] + errorCode: &transientErrorCode 24 # LockTimeout + - *startTransaction + - <<: *transactionalInsert + expectError: &transientExpectedServerError + errorCode: *transientErrorCode + errorLabelsContain: [ TransientTransactionError ] + - *assertConnectionNotPinned + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for abortTransction. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient network CRUD error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ insert ] + closeConnection: true + - *startTransaction + - <<: *transactionalInsert + expectError: &transientExpectedNetworkError + isClientError: true + errorLabelsContain: [ TransientTransactionError ] + - *assertConnectionNotPinned + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + # Events for abortTransaction + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient non-network commit error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ commitTransaction ] + errorCode: *transientErrorCode + - *startTransaction + - *transactionalInsert + - <<: *commitTransaction + expectError: *transientExpectedServerError + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for commitTransaction. + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient network commit error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ commitTransaction ] + closeConnection: true + - *startTransaction + - *transactionalInsert + - <<: *commitTransaction + # Ignore the result and error because the operation might fail if it targets a new mongos that isn't aware of + # the transaction or the server-side reaper thread closes the transaction first. We only want to assert that + # the operation is retried, which is done via monitoring expectations, so the exact result/error is not + # necessary. + ignoreResultAndError: true + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + # The commit will be automatically retried. + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for the first commitTransaction. + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + # Events for the commitTransaction retry. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient non-network abort error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ abortTransaction ] + errorCode: *transientErrorCode + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for abortTransaction. + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient network abort error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ abortTransaction ] + closeConnection: true + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + # The abort will be automatically retried. + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for the first abortTransaction. + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + # Events for the abortTransaction retry. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released on successful abort + operations: + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # The insert will create and pin a connection. The abort will use it and then unpin. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is returned when a new transaction is started + operations: + - *startTransaction + - *transactionalInsert + - *commitTransaction + - *assertConnectionPinned + - *startTransaction + - *assertConnectionNotPinned # startTransaction will unpin the connection. + - *transactionalInsert + - *assertConnectionPinned # The first operation in the new transaction will pin the connection again. + - *commitTransaction + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - *insertStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for the first insert and commit. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for startTransaction. + - connectionCheckedInEvent: {} + # Events for the second insert and commit. + - connectionCheckedOutEvent: {} + + - description: pinned connection is returned when a non-transaction operation uses the session + operations: + - *startTransaction + - *transactionalInsert + - *commitTransaction + - *assertConnectionPinned + - *transactionalInsert + # The insert is a non-transactional operation that uses the session, so it unpins the connection. + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - *insertStarted + - client: *client0 + eventType: cmap + events: + # Events for the first insert and commit. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for the second insert. + - connectionCheckedInEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: a connection can be shared by a transaction and a cursor + operations: + - *startTransaction + - *transactionalInsert + - *assertConnectionPinned + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + session: *session0 + saveResultAsEntity: &cursor0 cursor0 + - *assertConnectionPinned + - name: close + object: *cursor0 + - *assertConnectionPinned + # Abort the transaction to ensure that the connection is unpinned. + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - commandStartedEvent: + commandName: find + - commandStartedEvent: + commandName: killCursors + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for the insert, find, and killCursors. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for abortTransaction. + - connectionCheckedInEvent: {} diff --git a/test/spec/load-balancers/wait-queue-timeouts.json b/test/spec/load-balancers/wait-queue-timeouts.json new file mode 100644 index 00000000000..3dc6e46cffe --- /dev/null +++ b/test/spec/load-balancers/wait-queue-timeouts.json @@ -0,0 +1,153 @@ +{ + "description": "wait queue timeout errors include details about checked out connections", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "uriOptions": { + "maxPoolSize": 1, + "waitQueueTimeoutMS": 50 + }, + "observeEvents": [ + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent" + ] + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "wait queue timeout errors include cursor statistics", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true, + "errorContains": "maxPoolSize: 1, connections in use by cursors: 1, connections in use by transactions: 0, connections in use by other operations: 0" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckOutFailedEvent": {} + } + ] + } + ] + }, + { + "description": "wait queue timeout errors include transaction statistics", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true, + "errorContains": "maxPoolSize: 1, connections in use by cursors: 0, connections in use by transactions: 1, connections in use by other operations: 0" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckOutFailedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/wait-queue-timeouts.yml b/test/spec/load-balancers/wait-queue-timeouts.yml new file mode 100644 index 00000000000..9d8c935feaa --- /dev/null +++ b/test/spec/load-balancers/wait-queue-timeouts.yml @@ -0,0 +1,82 @@ +description: wait queue timeout errors include details about checked out connections + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + uriOptions: + maxPoolSize: 1 + waitQueueTimeoutMS: 50 + observeEvents: + - connectionCheckedOutEvent + - connectionCheckOutFailedEvent + - session: + id: &session0 session0 + client: *client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - _id: 1 + - _id: 2 + - _id: 3 + +tests: + - description: wait queue timeout errors include cursor statistics + operations: + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectError: + isClientError: true + errorContains: 'maxPoolSize: 1, connections in use by cursors: 1, connections in use by transactions: 0, connections in use by other operations: 0' + expectEvents: + - client: *client0 + eventType: cmap + events: + - connectionCheckedOutEvent: {} + - connectionCheckOutFailedEvent: {} + + - description: wait queue timeout errors include transaction statistics + operations: + - name: startTransaction + object: *session0 + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + session: *session0 + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectError: + isClientError: true + errorContains: 'maxPoolSize: 1, connections in use by cursors: 0, connections in use by transactions: 1, connections in use by other operations: 0' + expectEvents: + - client: *client0 + eventType: cmap + events: + - connectionCheckedOutEvent: {} + - connectionCheckOutFailedEvent: {} diff --git a/test/spec/retryable-reads/README.rst b/test/spec/retryable-reads/README.rst index ffb842c3031..0f56d23b0d6 100644 --- a/test/spec/retryable-reads/README.rst +++ b/test/spec/retryable-reads/README.rst @@ -74,9 +74,10 @@ Each YAML file has the following keys: version. - ``topology`` (optional): An array of server topologies against which the - tests can be run successfully. Valid topologies are "single", "replicaset", - and "sharded". If this field is omitted, the default is all topologies (i.e. - ``["single", "replicaset", "sharded"]``). + tests can be run successfully. Valid topologies are "single", + "replicaset", "sharded", and "load-balanced". If this field is omitted, + the default is all topologies (i.e. ``["single", "replicaset", "sharded", + "load-balanced"]``). - ``database_name`` and ``collection_name``: Optional. The database and collection to use for testing. @@ -150,12 +151,14 @@ data. Speeding Up Tests ----------------- -Drivers may benefit reducing `minHeartbeatFrequencyMS`_ in order to speed up -tests. Python was able to decrease the run time of the tests greatly by lowering -the SDAM's ``minHeartbeatFrequencyMS`` from 500ms to 50ms, thus decreasing the -waiting time after a "not master" error: +Drivers can greatly reduce the execution time of tests by setting `heartbeatFrequencyMS`_ +and `minHeartbeatFrequencyMS`_ (internally) to a small value (e.g. 5ms), below what +is normally permitted in the SDAM spec. If a test specifies an explicit value for +heartbeatFrequencyMS (e.g. client or URI options), drivers MUST use that value. + +.. _minHeartbeatFrequencyMS: ../../server-discovery-and-monitoring/server-discovery-and-monitoring.rst#minheartbeatfrequencyms +.. _heartbeatFrequencyMS: ../../server-discovery-and-monitoring/server-discovery-and-monitoring.rst#heartbeatfrequencyms -.. _minHeartbeatFrequencyMS: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#minheartbeatfrequencyms Optional Enumeration Commands ============================= @@ -171,3 +174,7 @@ Changelog now expressed within ``runOn`` elements. Add test-level ``useMultipleMongoses`` field. + +:2020-09-16: Suggest lowering heartbeatFrequencyMS in addition to minHeartbeatFrequencyMS. + +:2021-04-23: Add ``load-balanced`` to test topology requirements. diff --git a/test/spec/retryable-reads/aggregate-serverErrors.json b/test/spec/retryable-reads/aggregate-serverErrors.json index 04208bc95b8..67636d5b7dc 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.json +++ b/test/spec/retryable-reads/aggregate-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/aggregate-serverErrors.yml b/test/spec/retryable-reads/aggregate-serverErrors.yml index 5d0619646b0..b64b7b3adc4 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.yml +++ b/test/spec/retryable-reads/aggregate-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/aggregate.json b/test/spec/retryable-reads/aggregate.json index 30a6e05e695..f23d5c67939 100644 --- a/test/spec/retryable-reads/aggregate.json +++ b/test/spec/retryable-reads/aggregate.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/aggregate.yml b/test/spec/retryable-reads/aggregate.yml index df7cc8e2c88..c8443e3fbf3 100644 --- a/test/spec/retryable-reads/aggregate.yml +++ b/test/spec/retryable-reads/aggregate.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json index cf6c230ec8f..17bc53fd4bd 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml index 50ca49dff7e..61fe2358a1c 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-client.watch.json b/test/spec/retryable-reads/changeStreams-client.watch.json index 9a2ccad0950..9a07053f843 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.json +++ b/test/spec/retryable-reads/changeStreams-client.watch.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-client.watch.yml b/test/spec/retryable-reads/changeStreams-client.watch.yml index 865619e721c..5550bfa100e 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json index eb7df1e2643..5b405e3feba 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml index 3926db122c6..37ad0ae00d0 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.json b/test/spec/retryable-reads/changeStreams-db.coll.watch.json index 3408c842362..5e69d9da260 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml index bffa40b5bdf..50258cca2ec 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json index e070f56a01b..56fa6629010 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml index f8e6de76749..7ee9df0743b 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.watch.json b/test/spec/retryable-reads/changeStreams-db.watch.json index bec09c49b76..1777e1832e0 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.watch.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.watch.yml b/test/spec/retryable-reads/changeStreams-db.watch.yml index b180114618b..e46c5141690 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/count-serverErrors.json b/test/spec/retryable-reads/count-serverErrors.json index 839680fe59f..565323640e4 100644 --- a/test/spec/retryable-reads/count-serverErrors.json +++ b/test/spec/retryable-reads/count-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/count-serverErrors.yml b/test/spec/retryable-reads/count-serverErrors.yml index ff40f9d0736..4f7f5c9c940 100644 --- a/test/spec/retryable-reads/count-serverErrors.yml +++ b/test/spec/retryable-reads/count-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/count.json b/test/spec/retryable-reads/count.json index 0ccf4982ba6..139a5451318 100644 --- a/test/spec/retryable-reads/count.json +++ b/test/spec/retryable-reads/count.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/count.yml b/test/spec/retryable-reads/count.yml index 365905c5677..c9c3936b6b0 100644 --- a/test/spec/retryable-reads/count.yml +++ b/test/spec/retryable-reads/count.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.json b/test/spec/retryable-reads/countDocuments-serverErrors.json index f45eadfa0c2..107372ef30a 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.json +++ b/test/spec/retryable-reads/countDocuments-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.yml b/test/spec/retryable-reads/countDocuments-serverErrors.yml index 4c0d88f89ce..6d5e309cf98 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.yml +++ b/test/spec/retryable-reads/countDocuments-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/countDocuments.json b/test/spec/retryable-reads/countDocuments.json index b4ccf36684d..57a64e45b79 100644 --- a/test/spec/retryable-reads/countDocuments.json +++ b/test/spec/retryable-reads/countDocuments.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/countDocuments.yml b/test/spec/retryable-reads/countDocuments.yml index 07b3662704e..9e2565129c8 100644 --- a/test/spec/retryable-reads/countDocuments.yml +++ b/test/spec/retryable-reads/countDocuments.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/distinct-serverErrors.json b/test/spec/retryable-reads/distinct-serverErrors.json index 50fd6a55051..109231c6702 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.json +++ b/test/spec/retryable-reads/distinct-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/distinct-serverErrors.yml b/test/spec/retryable-reads/distinct-serverErrors.yml index 7232bdcb362..3de14aeb08e 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.yml +++ b/test/spec/retryable-reads/distinct-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/distinct.json b/test/spec/retryable-reads/distinct.json index b5885e27eb7..1fd415da812 100644 --- a/test/spec/retryable-reads/distinct.json +++ b/test/spec/retryable-reads/distinct.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/distinct.yml b/test/spec/retryable-reads/distinct.yml index aaca90701f1..8ca2ac83159 100644 --- a/test/spec/retryable-reads/distinct.yml +++ b/test/spec/retryable-reads/distinct.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/find-serverErrors.json b/test/spec/retryable-reads/find-serverErrors.json index 44ecf34d2fb..914b91da05a 100644 --- a/test/spec/retryable-reads/find-serverErrors.json +++ b/test/spec/retryable-reads/find-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/find-serverErrors.yml b/test/spec/retryable-reads/find-serverErrors.yml index 3a5ae17303c..17819ea8620 100644 --- a/test/spec/retryable-reads/find-serverErrors.yml +++ b/test/spec/retryable-reads/find-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/find.json b/test/spec/retryable-reads/find.json index 56479ff1d87..00d419c0da6 100644 --- a/test/spec/retryable-reads/find.json +++ b/test/spec/retryable-reads/find.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/find.yml b/test/spec/retryable-reads/find.yml index 0f985a91a86..b685c07b6af 100644 --- a/test/spec/retryable-reads/find.yml +++ b/test/spec/retryable-reads/find.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/findOne-serverErrors.json b/test/spec/retryable-reads/findOne-serverErrors.json index b8229483d24..4c0c07234ed 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.json +++ b/test/spec/retryable-reads/findOne-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/findOne-serverErrors.yml b/test/spec/retryable-reads/findOne-serverErrors.yml index a15d8511ed2..63ced439c98 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.yml +++ b/test/spec/retryable-reads/findOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/findOne.json b/test/spec/retryable-reads/findOne.json index d296a9cdb5e..b9deb73d2ab 100644 --- a/test/spec/retryable-reads/findOne.json +++ b/test/spec/retryable-reads/findOne.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/findOne.yml b/test/spec/retryable-reads/findOne.yml index ec348fedf15..911314e98e7 100644 --- a/test/spec/retryable-reads/findOne.yml +++ b/test/spec/retryable-reads/findOne.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.json b/test/spec/retryable-reads/gridfs-download-serverErrors.json index 84e50e370c4..d54928b1268 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.yml b/test/spec/retryable-reads/gridfs-download-serverErrors.yml index 11789f6e4ff..aa949a5632f 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/gridfs-download.json b/test/spec/retryable-reads/gridfs-download.json index a5c5ef4d559..4d0d5a17e4d 100644 --- a/test/spec/retryable-reads/gridfs-download.json +++ b/test/spec/retryable-reads/gridfs-download.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-download.yml b/test/spec/retryable-reads/gridfs-download.yml index bd75e8f0171..a71c719d9ad 100644 --- a/test/spec/retryable-reads/gridfs-download.yml +++ b/test/spec/retryable-reads/gridfs-download.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json index de439ce4b20..1325ab89abb 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml index bea6c3baa85..a66ba9b1402 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/gridfs-downloadByName.json b/test/spec/retryable-reads/gridfs-downloadByName.json index 0634a09bff4..48f2168cfc3 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName.json +++ b/test/spec/retryable-reads/gridfs-downloadByName.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-downloadByName.yml b/test/spec/retryable-reads/gridfs-downloadByName.yml index 98970d25aaa..e5586954f06 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName.yml +++ b/test/spec/retryable-reads/gridfs-downloadByName.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.json b/test/spec/retryable-reads/listCollectionNames-serverErrors.json index 27c13d6301c..90ccda71399 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml index cdfcc9c6d4a..889d2a5b5ce 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollectionNames.json b/test/spec/retryable-reads/listCollectionNames.json index 437fc36a40e..73d96a3cf7a 100644 --- a/test/spec/retryable-reads/listCollectionNames.json +++ b/test/spec/retryable-reads/listCollectionNames.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionNames.yml b/test/spec/retryable-reads/listCollectionNames.yml index 40886beb3bb..434adfbdd17 100644 --- a/test/spec/retryable-reads/listCollectionNames.yml +++ b/test/spec/retryable-reads/listCollectionNames.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json index 3922713df9c..6ca8c242fab 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml index a1c2553cbe7..97fb0778e4e 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollectionObjects.json b/test/spec/retryable-reads/listCollectionObjects.json index 1f537b743f0..1fb0f184374 100644 --- a/test/spec/retryable-reads/listCollectionObjects.json +++ b/test/spec/retryable-reads/listCollectionObjects.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionObjects.yml b/test/spec/retryable-reads/listCollectionObjects.yml index 9a3ca62a4d7..885c0489afe 100644 --- a/test/spec/retryable-reads/listCollectionObjects.yml +++ b/test/spec/retryable-reads/listCollectionObjects.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollections-serverErrors.json b/test/spec/retryable-reads/listCollections-serverErrors.json index 6972073b181..1938fa4ab4b 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.json +++ b/test/spec/retryable-reads/listCollections-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollections-serverErrors.yml b/test/spec/retryable-reads/listCollections-serverErrors.yml index 057264d6a03..bb35d8dbc71 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.yml +++ b/test/spec/retryable-reads/listCollections-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollections.json b/test/spec/retryable-reads/listCollections.json index a6b452e64f0..2427883621c 100644 --- a/test/spec/retryable-reads/listCollections.json +++ b/test/spec/retryable-reads/listCollections.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollections.yml b/test/spec/retryable-reads/listCollections.yml index cd8a964fe78..378ff924f45 100644 --- a/test/spec/retryable-reads/listCollections.yml +++ b/test/spec/retryable-reads/listCollections.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json index 11faf58bf04..eef8b7fe750 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml index a746762f1ec..ef777f01757 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseNames.json b/test/spec/retryable-reads/listDatabaseNames.json index b35f7ab185f..b431f570161 100644 --- a/test/spec/retryable-reads/listDatabaseNames.json +++ b/test/spec/retryable-reads/listDatabaseNames.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseNames.yml b/test/spec/retryable-reads/listDatabaseNames.yml index 33c8e2edfc2..13e01a48eaf 100644 --- a/test/spec/retryable-reads/listDatabaseNames.yml +++ b/test/spec/retryable-reads/listDatabaseNames.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json index 38082f2e28b..054d1dc8b18 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml index 57c7df1376f..f413304d31f 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseObjects.json b/test/spec/retryable-reads/listDatabaseObjects.json index cbd2c6763a3..267fe921cab 100644 --- a/test/spec/retryable-reads/listDatabaseObjects.json +++ b/test/spec/retryable-reads/listDatabaseObjects.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseObjects.yml b/test/spec/retryable-reads/listDatabaseObjects.yml index 5bd648fe482..e4a31cfe213 100644 --- a/test/spec/retryable-reads/listDatabaseObjects.yml +++ b/test/spec/retryable-reads/listDatabaseObjects.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.json b/test/spec/retryable-reads/listDatabases-serverErrors.json index 4047f749ffc..9da07b7f50b 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.json +++ b/test/spec/retryable-reads/listDatabases-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.yml b/test/spec/retryable-reads/listDatabases-serverErrors.yml index a49ec501385..a5ed406c847 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabases-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabases.json b/test/spec/retryable-reads/listDatabases.json index 3cb8bbd083c..69ef9788f8d 100644 --- a/test/spec/retryable-reads/listDatabases.json +++ b/test/spec/retryable-reads/listDatabases.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabases.yml b/test/spec/retryable-reads/listDatabases.yml index 7d8845a613e..3eaed913add 100644 --- a/test/spec/retryable-reads/listDatabases.yml +++ b/test/spec/retryable-reads/listDatabases.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.json b/test/spec/retryable-reads/listIndexNames-serverErrors.json index 1a9ba83bc69..3737e0059e1 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.json +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.yml b/test/spec/retryable-reads/listIndexNames-serverErrors.yml index e03bbed48ed..5420d01aa73 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexNames.json b/test/spec/retryable-reads/listIndexNames.json index 912c706015f..fbdb420f8ad 100644 --- a/test/spec/retryable-reads/listIndexNames.json +++ b/test/spec/retryable-reads/listIndexNames.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexNames.yml b/test/spec/retryable-reads/listIndexNames.yml index 7c78a0fda61..3a73b51e15a 100644 --- a/test/spec/retryable-reads/listIndexNames.yml +++ b/test/spec/retryable-reads/listIndexNames.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.json b/test/spec/retryable-reads/listIndexes-serverErrors.json index 16b61d535d6..6ac0b0a3f99 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.json +++ b/test/spec/retryable-reads/listIndexes-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.yml b/test/spec/retryable-reads/listIndexes-serverErrors.yml index 39222232003..7e203ae1d5c 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexes-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexes.json b/test/spec/retryable-reads/listIndexes.json index f460ea7684f..5cb620ae45a 100644 --- a/test/spec/retryable-reads/listIndexes.json +++ b/test/spec/retryable-reads/listIndexes.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexes.yml b/test/spec/retryable-reads/listIndexes.yml index 95e823b666a..84ba7242a38 100644 --- a/test/spec/retryable-reads/listIndexes.yml +++ b/test/spec/retryable-reads/listIndexes.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/mapReduce.json b/test/spec/retryable-reads/mapReduce.json index 9dc7a56f3c2..e76aa76cbb9 100644 --- a/test/spec/retryable-reads/mapReduce.json +++ b/test/spec/retryable-reads/mapReduce.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/mapReduce.yml b/test/spec/retryable-reads/mapReduce.yml index a69e7ef61ce..968d3d50371 100644 --- a/test/spec/retryable-reads/mapReduce.yml +++ b/test/spec/retryable-reads/mapReduce.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-writes/README.rst b/test/spec/retryable-writes/README.rst index 2f431ba39d4..88d8e52fc88 100644 --- a/test/spec/retryable-writes/README.rst +++ b/test/spec/retryable-writes/README.rst @@ -91,6 +91,11 @@ disabled like so:: mode: "off" }); +Speeding Up Tests +================= + +See `Speeding Up Tests <../../retryable-reads/tests/README.rst#speeding-up-tests>`_ in the retryable reads spec tests. + Use as Integration Tests ======================== @@ -154,9 +159,10 @@ Each YAML file has the following keys: version. - ``topology`` (optional): An array of server topologies against which the - tests can be run successfully. Valid topologies are "single", "replicaset", - and "sharded". If this field is omitted, the default is all topologies (i.e. - ``["single", "replicaset", "sharded"]``). + tests can be run successfully. Valid topologies are "single", + "replicaset", "sharded", and "load-balanced". If this field is omitted, + the default is all topologies (i.e. ``["single", "replicaset", "sharded", + "load-balanced"]``). - ``data``: The data that should exist in the collection under test before each test run. @@ -325,6 +331,8 @@ and sharded clusters. Changelog ========= +:2021-04-23: Add ``load-balanced`` to test topology requirements. + :2019-10-21: Add ``errorLabelsContain`` and ``errorLabelsContain`` fields to ``result`` :2019-08-07: Add Prose Tests section diff --git a/test/spec/retryable-writes/bulkWrite-errorLabels.json b/test/spec/retryable-writes/bulkWrite-errorLabels.json index 94ea3ea989f..66c3ecb336a 100644 --- a/test/spec/retryable-writes/bulkWrite-errorLabels.json +++ b/test/spec/retryable-writes/bulkWrite-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/bulkWrite-errorLabels.yml b/test/spec/retryable-writes/bulkWrite-errorLabels.yml index 60fc18d73f7..fb9d7e47e06 100644 --- a/test/spec/retryable-writes/bulkWrite-errorLabels.yml +++ b/test/spec/retryable-writes/bulkWrite-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/bulkWrite-serverErrors.json b/test/spec/retryable-writes/bulkWrite-serverErrors.json index d9561d568c0..9d792ceafbb 100644 --- a/test/spec/retryable-writes/bulkWrite-serverErrors.json +++ b/test/spec/retryable-writes/bulkWrite-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/bulkWrite-serverErrors.yml b/test/spec/retryable-writes/bulkWrite-serverErrors.yml index e2f3a601dcb..0235a8a1ce8 100644 --- a/test/spec/retryable-writes/bulkWrite-serverErrors.yml +++ b/test/spec/retryable-writes/bulkWrite-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/deleteMany.json b/test/spec/retryable-writes/deleteMany.json index 642ad11fb47..faa21c44f1e 100644 --- a/test/spec/retryable-writes/deleteMany.json +++ b/test/spec/retryable-writes/deleteMany.json @@ -4,7 +4,8 @@ "minServerVersion": "3.6", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/deleteMany.yml b/test/spec/retryable-writes/deleteMany.yml index c206fa56bb5..4743953fffe 100644 --- a/test/spec/retryable-writes/deleteMany.yml +++ b/test/spec/retryable-writes/deleteMany.yml @@ -1,7 +1,7 @@ runOn: - minServerVersion: "3.6" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/deleteOne-errorLabels.json b/test/spec/retryable-writes/deleteOne-errorLabels.json index bff02e1f94d..c14692fd1a8 100644 --- a/test/spec/retryable-writes/deleteOne-errorLabels.json +++ b/test/spec/retryable-writes/deleteOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/deleteOne-errorLabels.yml b/test/spec/retryable-writes/deleteOne-errorLabels.yml index 195f0c7912f..9ee5c7426e4 100644 --- a/test/spec/retryable-writes/deleteOne-errorLabels.yml +++ b/test/spec/retryable-writes/deleteOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/deleteOne-serverErrors.json b/test/spec/retryable-writes/deleteOne-serverErrors.json index 69d225759c4..4eab2fa296a 100644 --- a/test/spec/retryable-writes/deleteOne-serverErrors.json +++ b/test/spec/retryable-writes/deleteOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/deleteOne-serverErrors.yml b/test/spec/retryable-writes/deleteOne-serverErrors.yml index 4ef220bd22b..73cab927e72 100644 --- a/test/spec/retryable-writes/deleteOne-serverErrors.yml +++ b/test/spec/retryable-writes/deleteOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndDelete-errorLabels.json b/test/spec/retryable-writes/findOneAndDelete-errorLabels.json index efa62dba2e6..60e6e0a7bc1 100644 --- a/test/spec/retryable-writes/findOneAndDelete-errorLabels.json +++ b/test/spec/retryable-writes/findOneAndDelete-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml b/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml index af86ee2ecb5..5192c5adfef 100644 --- a/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml +++ b/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndDelete-serverErrors.json b/test/spec/retryable-writes/findOneAndDelete-serverErrors.json index 0785e5d035c..4c108616141 100644 --- a/test/spec/retryable-writes/findOneAndDelete-serverErrors.json +++ b/test/spec/retryable-writes/findOneAndDelete-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml b/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml index 50943413523..5926026f083 100644 --- a/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml +++ b/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndReplace-errorLabels.json b/test/spec/retryable-writes/findOneAndReplace-errorLabels.json index d9473d139a0..afa2f47af44 100644 --- a/test/spec/retryable-writes/findOneAndReplace-errorLabels.json +++ b/test/spec/retryable-writes/findOneAndReplace-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml b/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml index afc0494e5b6..184366163f9 100644 --- a/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml +++ b/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndReplace-serverErrors.json b/test/spec/retryable-writes/findOneAndReplace-serverErrors.json index 6ebe057cfd4..64c69e2f6d7 100644 --- a/test/spec/retryable-writes/findOneAndReplace-serverErrors.json +++ b/test/spec/retryable-writes/findOneAndReplace-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml b/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml index c825922f934..5a483e60b6d 100644 --- a/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml +++ b/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json index 1926d7fa5c3..19b3a9e771c 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json +++ b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml index f0bff611567..03751d568ba 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml +++ b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json index e6e369c1393..9f546049924 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json +++ b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml index 916bddae419..3c1fbe82269 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml +++ b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/insertMany-errorLabels.json b/test/spec/retryable-writes/insertMany-errorLabels.json index c78946e90a3..65fd377fa60 100644 --- a/test/spec/retryable-writes/insertMany-errorLabels.json +++ b/test/spec/retryable-writes/insertMany-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertMany-errorLabels.yml b/test/spec/retryable-writes/insertMany-errorLabels.yml index 70551bad754..9f5e1636235 100644 --- a/test/spec/retryable-writes/insertMany-errorLabels.yml +++ b/test/spec/retryable-writes/insertMany-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/insertMany-serverErrors.json b/test/spec/retryable-writes/insertMany-serverErrors.json index 1c6ebafc28b..7b45b506c93 100644 --- a/test/spec/retryable-writes/insertMany-serverErrors.json +++ b/test/spec/retryable-writes/insertMany-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertMany-serverErrors.yml b/test/spec/retryable-writes/insertMany-serverErrors.yml index f05a859c1cd..140329fcb8d 100644 --- a/test/spec/retryable-writes/insertMany-serverErrors.yml +++ b/test/spec/retryable-writes/insertMany-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/insertOne-errorLabels.json b/test/spec/retryable-writes/insertOne-errorLabels.json index 9b8d13d5240..d90ac5dfbd8 100644 --- a/test/spec/retryable-writes/insertOne-errorLabels.json +++ b/test/spec/retryable-writes/insertOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertOne-errorLabels.yml b/test/spec/retryable-writes/insertOne-errorLabels.yml index 0aa7498a04b..87100aa5cf3 100644 --- a/test/spec/retryable-writes/insertOne-errorLabels.yml +++ b/test/spec/retryable-writes/insertOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: [] diff --git a/test/spec/retryable-writes/insertOne-serverErrors.json b/test/spec/retryable-writes/insertOne-serverErrors.json index cb1e6f826be..ce1a85639ee 100644 --- a/test/spec/retryable-writes/insertOne-serverErrors.json +++ b/test/spec/retryable-writes/insertOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertOne-serverErrors.yml b/test/spec/retryable-writes/insertOne-serverErrors.yml index a098f9b1483..0a52d9ac78a 100644 --- a/test/spec/retryable-writes/insertOne-serverErrors.yml +++ b/test/spec/retryable-writes/insertOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/replaceOne-errorLabels.json b/test/spec/retryable-writes/replaceOne-errorLabels.json index 06867e5159c..6029b875dcf 100644 --- a/test/spec/retryable-writes/replaceOne-errorLabels.json +++ b/test/spec/retryable-writes/replaceOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/replaceOne-errorLabels.yml b/test/spec/retryable-writes/replaceOne-errorLabels.yml index cb5d69ff377..41939092934 100644 --- a/test/spec/retryable-writes/replaceOne-errorLabels.yml +++ b/test/spec/retryable-writes/replaceOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/replaceOne-serverErrors.json b/test/spec/retryable-writes/replaceOne-serverErrors.json index af18bcf1a2e..7457228cd75 100644 --- a/test/spec/retryable-writes/replaceOne-serverErrors.json +++ b/test/spec/retryable-writes/replaceOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/replaceOne-serverErrors.yml b/test/spec/retryable-writes/replaceOne-serverErrors.yml index 6017efe52d6..292f96ecb0e 100644 --- a/test/spec/retryable-writes/replaceOne-serverErrors.yml +++ b/test/spec/retryable-writes/replaceOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/updateMany.json b/test/spec/retryable-writes/updateMany.json index 14288c2860d..46fef73e742 100644 --- a/test/spec/retryable-writes/updateMany.json +++ b/test/spec/retryable-writes/updateMany.json @@ -4,7 +4,8 @@ "minServerVersion": "3.6", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/updateMany.yml b/test/spec/retryable-writes/updateMany.yml index 31faee4bca5..f3ab39faa32 100644 --- a/test/spec/retryable-writes/updateMany.yml +++ b/test/spec/retryable-writes/updateMany.yml @@ -1,7 +1,7 @@ runOn: - minServerVersion: "3.6" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/updateOne-errorLabels.json b/test/spec/retryable-writes/updateOne-errorLabels.json index 4a6be3ffbaa..5bd00cde904 100644 --- a/test/spec/retryable-writes/updateOne-errorLabels.json +++ b/test/spec/retryable-writes/updateOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/updateOne-errorLabels.yml b/test/spec/retryable-writes/updateOne-errorLabels.yml index 810351e3164..6bfef3b1299 100644 --- a/test/spec/retryable-writes/updateOne-errorLabels.yml +++ b/test/spec/retryable-writes/updateOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/updateOne-serverErrors.json b/test/spec/retryable-writes/updateOne-serverErrors.json index bb442eb68a9..11601980199 100644 --- a/test/spec/retryable-writes/updateOne-serverErrors.json +++ b/test/spec/retryable-writes/updateOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/updateOne-serverErrors.yml b/test/spec/retryable-writes/updateOne-serverErrors.yml index 28eb1c7a0ad..35ed406a540 100644 --- a/test/spec/retryable-writes/updateOne-serverErrors.yml +++ b/test/spec/retryable-writes/updateOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json new file mode 100644 index 00000000000..d2e34478e64 --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json @@ -0,0 +1,28 @@ +{ + "description": "Load balancer can be discovered and only has the address property set", + "uri": "mongodb://a/?loadBalanced=true", + "phases": [ + { + "outcome": { + "servers": { + "a:27017": { + "type": "LoadBalancer", + "setName": null, + "setVersion": null, + "electionId": null, + "logicalSessionTimeoutMinutes": null, + "minWireVersion": null, + "maxWireVersion": null, + "topologyVersion": null + } + }, + "topologyType": "LoadBalanced", + "setName": null, + "logicalSessionTimeoutMinutes": null, + "maxSetVersion": null, + "maxElectionId": null, + "compatible": true + } + } + ] +} diff --git a/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml new file mode 100644 index 00000000000..549f4c7d8e2 --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml @@ -0,0 +1,22 @@ +description: "Load balancer can be discovered and only has the address property set" +uri: "mongodb://a/?loadBalanced=true" +phases: + # There should be no monitoring in LoadBalanced mode, so no responses are necessary to get the topology into the + # correct state. + - outcome: + servers: + a:27017: + type: LoadBalancer + setName: null + setVersion: null + electionId: null + logicalSessionTimeoutMinutes: null + minWireVersion: null + maxWireVersion: null + topologyVersion: null + topologyType: LoadBalanced + setName: null + logicalSessionTimeoutMinutes: null + maxSetVersion: null + maxElectionId: null + compatible: true diff --git a/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json new file mode 100644 index 00000000000..09b15371934 --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json @@ -0,0 +1,93 @@ +{ + "description": "Monitoring a load balancer", + "uri": "mongodb://a:27017/?loadBalanced=true", + "phases": [ + { + "outcome": { + "events": [ + { + "topology_opening_event": { + "topologyId": "42" + } + }, + { + "topology_description_changed_event": { + "topologyId": "42", + "previousDescription": { + "topologyType": "Unknown", + "servers": [] + }, + "newDescription": { + "topologyType": "LoadBalanced", + "servers": [ + { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "Unknown" + } + ] + } + } + }, + { + "server_opening_event": { + "topologyId": "42", + "address": "a:27017" + } + }, + { + "server_description_changed_event": { + "topologyId": "42", + "address": "a:27017", + "previousDescription": { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "Unknown" + }, + "newDescription": { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "LoadBalancer" + } + } + }, + { + "topology_description_changed_event": { + "topologyId": "42", + "previousDescription": { + "topologyType": "LoadBalanced", + "servers": [ + { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "Unknown" + } + ] + }, + "newDescription": { + "topologyType": "LoadBalanced", + "servers": [ + { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "LoadBalancer" + } + ] + } + } + } + ] + } + } + ] +} diff --git a/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml new file mode 100644 index 00000000000..b4eec2d2c6e --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml @@ -0,0 +1,65 @@ +description: "Monitoring a load balancer" +uri: "mongodb://a:27017/?loadBalanced=true" +phases: + - + outcome: + events: + - + topology_opening_event: + topologyId: "42" + - + topology_description_changed_event: + topologyId: "42" + previousDescription: + topologyType: "Unknown" + servers: [] + newDescription: + topologyType: "LoadBalanced" + servers: + - + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "Unknown" + - + server_opening_event: + topologyId: "42" + address: "a:27017" + - + server_description_changed_event: + topologyId: "42" + address: "a:27017" + previousDescription: + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "Unknown" + newDescription: + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "LoadBalancer" + - + topology_description_changed_event: + topologyId: "42" + previousDescription: + topologyType: "LoadBalanced" + servers: + - + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "Unknown" + newDescription: + topologyType: "LoadBalanced" + servers: + - + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "LoadBalancer" diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json new file mode 100644 index 00000000000..e52e343332a --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Nearest", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml new file mode 100644 index 00000000000..2e9a16d5e09 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: Nearest + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json new file mode 100644 index 00000000000..5a4a0aa93ac --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json @@ -0,0 +1,30 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "Primary" + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml new file mode 100644 index 00000000000..72ea728d6ef --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml @@ -0,0 +1,14 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: Primary +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json new file mode 100644 index 00000000000..9aa151cd06e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "PrimaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml new file mode 100644 index 00000000000..96e6ff54c20 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: PrimaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json new file mode 100644 index 00000000000..c49e30370b4 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "Secondary", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml new file mode 100644 index 00000000000..2f027d2dc7f --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: Secondary + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json new file mode 100644 index 00000000000..18e46877b49 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "SecondaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml new file mode 100644 index 00000000000..f3da0ec4b0e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json new file mode 100644 index 00000000000..e52e343332a --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Nearest", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml new file mode 100644 index 00000000000..8e7b59dc4aa --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: Nearest + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json new file mode 100644 index 00000000000..9061b25208e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json @@ -0,0 +1,30 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Primary" + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml new file mode 100644 index 00000000000..457eb53e588 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml @@ -0,0 +1,14 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: Primary +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json new file mode 100644 index 00000000000..5c94dc410df --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "PrimaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml new file mode 100644 index 00000000000..2a078d1f40e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: PrimaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json new file mode 100644 index 00000000000..5493867e12d --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Secondary", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml new file mode 100644 index 00000000000..dc67dbc9425 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: Secondary + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json new file mode 100644 index 00000000000..f7905f1d5f6 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "SecondaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml new file mode 100644 index 00000000000..77026a67c07 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json new file mode 100644 index 00000000000..d94863ed11e --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json @@ -0,0 +1,18 @@ +{ + "description": "entity-client-storeEventsAsEntities-minItems", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml new file mode 100644 index 00000000000..b52648f4f26 --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml @@ -0,0 +1,12 @@ +description: "entity-client-storeEventsAsEntities-minItems" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: [] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json new file mode 100644 index 00000000000..79f6b85ed20 --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json @@ -0,0 +1,18 @@ +{ + "description": "entity-client-storeEventsAsEntities-type", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": 0 + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml new file mode 100644 index 00000000000..8230566aee9 --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml @@ -0,0 +1,12 @@ +description: "entity-client-storeEventsAsEntities-type" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: 0 + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json new file mode 100644 index 00000000000..110ce7869e6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckOutFailedEvent-reason-type", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckOutFailedEvent": { + "reason": 10 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml new file mode 100644 index 00000000000..f86972968d0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckOutFailedEvent-reason-type + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckOutFailedEvent: + reason: 10 diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json new file mode 100644 index 00000000000..f84e208d6a6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckOutStartedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml new file mode 100644 index 00000000000..e3aa7e6bce3 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckOutStartedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json new file mode 100644 index 00000000000..56ffcdee72c --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckedInEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedInEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml new file mode 100644 index 00000000000..d610c94019c --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckedInEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckedInEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json new file mode 100644 index 00000000000..9b804aad0a5 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckedOutEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedOutEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml new file mode 100644 index 00000000000..560b8569e3d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckedOutEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckedOutEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json new file mode 100644 index 00000000000..053cd0b4132 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionClosedEvent-reason-type", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionClosedEvent": { + "reason": 10 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml new file mode 100644 index 00000000000..06a1d39266f --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionClosedEvent-reason-type + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionClosedEvent: + reason: 10 diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json new file mode 100644 index 00000000000..c2edc3f6aae --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCreatedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml new file mode 100644 index 00000000000..1ff92d5f628 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCreatedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCreatedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json new file mode 100644 index 00000000000..994fb633146 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionReadyEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml new file mode 100644 index 00000000000..2835190c06d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionReadyEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionReadyEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json new file mode 100644 index 00000000000..5a1a25d4638 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolClearedEvent-hasServiceId-type", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolClearedEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..156581d53ac --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolClearedEvent-hasServiceId-type + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolClearedEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json new file mode 100644 index 00000000000..c181707f4a2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolClosedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolClosedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml new file mode 100644 index 00000000000..1ff0220e598 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolClosedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolClosedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json new file mode 100644 index 00000000000..6aaa59a600b --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolCreatedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolCreatedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml new file mode 100644 index 00000000000..fd9c8c00465 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolCreatedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolCreatedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json new file mode 100644 index 00000000000..66c803a5d87 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolReadyEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolReadyEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml new file mode 100644 index 00000000000..dd2ad8a5dec --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolReadyEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolReadyEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json new file mode 100644 index 00000000000..9e45cbadda8 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json @@ -0,0 +1,27 @@ +{ + "description": "expectedCommandEvent-additionalProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "foo": 0 + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml new file mode 100644 index 00000000000..f68da7c7102 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml @@ -0,0 +1,15 @@ +description: "expectedCommandEvent-additionalProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json new file mode 100644 index 00000000000..a571d8e0c06 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandFailedEvent-commandName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandFailedEvent": { + "commandName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml new file mode 100644 index 00000000000..41fc57d3a1b --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandFailedEvent-commandName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandFailedEvent: + commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json new file mode 100644 index 00000000000..5314dc9f804 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandFailedEvent-hasServiceId-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandFailedEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..afb3292e541 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml @@ -0,0 +1,16 @@ +description: expectedCommandEvent-commandFailedEvent-hasServiceId-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: foo + operations: [] + expectEvents: + - client: *client0 + events: + - commandFailedEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json new file mode 100644 index 00000000000..996332d27da --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-additionalProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "foo": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml new file mode 100644 index 00000000000..d668092f6e0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-additionalProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json new file mode 100644 index 00000000000..8f89460617a --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-command-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml new file mode 100644 index 00000000000..ffedc4ac2d6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-command-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json new file mode 100644 index 00000000000..121947b06fd --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-commandName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml new file mode 100644 index 00000000000..97331a0ce12 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-commandName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json new file mode 100644 index 00000000000..97d2b84f681 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-databaseName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "databaseName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml new file mode 100644 index 00000000000..9a5786bb797 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-databaseName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + databaseName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json new file mode 100644 index 00000000000..39ab925efb1 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-hasServiceId-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..83d0c7a483d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml @@ -0,0 +1,16 @@ +description: expectedCommandEvent-commandStartedEvent-hasServiceId-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: foo + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json new file mode 100644 index 00000000000..bde2f4817b0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandSucceededEvent-commandName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandSucceededEvent": { + "commandName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml new file mode 100644 index 00000000000..f4e7dd93c99 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandSucceededEvent-commandName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandSucceededEvent: + commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json new file mode 100644 index 00000000000..edc9d3cd723 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandSucceededEvent-hasServiceId-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandSucceededEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..15dd9833694 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml @@ -0,0 +1,16 @@ +description: expectedCommandEvent-commandSucceededEvent-hasServiceId-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: foo + operations: [] + expectEvents: + - client: *client0 + events: + - commandSucceededEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json new file mode 100644 index 00000000000..9df04acd29e --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandSucceededEvent-reply-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandSucceededEvent": { + "reply": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml new file mode 100644 index 00000000000..477fe7919e9 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandSucceededEvent-reply-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandSucceededEvent: + reply: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json new file mode 100644 index 00000000000..dd8b0e7e7c3 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json @@ -0,0 +1,28 @@ +{ + "description": "expectedCommandEvent-maxProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": {}, + "commandSucceededEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml new file mode 100644 index 00000000000..62d5bb4fec2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-maxProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: {} + commandSucceededEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json new file mode 100644 index 00000000000..0f3e711a18c --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json @@ -0,0 +1,25 @@ +{ + "description": "expectedCommandEvent-minProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + {} + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml new file mode 100644 index 00000000000..3b7d08d412d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml @@ -0,0 +1,15 @@ +description: "expectedCommandEvent-minProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - {} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json index 6ecf5931fb6..90ed9c3273c 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json @@ -11,17 +11,12 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [], - "foo": 0 - } - ] + "client": "client0", + "events": [], + "foo": 0 } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml index a15835d1ca2..9784c02ec15 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml @@ -8,10 +8,8 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: [] - foo: 0 + operations: [] + expectEvents: + - client: *client0 + events: [] + foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json index b879db85987..24b6330de72 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json @@ -11,15 +11,10 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "events": [] - } - ] + "events": [] } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml index 57db7b07e26..beba7080b03 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml @@ -8,8 +8,6 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - events: [] + operations: [] + expectEvents: + - events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json index 4ee5427df14..6e66857ee69 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json @@ -11,16 +11,11 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": 0, - "events": [] - } - ] + "client": 0, + "events": [] } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml index 015fd7849b6..8d572fc4519 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml @@ -8,9 +8,7 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: 0 - events: [] + operations: [] + expectEvents: + - client: 0 + events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json new file mode 100644 index 00000000000..6e26cfaa7e3 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json @@ -0,0 +1,24 @@ +{ + "description": "expectedEventsForClient-eventType-enum", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid eventType value", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "foo", + "events": [] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml new file mode 100644 index 00000000000..792e7521306 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml @@ -0,0 +1,15 @@ +description: expectedEventsForClient-eventType-enum + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid eventType value + operations: [] + expectEvents: + - client: *client0 + eventType: foo + events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json new file mode 100644 index 00000000000..105bb001e5a --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json @@ -0,0 +1,24 @@ +{ + "description": "expectedEventsForClient-eventType-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid eventType type", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": 10, + "events": [] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml new file mode 100644 index 00000000000..ce1b0c97981 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml @@ -0,0 +1,15 @@ +description: expectedEventsForClient-eventType-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid eventType type + operations: [] + expectEvents: + - client: *client0 + eventType: 10 + events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json index ee8ce4a403c..c1fcd4a6c3b 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json @@ -11,17 +11,12 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - 0 - ] - } + "client": "client0", + "events": [ + 0 ] } ] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml index e5a6f4606b8..1c3b927f9af 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml @@ -8,9 +8,7 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: [0] + operations: [] + expectEvents: + - client: *client0 + events: [0] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json index 7f1bc6fb53a..39c1e9e12d6 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json @@ -11,15 +11,10 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0" - } - ] + "client": "client0" } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml index dd14eb2b8ee..86d162eba7f 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml @@ -8,8 +8,6 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 + operations: [] + expectEvents: + - client: *client0 diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json index f171fc2b935..4199d042b02 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json @@ -11,16 +11,11 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": 0 - } - ] + "client": "client0", + "events": 0 } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml index b51730f4ff7..24bd318ccf8 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml @@ -8,9 +8,7 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: 0 + operations: [] + expectEvents: + - client: *client0 + events: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json new file mode 100644 index 00000000000..b3802199120 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json @@ -0,0 +1,28 @@ +{ + "description": "expectedEventsForClient-events_conflicts_with_cmap_eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid event when eventType is cmap", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "commandStartedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml new file mode 100644 index 00000000000..681d23429d0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml @@ -0,0 +1,16 @@ +description: expectedEventsForClient-events_conflicts_with_cmap_eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid event when eventType is cmap + operations: [] + expectEvents: + - client: *client0 + eventType: cmap + events: + - commandStartedEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json new file mode 100644 index 00000000000..08446fe1804 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json @@ -0,0 +1,28 @@ +{ + "description": "expectedEventsForClient-events_conflicts_with_command_eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid event when eventType is command", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "command", + "events": [ + { + "poolCreatedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml new file mode 100644 index 00000000000..1e0788edc02 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml @@ -0,0 +1,16 @@ +description: expectedEventsForClient-events_conflicts_with_command_eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid event when eventType is command + operations: [] + expectEvents: + - client: *client0 + eventType: command + events: + - poolCreatedEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json new file mode 100644 index 00000000000..c31efbb8b7e --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json @@ -0,0 +1,27 @@ +{ + "description": "expectedEventsForClient-events_conflicts_with_default_eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid event when eventType is unset", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "poolCreatedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml new file mode 100644 index 00000000000..49048bf2d24 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml @@ -0,0 +1,15 @@ +description: expectedEventsForClient-events_conflicts_with_default_eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid event when eventType is unset + operations: [] + expectEvents: + - client: *client0 + events: + - poolCreatedEvent: {} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json new file mode 100644 index 00000000000..b47e6be2a1d --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json @@ -0,0 +1,19 @@ +{ + "description": "operation-ignoreResultAndError-conflicts_with_expectError", + "schemaVersion": "1.3", + "tests": [ + { + "description": "ignoreResultAndError used with expectError", + "operations": [ + { + "name": "foo", + "object": "bar", + "ignoreResultAndError": true, + "expectError": { + "isError": true + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml new file mode 100644 index 00000000000..75dd8340a05 --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml @@ -0,0 +1,12 @@ +description: operation-ignoreResultAndError-conflicts_with_expectError + +schemaVersion: '1.3' + +tests: + - description: ignoreResultAndError used with expectError + operations: + - name: foo + object: bar + ignoreResultAndError: true + expectError: + isError: true diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json new file mode 100644 index 00000000000..03c5a1dbbcf --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json @@ -0,0 +1,17 @@ +{ + "description": "operation-ignoreResultAndError-conflicts_with_expectResult", + "schemaVersion": "1.3", + "tests": [ + { + "description": "ignoreResultAndError used with expectResult", + "operations": [ + { + "name": "foo", + "object": "bar", + "ignoreResultAndError": true, + "expectResult": 1 + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml new file mode 100644 index 00000000000..6c51c07b8e4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml @@ -0,0 +1,11 @@ +description: operation-ignoreResultAndError-conflicts_with_expectResult + +schemaVersion: '1.3' + +tests: + - description: ignoreResultAndError used with expectResult + operations: + - name: foo + object: bar + ignoreResultAndError: true + expectResult: 1 diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json new file mode 100644 index 00000000000..6745dff2eb2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json @@ -0,0 +1,17 @@ +{ + "description": "operation-ignoreResultAndError-conflicts_with_saveResultAsEntity", + "schemaVersion": "1.3", + "tests": [ + { + "description": "ignoreResultAndError used with saveResultAsEntity", + "operations": [ + { + "name": "foo", + "object": "bar", + "ignoreResultAndError": true, + "saveResultAsEntity": "entity0" + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml new file mode 100644 index 00000000000..4f514352d0e --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml @@ -0,0 +1,11 @@ +description: operation-ignoreResultAndError-conflicts_with_saveResultAsEntity + +schemaVersion: '1.3' + +tests: + - description: ignoreResultAndError used with saveResultAsEntity + operations: + - name: foo + object: bar + ignoreResultAndError: true + saveResultAsEntity: entity0 diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json new file mode 100644 index 00000000000..e5475d079d4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-auth-type", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "auth": "foo" + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml new file mode 100644 index 00000000000..1a8a547fbca --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml @@ -0,0 +1,10 @@ +description: runOnRequirement-auth-type + +schemaVersion: '1.3' + +runOnRequirements: + - auth: foo + +tests: + - description: foo + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json new file mode 100644 index 00000000000..5357da8d8db --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json @@ -0,0 +1,26 @@ +{ + "description": "storeEventsAsEntity-additionalProperties", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [ + "CommandStartedEvent" + ], + "foo": 0 + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml new file mode 100644 index 00000000000..5c1b511efa6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml @@ -0,0 +1,15 @@ +description: "storeEventsAsEntity-additionalProperties" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: ["CommandStartedEvent"] + foo: 0 + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json new file mode 100644 index 00000000000..ee99a55381c --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json @@ -0,0 +1,25 @@ +{ + "description": "storeEventsAsEntity-events-enum", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [ + "foo" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml new file mode 100644 index 00000000000..efaa05a3414 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-events-enum" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: ["foo"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json new file mode 100644 index 00000000000..ddab042b1b4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json @@ -0,0 +1,23 @@ +{ + "description": "storeEventsAsEntity-events-minItems", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml new file mode 100644 index 00000000000..c4212476892 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-events-minItems" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: [] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json new file mode 100644 index 00000000000..90b45918ced --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json @@ -0,0 +1,22 @@ +{ + "description": "storeEventsAsEntity-events-required", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events" + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml new file mode 100644 index 00000000000..a6a1069c815 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml @@ -0,0 +1,13 @@ +description: "storeEventsAsEntity-events-required" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json new file mode 100644 index 00000000000..1b920ebd5d2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json @@ -0,0 +1,23 @@ +{ + "description": "storeEventsAsEntity-events-type", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": 0 + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml new file mode 100644 index 00000000000..aef85082b3f --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-events-type" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: 0 + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json new file mode 100644 index 00000000000..71387c53150 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json @@ -0,0 +1,24 @@ +{ + "description": "storeEventsAsEntity-id-required", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "events": [ + "CommandStartedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml new file mode 100644 index 00000000000..ef334226460 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml @@ -0,0 +1,13 @@ +description: "storeEventsAsEntity-id-required" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - events: ["CommandStartedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json new file mode 100644 index 00000000000..4f52dc25332 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json @@ -0,0 +1,25 @@ +{ + "description": "storeEventsAsEntity-id-type", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": 0, + "events": [ + "CommandStartedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml new file mode 100644 index 00000000000..1fbfdab6916 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-id-type" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: 0 + events: ["CommandStartedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json new file mode 100644 index 00000000000..9799bb2f651 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json @@ -0,0 +1,63 @@ +{ + "description": "assertNumberConnectionsCheckedOut", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + } + ], + "tests": [ + { + "description": "operation fails if client field is not specified", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "connections": 1 + } + } + ] + }, + { + "description": "operation fails if connections field is not specified", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0" + } + } + ] + }, + { + "description": "operation fails if client entity does not exist", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client1" + } + } + ] + }, + { + "description": "operation fails if number of connections is incorrect", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml new file mode 100644 index 00000000000..8a8aa63667a --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml @@ -0,0 +1,38 @@ +description: assertNumberConnectionsCheckedOut + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + +tests: + - description: operation fails if client field is not specified + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + connections: 1 + + - description: operation fails if connections field is not specified + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + + - description: operation fails if client entity does not exist + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: client1 + + - description: operation fails if number of connections is incorrect + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json new file mode 100644 index 00000000000..8c0c4d2041e --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json @@ -0,0 +1,28 @@ +{ + "description": "entity-client-storeEventsAsEntities-conflict_with_client_id", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0", + "events": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml new file mode 100644 index 00000000000..b7055c9db38 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml @@ -0,0 +1,16 @@ +description: "entity-client-storeEventsAsEntities-conflict_with_client_id" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + # Using the client ID here will ensure that test runners also detect + # conflicts with the same entity being defined + - id: *client0 + events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json new file mode 100644 index 00000000000..77bc4abf2ec --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json @@ -0,0 +1,43 @@ +{ + "description": "entity-client-storeEventsAsEntities-conflict_within_different_array", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "events", + "events": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent" + ] + } + ] + } + }, + { + "client": { + "id": "client1", + "storeEventsAsEntities": [ + { + "id": "events", + "events": [ + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml new file mode 100644 index 00000000000..8836445c9d1 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml @@ -0,0 +1,19 @@ +description: "entity-client-storeEventsAsEntities-conflict_within_different_array" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + - id: &events events + events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] + - client: + id: &client1 client1 + storeEventsAsEntities: + - id: *events + events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json new file mode 100644 index 00000000000..e1a94998830 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json @@ -0,0 +1,36 @@ +{ + "description": "entity-client-storeEventsAsEntities-conflict_within_same_array", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "events", + "events": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent" + ] + }, + { + "id": "events", + "events": [ + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml new file mode 100644 index 00000000000..25ee7400d39 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml @@ -0,0 +1,16 @@ +description: "entity-client-storeEventsAsEntities-conflict_within_same_array" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + - id: &events events + events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] + - id: *events + events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/entity-find-cursor.json b/test/spec/unified-test-format/valid-fail/entity-find-cursor.json new file mode 100644 index 00000000000..f4c5bcdf487 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-find-cursor.json @@ -0,0 +1,62 @@ +{ + "description": "entity-find-cursor", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "databaseName": "database0Name", + "collectionName": "coll0", + "documents": [] + } + ], + "tests": [ + { + "description": "createFindCursor fails if filter is not specified", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "saveResultAsEntity": "cursor0" + } + ] + }, + { + "description": "iterateUntilDocumentOrError fails if it references a nonexistent entity", + "operations": [ + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0" + } + ] + }, + { + "description": "close fails if it references a nonexistent entity", + "operations": [ + { + "name": "close", + "object": "cursor0" + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-find-cursor.yml b/test/spec/unified-test-format/valid-fail/entity-find-cursor.yml new file mode 100644 index 00000000000..ac35615feec --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-find-cursor.yml @@ -0,0 +1,37 @@ +description: entity-find-cursor + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - databaseName: *database0Name + collectionName: *collection0Name + documents: [] + +tests: + - description: createFindCursor fails if filter is not specified + operations: + - name: createFindCursor + object: *collection0 + saveResultAsEntity: &cursor0 cursor0 + + - description: iterateUntilDocumentOrError fails if it references a nonexistent entity + operations: + - name: iterateUntilDocumentOrError + object: cursor0 + + - description: close fails if it references a nonexistent entity + operations: + - name: close + object: cursor0 diff --git a/test/spec/unified-test-format/valid-fail/ignoreResultAndError.json b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.json new file mode 100644 index 00000000000..4457040b4fd --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.json @@ -0,0 +1,72 @@ +{ + "description": "ignoreResultAndError", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "operation errors are not ignored if ignoreResultAndError is false", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + }, + "ignoreResultAndError": false + } + ] + }, + { + "description": "malformed operation fails if ignoreResultAndError is true", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "foo": "bar" + }, + "ignoreResultAndError": true + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml new file mode 100644 index 00000000000..52498627a54 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml @@ -0,0 +1,43 @@ +description: ignoreResultAndError + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: operation errors are not ignored if ignoreResultAndError is false + operations: + - name: insertOne + object: *collection0 + arguments: + document: &insertDocument { _id: 1 } + - name: insertOne + object: *collection0 + arguments: + # Insert the same document to force a DuplicateKey error. + document: *insertDocument + ignoreResultAndError: false + + - description: malformed operation fails if ignoreResultAndError is true + operations: + - name: insertOne + object: *collection0 + arguments: + foo: bar + ignoreResultAndError: true diff --git a/test/spec/unified-test-format/valid-fail/operation-failure.json b/test/spec/unified-test-format/valid-fail/operation-failure.json new file mode 100644 index 00000000000..8f6cae1521c --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/operation-failure.json @@ -0,0 +1,56 @@ +{ + "description": "operation-failure", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-failure" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "tests": [ + { + "description": "Unsupported command", + "operations": [ + { + "name": "runCommand", + "object": "database0", + "arguments": { + "commandName": "unsupportedCommand", + "command": { + "unsupportedCommand": 1 + } + } + } + ] + }, + { + "description": "Unsupported query operator", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "$unsupportedQueryOperator": 1 + } + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/operation-failure.yml b/test/spec/unified-test-format/valid-fail/operation-failure.yml new file mode 100644 index 00000000000..b80f7794df7 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/operation-failure.yml @@ -0,0 +1,31 @@ +description: "operation-failure" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-failure + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: coll0 + +tests: + - description: "Unsupported command" + operations: + - name: runCommand + object: *database0 + arguments: + commandName: unsupportedCommand + command: { unsupportedCommand: 1 } + + - description: "Unsupported query operator" + operations: + - name: find + object: *collection0 + arguments: + filter: { $unsupportedQueryOperator: 1 } diff --git a/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json new file mode 100644 index 00000000000..a9fc063f330 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json @@ -0,0 +1,27 @@ +{ + "description": "assertNumberConnectionsCheckedOut", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + } + ], + "tests": [ + { + "description": "basic assertion succeeds", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml new file mode 100644 index 00000000000..603552fc202 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml @@ -0,0 +1,17 @@ +description: assertNumberConnectionsCheckedOut + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + +tests: + - description: basic assertion succeeds + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 diff --git a/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json new file mode 100644 index 00000000000..3209033def4 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json @@ -0,0 +1,71 @@ +{ + "description": "entity-client-cmap-events", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "events are captured during an operation", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml new file mode 100644 index 00000000000..277134551ce --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml @@ -0,0 +1,40 @@ +description: entity-client-cmap-events + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - connectionReadyEvent + - connectionCheckedOutEvent + - connectionCheckedInEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: events are captured during an operation + operations: + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectEvents: + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} diff --git a/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json new file mode 100644 index 00000000000..e37e5a1acd9 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json @@ -0,0 +1,67 @@ +{ + "description": "entity-client-storeEventsAsEntities", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [ + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent" + ] + } + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "test", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ], + "tests": [ + { + "description": "storeEventsAsEntities captures events", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": {} + }, + "expectResult": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml new file mode 100644 index 00000000000..52a9e0ddc7a --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml @@ -0,0 +1,37 @@ +description: "entity-client-storeEventsAsEntities" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + - id: client0_events + events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + +tests: + # Note: this test does not assert that the events are actually saved to the + # entity since there is presently no assertion syntax to do so. We are only + # asserting that the test executes successfully. + - description: "storeEventsAsEntities captures events" + operations: + - name: find + object: *collection0 + arguments: + filter: {} + expectResult: + - { _id: 1, x: 11 } diff --git a/test/spec/unified-test-format/valid-pass/entity-find-cursor.json b/test/spec/unified-test-format/valid-pass/entity-find-cursor.json new file mode 100644 index 00000000000..85b8f69d7f3 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-find-cursor.json @@ -0,0 +1,182 @@ +{ + "description": "entity-find-cursor", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "databaseName": "database0Name", + "collectionName": "coll0", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + } + ] + } + ], + "tests": [ + { + "description": "cursors can be created, iterated, and closed", + "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": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 3 + } + }, + { + "name": "close", + "object": "cursor0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find", + "databaseName": "database0Name" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "ns": { + "$$type": "string" + }, + "firstBatch": { + "$$type": "array" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + }, + { + "commandStartedEvent": { + "command": { + "killCursors": "coll0", + "cursors": { + "$$type": "array" + } + }, + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursorsKilled": { + "$$unsetOrMatches": { + "$$type": "array" + } + } + }, + "commandName": "killCursors" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/entity-find-cursor.yml b/test/spec/unified-test-format/valid-pass/entity-find-cursor.yml new file mode 100644 index 00000000000..61c9f8835ac --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-find-cursor.yml @@ -0,0 +1,89 @@ +description: entity-find-cursor + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - commandSucceededEvent + - commandFailedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - databaseName: *database0Name + collectionName: *collection0Name + documents: + - _id: 1 + - _id: 2 + - _id: 3 + - _id: 4 + - _id: 5 + +tests: + - description: cursors can be created, iterated, and closed + operations: + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 1 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 2 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 3 } + - name: close + object: *cursor0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: {} + batchSize: 2 + commandName: find + databaseName: *database0Name + - commandSucceededEvent: + reply: + cursor: + id: { $$type: long } + ns: { $$type: string } + firstBatch: { $$type: array } + commandName: find + - commandStartedEvent: + command: + getMore: { $$type: long } + collection: *collection0Name + commandName: getMore + - commandSucceededEvent: + reply: + cursor: + id: { $$type: long } + ns: { $$type: string } + nextBatch: { $$type: array } + commandName: getMore + - commandStartedEvent: + command: + killCursors: *collection0Name + cursors: { $$type: array } + commandName: killCursors + - commandSucceededEvent: + reply: + # No cursorsKilled field expected on pre-3.2 servers + cursorsKilled: { $$unsetOrMatches: { $$type: array } } + commandName: killCursors diff --git a/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json new file mode 100644 index 00000000000..fe308df9653 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json @@ -0,0 +1,126 @@ +{ + "description": "expectedEventsForClient-eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent", + "connectionReadyEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "eventType can be set to command and cmap", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "command", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll0", + "documents": [ + { + "_id": 1 + } + ] + }, + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + } + ] + } + ] + }, + { + "description": "eventType defaults to command if unset", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll0", + "documents": [ + { + "_id": 1 + } + ] + }, + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml new file mode 100644 index 00000000000..e437c80489b --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml @@ -0,0 +1,66 @@ +description: expectedEventsForClient-eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - commandStartedEvent + - connectionReadyEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: eventType can be set to command and cmap + operations: + - name: insertOne + object: *collection0 + arguments: + document: &insertDocument { _id: 1 } + expectEvents: + - client: *client0 + eventType: command + events: + - commandStartedEvent: + command: + insert: *collection0Name + documents: + - *insertDocument + commandName: insert + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + + - description: eventType defaults to command if unset + operations: + - name: insertOne + object: *collection0 + arguments: + document: *insertDocument + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection0Name + documents: + - *insertDocument + commandName: insert + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} diff --git a/test/spec/unified-test-format/valid-pass/ignoreResultAndError.json b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.json new file mode 100644 index 00000000000..2e9b1c58ab9 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.json @@ -0,0 +1,59 @@ +{ + "description": "ignoreResultAndError", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "operation errors are ignored if ignoreResultAndError is true", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + }, + "ignoreResultAndError": true + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml new file mode 100644 index 00000000000..847e296e720 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml @@ -0,0 +1,34 @@ +description: ignoreResultAndError + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: operation errors are ignored if ignoreResultAndError is true + operations: + - name: insertOne + object: *collection0 + arguments: + document: &insertDocument { _id: 1 } + - name: insertOne + object: *collection0 + arguments: + document: *insertDocument + ignoreResultAndError: true diff --git a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json index 499396e0baa..fe0a5ae9913 100644 --- a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json +++ b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json @@ -57,10 +57,11 @@ ], "tests": [ { - "description": "A successful find event with a getmore and the server kills the cursor", + "description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)", "runOnRequirements": [ { "minServerVersion": "3.1", + "maxServerVersion": "4.4.99", "topologies": [ "single", "replicaset" diff --git a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml index 19a282327c4..6d5e4373494 100644 --- a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml +++ b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml @@ -29,9 +29,10 @@ initialData: - { _id: 5, x: 55 } tests: - - description: "A successful find event with a getmore and the server kills the cursor" + - description: "A successful find event with a getmore and the server kills the cursor (<= 4.4)" runOnRequirements: - minServerVersion: "3.1" + maxServerVersion: "4.4.99" topologies: [ single, replicaset ] operations: - name: find diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.json b/test/spec/unified-test-format/valid-pass/poc-crud.json deleted file mode 100644 index 2ed86d6150d..00000000000 --- a/test/spec/unified-test-format/valid-pass/poc-crud.json +++ /dev/null @@ -1,446 +0,0 @@ -{ - "description": "poc-crud", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "database": { - "id": "database1", - "client": "client0", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - }, - { - "collection": { - "id": "collection2", - "database": "database0", - "collectionName": "coll2", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - }, - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "collectionName": "coll2", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - }, - { - "collectionName": "aggregate_out", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "BulkWrite with mixed ordered operations", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 2, - "insertedCount": 2, - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "3": 4 - } - }, - "matchedCount": 3, - "modifiedCount": 3, - "upsertedCount": 1, - "upsertedIds": { - "5": 4 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 34 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)", - "operations": [ - { - "name": "insertMany", - "object": "collection1", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": false - }, - "expectError": { - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "ReplaceOne prohibits atomic modifiers", - "operations": [ - { - "name": "replaceOne", - "object": "collection1", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "readConcern majority with out stage", - "runOnRequirements": [ - { - "minServerVersion": "4.1.0", - "topologies": [ - "replicaset", - "sharded-replicaset" - ] - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection2", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "aggregate_out" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll2", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "aggregate_out" - } - ], - "readConcern": { - "level": "majority" - } - }, - "commandName": "aggregate", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "aggregate_out", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $listLocalSessions", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "database1", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ] - }, - "expectResult": [ - { - "dummy": "dummy field" - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.yml b/test/spec/unified-test-format/valid-pass/poc-crud.yml deleted file mode 100644 index 7d101a077a5..00000000000 --- a/test/spec/unified-test-format/valid-pass/poc-crud.yml +++ /dev/null @@ -1,183 +0,0 @@ -description: "poc-crud" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 client0 - observeEvents: [ commandStartedEvent ] - - database: - id: &database0 database0 - client: *client0 - databaseName: &database0Name crud-tests - - database: - id: &database1 database1 - client: *client0 - databaseName: &database1Name admin - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection0Name coll0 - - collection: - id: &collection1 collection1 - database: *database0 - collectionName: &collection1Name coll1 - - collection: - id: &collection2 collection2 - database: *database0 - collectionName: &collection2Name coll2 - collectionOptions: - readConcern: { level: majority } - -initialData: - - collectionName: *collection0Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - collectionName: *collection1Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - collectionName: *collection2Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - collectionName: &out aggregate_out - databaseName: *database0Name - documents: [] - -tests: - - description: "BulkWrite with mixed ordered operations" - operations: - - name: bulkWrite - object: *collection0 - arguments: - requests: - - insertOne: - document: { _id: 3, x: 33 } - - updateOne: - filter: { _id: 2 } - update: { $inc: { x: 1 } } - - updateMany: - filter: { _id: { $gt: 1 } } - update: { $inc: { x: 1 } } - - insertOne: - document: { _id: 4, x: 44 } - - deleteMany: - filter: { x: { $nin: [ 24, 34 ] } } - - replaceOne: - filter: { _id: 4 } - replacement: { _id: 4, x: 44 } - upsert: true - ordered: true - expectResult: - deletedCount: 2 - insertedCount: 2 - insertedIds: { $$unsetOrMatches: { 0: 3, 3: 4 } } - matchedCount: 3 - modifiedCount: 3 - upsertedCount: 1 - upsertedIds: { 5: 4 } - outcome: - - collectionName: *collection0Name - databaseName: *database0Name - documents: - - {_id: 2, x: 24 } - - {_id: 3, x: 34 } - - {_id: 4, x: 44 } - - - description: "InsertMany continue-on-error behavior with unordered (duplicate key in requests)" - operations: - - name: insertMany - object: *collection1 - arguments: - documents: - - { _id: 2, x: 22 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - ordered: false - expectError: - expectResult: - deletedCount: 0 - insertedCount: 2 - # Since the map of insertedIds is generated before execution it - # could indicate inserts that did not actually succeed. We omit - # this field rather than expect drivers to provide an accurate - # map filtered by write errors. - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: { } - outcome: - - collectionName: *collection1Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "ReplaceOne prohibits atomic modifiers" - operations: - - name: replaceOne - object: *collection1 - arguments: - filter: { _id: 1 } - replacement: { $set: { x: 22 }} - expectError: - isClientError: true - expectEvents: - - client: *client0 - events: [] - outcome: - - collectionName: *collection1Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - - description: "readConcern majority with out stage" - runOnRequirements: - - minServerVersion: "4.1.0" - topologies: [ replicaset, sharded-replicaset ] - operations: - - name: aggregate - object: *collection2 - arguments: - pipeline: &pipeline - - $sort: { x : 1 } - - $match: { _id: { $gt: 1 } } - - $out: *out - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection2Name - pipeline: *pipeline - readConcern: { level: majority } - # The following two assertions were not in the original test - commandName: aggregate - databaseName: *database0Name - outcome: - - collectionName: *out - databaseName: *database0Name - documents: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "Aggregate with $listLocalSessions" - runOnRequirements: - - minServerVersion: "3.6.0" - operations: - - name: aggregate - object: *database1 - arguments: - pipeline: - - $listLocalSessions: { } - - $limit: 1 - - $addFields: { dummy: "dummy field"} - - $project: { _id: 0, dummy: 1} - expectResult: - - { dummy: "dummy field" } diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml b/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml index c1ea7ec696a..b06b437f617 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml @@ -93,7 +93,7 @@ tests: closeConnection: true # Find options and expected result changed to use common initialData - name: find - object: collection0 + object: *collection0 arguments: filter: {} sort: { _id: 1 } @@ -127,7 +127,7 @@ tests: failCommands: [ find ] closeConnection: true - name: find - object: collection1 # client uses retryReads=false + object: *collection1 # client uses retryReads=false arguments: filter: {} # Other arguments in the original test are not relevant @@ -154,7 +154,7 @@ tests: failCommands: [ find ] closeConnection: true - name: find - object: collection0 + object: *collection0 arguments: filter: {} # Other arguments in the original test are not relevant diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml index 0a6bfe6c2ec..47ded3a5fb5 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml @@ -141,7 +141,9 @@ tests: - { _id: 4, x: 44 } ordered: true expectResult: - { $$unsetOrMatches: { insertedCount: { $$unsetOrMatches: 2 } }, insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } } + $$unsetOrMatches: + insertedCount: { $$unsetOrMatches: 2 } + insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } outcome: - collectionName: *collectionName databaseName: *databaseName diff --git a/test/spec/uri-options/connection-options.json b/test/spec/uri-options/connection-options.json index 1cd7c55f08b..2b3ef2220f6 100644 --- a/test/spec/uri-options/connection-options.json +++ b/test/spec/uri-options/connection-options.json @@ -167,6 +167,73 @@ "hosts": null, "auth": null, "options": {} + }, + { + "description": "loadBalanced=true", + "uri": "mongodb://example.com/?loadBalanced=true", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "loadBalanced": true + } + }, + { + "description": "loadBalanced=false", + "uri": "mongodb://example.com/?loadBalanced=false", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "loadBalanced": false + } + }, + { + "description": "Invalid loadBalanced value", + "uri": "mongodb://example.com/?loadBalanced=1", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with multiple hosts causes an error", + "uri": "mongodb://example1,example2/?loadBalanced=true", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with directConnection=true causes an error", + "uri": "mongodb://example.com/?loadBalanced=true&directConnection=true", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with directConnection=false causes an error", + "uri": "mongodb://example.com/?loadBalanced=true&directConnection=false", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with replicaSet causes an error", + "uri": "mongodb://example.com/?loadBalanced=true&replicaSet=replset", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} } ] } diff --git a/test/spec/uri-options/connection-options.yml b/test/spec/uri-options/connection-options.yml index c90b88d743b..303473fe139 100644 --- a/test/spec/uri-options/connection-options.yml +++ b/test/spec/uri-options/connection-options.yml @@ -147,3 +147,61 @@ tests: hosts: ~ auth: ~ options: {} + - + description: loadBalanced=true + uri: "mongodb://example.com/?loadBalanced=true" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + loadBalanced: true + - + description: loadBalanced=false + uri: "mongodb://example.com/?loadBalanced=false" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + loadBalanced: false + - + description: Invalid loadBalanced value + uri: "mongodb://example.com/?loadBalanced=1" + valid: true + warning: true + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with multiple hosts causes an error + uri: "mongodb://example1,example2/?loadBalanced=true" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with directConnection=true causes an error + uri: "mongodb://example.com/?loadBalanced=true&directConnection=true" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with directConnection=false causes an error + uri: "mongodb://example.com/?loadBalanced=true&directConnection=false" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with replicaSet causes an error + uri: "mongodb://example.com/?loadBalanced=true&replicaSet=replset" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} diff --git a/test/spec/versioned-api/README.rst b/test/spec/versioned-api/README.rst new file mode 100644 index 00000000000..a0b0599f643 --- /dev/null +++ b/test/spec/versioned-api/README.rst @@ -0,0 +1,37 @@ +=================== +Versioned API Tests +=================== + +.. contents:: + +---- + +Notes +===== + +This directory contains tests for the Versioned API specification. They are +implemented in the `Unified Test Format <../../unified-test-format/unified-test-format.rst>`__, +and require schema version 1.1. Note that to run these tests, the server must be +started with both ``enableTestCommands`` and ``acceptApiVersion2`` parameters +set to true. + +Testing with required API version +================================= + +Drivers MUST run their test suite against a cluster with the +``requireApiVersion`` parameter enabled and also requires authentication. + +To run this test, proceed as follows: +- Start a standalone mongod instance + +- Connect to the standalone instance and run the following command on the + ``admin`` database: ``{ setParameter: 1, requireApiVersion: true }`` + +- Declare an API version for the test run through the ``MONGODB_API_VERSION`` + environment variable. + +- If the environment variable is set, all clients created in tests MUST declare + the ``ServerApiVersion`` specified. + +No other topologies must be tested until ``mongo-orchestration`` can handle +servers with ``requireApiVersion`` enabled. diff --git a/test/unit/core/mongodb_srv.test.js b/test/unit/core/mongodb_srv.test.js index 1b6ef023b68..e559b072a2d 100644 --- a/test/unit/core/mongodb_srv.test.js +++ b/test/unit/core/mongodb_srv.test.js @@ -24,7 +24,9 @@ describe('mongodb+srv', function () { test[1].comment = test[0]; } - it(test[1].comment, { + // TODO: Remove with NODE-3011 + const maybeIt = test[1].comment.includes('loadBalanced') ? it.skip : it.only; + maybeIt(test[1].comment, { metadata: { requires: { topology: ['single'] } }, test: function (done) { try { diff --git a/test/unit/sdam/server_selection/spec.test.js b/test/unit/sdam/server_selection/spec.test.js index aa4c068a14a..5fd692ddd8b 100644 --- a/test/unit/sdam/server_selection/spec.test.js +++ b/test/unit/sdam/server_selection/spec.test.js @@ -68,7 +68,9 @@ describe('Server Selection (spec)', function () { describe(subType, function () { specTests[topologyType][subType].forEach(test => { // NOTE: node does not support PossiblePrimary - const maybeIt = test.name.match(/Possible/) ? it.skip : it; + // TODO: Re-enable LoadBalanced in NODE-3011 + const maybeIt = + test.name.match(/Possible/) || topologyType === 'LoadBalanced' ? it.skip : it; maybeIt(test.name, function (done) { executeServerSelectionTest(test, { checkLatencyWindow: false }, done); @@ -79,7 +81,9 @@ describe('Server Selection (spec)', function () { describe(subType + ' (within latency window)', function () { specTests[topologyType][subType].forEach(test => { // NOTE: node does not support PossiblePrimary - const maybeIt = test.name.match(/Possible/) ? it.skip : it; + // TODO: Re-enable LoadBalanced in NODE-3011 + const maybeIt = + test.name.match(/Possible/) || topologyType === 'LoadBalanced' ? it.skip : it; maybeIt(test.name, function (done) { executeServerSelectionTest(test, { checkLatencyWindow: true }, done); diff --git a/test/unit/sdam/spec.test.js b/test/unit/sdam/spec.test.js index c8827660a27..7bf2d1b4621 100644 --- a/test/unit/sdam/spec.test.js +++ b/test/unit/sdam/spec.test.js @@ -60,10 +60,13 @@ describe('Server Discovery and Monitoring (spec)', function () { }); // DRIVERS-1249 should add directConnection and then update spec, remove skip + // TODO: NODE-3011 remove LB test skips const shouldSkip = desc => { const descriptions = [ 'Monitoring a standalone connection', - 'Monitoring a standalone connection - suppress update events for equal server descriptions' + 'Monitoring a standalone connection - suppress update events for equal server descriptions', + 'Load balancer can be discovered and only has the address property set', + 'Monitoring a load balancer' ]; return descriptions.includes(desc); }; From 89ca5d71dcbd624ec651515cb3c66380abd2234d Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Thu, 15 Jul 2021 17:17:35 +0200 Subject: [PATCH 2/2] test: don't use only in srv test --- test/unit/core/mongodb_srv.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/core/mongodb_srv.test.js b/test/unit/core/mongodb_srv.test.js index e559b072a2d..dd747534e3f 100644 --- a/test/unit/core/mongodb_srv.test.js +++ b/test/unit/core/mongodb_srv.test.js @@ -25,7 +25,7 @@ describe('mongodb+srv', function () { } // TODO: Remove with NODE-3011 - const maybeIt = test[1].comment.includes('loadBalanced') ? it.skip : it.only; + const maybeIt = test[1].comment.includes('loadBalanced') ? it.skip : it; maybeIt(test[1].comment, { metadata: { requires: { topology: ['single'] } }, test: function (done) {