From 2a3945fe5e6c8a92650ecbd14dfbefb1920be83a Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Tue, 5 Mar 2024 16:53:32 -0500 Subject: [PATCH] estimatedDocumentCount --- .../estimatedDocumentCount-serverErrors.yml | 379 ++++++++++++++++++ .../tests/unified/estimatedDocumentCount.yml | 151 +++++++ 2 files changed, 530 insertions(+) create mode 100644 source/retryable-reads/tests/unified/estimatedDocumentCount-serverErrors.yml create mode 100644 source/retryable-reads/tests/unified/estimatedDocumentCount.yml diff --git a/source/retryable-reads/tests/unified/estimatedDocumentCount-serverErrors.yml b/source/retryable-reads/tests/unified/estimatedDocumentCount-serverErrors.yml new file mode 100644 index 0000000000..de253b29ef --- /dev/null +++ b/source/retryable-reads/tests/unified/estimatedDocumentCount-serverErrors.yml @@ -0,0 +1,379 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: estimatedDocumentCount-serverErrors + +schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - single + - replicaset + - + minServerVersion: 4.1.7 + topologies: + - sharded + +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name retryable-reads-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name coll + +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + +tests: + - + description: 'EstimatedDocumentCount succeeds after InterruptedAtShutdown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: &failCommand_failPoint + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 11600 + - &retryable_operation_succeeds + object: *collection0 + name: estimatedDocumentCount + expectResult: 2 + expectEvents: + - + client: *client0 + events: + - &retryable_command_started_event + commandStartedEvent: + command: + count: *collection_name + databaseName: *database_name + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after InterruptedDueToReplStateChange' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 11602 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after NotWritablePrimary' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 10107 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 13435 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after NotPrimaryOrSecondary' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 13436 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after PrimarySteppedDown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 189 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after ShutdownInProgress' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 91 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after HostNotFound' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 7 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after HostUnreachable' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 6 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after NetworkTimeout' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 89 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount succeeds after SocketException' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 9001 + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount fails after two NotWritablePrimary errors' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - count + errorCode: 10107 + - &retryable_operation_fails + object: *collection0 + name: estimatedDocumentCount + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false' + operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryReads: false + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - + object: testRunner + name: failPoint + arguments: + client: *client1 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + errorCode: 10107 + - <<: *retryable_operation_fails + object: *collection1 + expectEvents: + - + client: *client1 + events: + - *retryable_command_started_event diff --git a/source/retryable-reads/tests/unified/estimatedDocumentCount.yml b/source/retryable-reads/tests/unified/estimatedDocumentCount.yml new file mode 100644 index 0000000000..da0f089cb5 --- /dev/null +++ b/source/retryable-reads/tests/unified/estimatedDocumentCount.yml @@ -0,0 +1,151 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: estimatedDocumentCount + +schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - single + - replicaset + - + minServerVersion: 4.1.7 + topologies: + - sharded + +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name retryable-reads-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name coll + +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + +tests: + - + description: 'EstimatedDocumentCount succeeds on first attempt' + operations: + - &retryable_operation_succeeds + object: *collection0 + name: estimatedDocumentCount + expectResult: 2 + expectEvents: + - + client: *client0 + events: + - &retryable_command_started_event + commandStartedEvent: + command: + count: *collection_name + databaseName: *database_name + - + description: 'EstimatedDocumentCount succeeds on second attempt' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: &failCommand_failPoint + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - count + closeConnection: true + - *retryable_operation_succeeds + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount fails on first attempt' + operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryReads: false + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - + object: testRunner + name: failPoint + arguments: + client: *client1 + failPoint: *failCommand_failPoint + - &retryable_operation_fails + object: *collection1 + name: estimatedDocumentCount + expectError: + isError: true + expectEvents: + - + client: *client1 + events: + - *retryable_command_started_event + - + description: 'EstimatedDocumentCount fails on second attempt' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - count + closeConnection: true + - <<: *retryable_operation_fails + object: *collection0 + expectEvents: + - + client: *client0 + events: + - *retryable_command_started_event + - *retryable_command_started_event