description: "retryable reads handshake failures" schemaVersion: "1.3" runOnRequirements: - minServerVersion: "4.2" topologies: [replicaset, sharded, load-balanced] auth: true createEntities: - client: id: &client0 client0 useMultipleMongoses: false observeEvents: [commandStartedEvent, connectionCheckOutStartedEvent] - database: id: &database0 database0 client: *client0 databaseName: &databaseName retryable-handshake-tests - collection: id: &collection0 collection0 database: *database0 collectionName: &collectionName coll initialData: - collectionName: *collectionName databaseName: *databaseName documents: - { _id: 1, x: 11 } - { _id: 2, x: 22 } - { _id: 3, x: 33 } tests: - description: "find succeeds after retryable handshake network error" operations: - name: failPoint # fail the next connection establishment object: testRunner arguments: client: *client0 failPoint: configureFailPoint: failCommand mode: { times: 2 } data: # use saslContinue here to avoid SDAM errors # this failPoint itself will create a usable connection in the connection pool # so we run a ping (that also fails) in order to discard the connection # before testing our read operation "find" failCommands: [saslContinue, ping] closeConnection: true - name: runCommand object: *database0 arguments: commandName: ping command: { ping: 1 } expectError: isError: true - name: find object: *collection0 arguments: filter: { _id: 2 } expectResult: [{ _id: 2, x: 22 }] expectEvents: - client: *client0 eventType: cmap events: - { connectionCheckOutStartedEvent: {} } - { connectionCheckOutStartedEvent: {} } - { connectionCheckOutStartedEvent: {} } - { connectionCheckOutStartedEvent: {} } - client: *client0 events: - commandStartedEvent: command: ping: 1 databaseName: *databaseName - commandStartedEvent: command: find: *collectionName filter: { _id: 2 } databaseName: *databaseName - description: "find succeeds after retryable handshake network error (ShutdownInProgress)" operations: - name: failPoint # fail the next connection establishment object: testRunner arguments: client: *client0 failPoint: configureFailPoint: failCommand mode: { times: 2 } data: failCommands: [saslContinue, ping] errorCode: 91 # ShutdownInProgress - name: runCommand object: *database0 arguments: commandName: ping command: { ping: 1 } expectError: isError: true - name: find object: *collection0 arguments: filter: { _id: 2 } expectResult: [{ _id: 2, x: 22 }] expectEvents: - client: *client0 eventType: cmap events: - { connectionCheckOutStartedEvent: {} } - { connectionCheckOutStartedEvent: {} } - { connectionCheckOutStartedEvent: {} } - { connectionCheckOutStartedEvent: {} } - client: *client0 events: - commandStartedEvent: command: ping: 1 databaseName: *databaseName - commandStartedEvent: command: find: *collectionName filter: { _id: 2 } databaseName: *databaseName