{
  "description": "retryable reads handshake failures",
  "schemaVersion": "1.4",
  "runOnRequirements": [
    {
      "minServerVersion": "4.2",
      "topologies": [
        "replicaset",
        "sharded",
        "load-balanced"
      ],
      "auth": true
    }
  ],
  "createEntities": [
    {
      "client": {
        "id": "client",
        "useMultipleMongoses": false,
        "observeEvents": [
          "connectionCheckOutStartedEvent",
          "commandStartedEvent",
          "commandSucceededEvent",
          "commandFailedEvent"
        ]
      }
    },
    {
      "database": {
        "id": "database",
        "client": "client",
        "databaseName": "retryable-reads-handshake-tests"
      }
    },
    {
      "collection": {
        "id": "collection",
        "database": "database",
        "collectionName": "coll"
      }
    }
  ],
  "initialData": [
    {
      "collectionName": "coll",
      "databaseName": "retryable-reads-handshake-tests",
      "documents": [
        {
          "_id": 1,
          "x": 11
        },
        {
          "_id": 2,
          "x": 22
        },
        {
          "_id": 3,
          "x": 33
        }
      ]
    }
  ],
  "tests": [
    {
      "description": "client.listDatabases succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listDatabases",
          "object": "client",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listDatabases"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listDatabases"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "client.listDatabases succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listDatabases",
          "object": "client",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listDatabases"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listDatabases"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "client.listDatabaseNames succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listDatabaseNames",
          "object": "client"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listDatabases"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listDatabases"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "client.listDatabaseNames succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listDatabaseNames",
          "object": "client"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listDatabases"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listDatabases"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "client.createChangeStream succeeds after retryable handshake network error",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "createChangeStream",
          "object": "client",
          "arguments": {
            "pipeline": []
          },
          "saveResultAsEntity": "changeStream"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "client.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "createChangeStream",
          "object": "client",
          "arguments": {
            "pipeline": []
          },
          "saveResultAsEntity": "changeStream"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.aggregate succeeds after retryable handshake network error",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "aggregate",
          "object": "database",
          "arguments": {
            "pipeline": [
              {
                "$listLocalSessions": {}
              },
              {
                "$limit": 1
              }
            ]
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.aggregate succeeds after retryable handshake server error (ShutdownInProgress)",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "aggregate",
          "object": "database",
          "arguments": {
            "pipeline": [
              {
                "$listLocalSessions": {}
              },
              {
                "$limit": 1
              }
            ]
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.listCollections succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listCollections",
          "object": "database",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listCollections"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listCollections"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.listCollections succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listCollections",
          "object": "database",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listCollections"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listCollections"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.listCollectionNames succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listCollectionNames",
          "object": "database",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listCollections"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listCollections"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.listCollectionNames succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listCollectionNames",
          "object": "database",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listCollections"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listCollections"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.createChangeStream succeeds after retryable handshake network error",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "createChangeStream",
          "object": "database",
          "arguments": {
            "pipeline": []
          },
          "saveResultAsEntity": "changeStream"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "database.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "createChangeStream",
          "object": "database",
          "arguments": {
            "pipeline": []
          },
          "saveResultAsEntity": "changeStream"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.aggregate succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "aggregate",
          "object": "collection",
          "arguments": {
            "pipeline": []
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.aggregate succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "aggregate",
          "object": "collection",
          "arguments": {
            "pipeline": []
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.countDocuments succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "countDocuments",
          "object": "collection",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.countDocuments succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "countDocuments",
          "object": "collection",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.estimatedDocumentCount succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "estimatedDocumentCount",
          "object": "collection"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "count"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "count"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.estimatedDocumentCount succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "estimatedDocumentCount",
          "object": "collection"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "count"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "count"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.distinct succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "distinct",
          "object": "collection",
          "arguments": {
            "fieldName": "x",
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "distinct"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "distinct"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.distinct succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "distinct",
          "object": "collection",
          "arguments": {
            "fieldName": "x",
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "distinct"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "distinct"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.find succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "find",
          "object": "collection",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "find"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "find"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.find succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "find",
          "object": "collection",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "find"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "find"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.findOne succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "findOne",
          "object": "collection",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "find"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "find"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.findOne succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "findOne",
          "object": "collection",
          "arguments": {
            "filter": {}
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "find"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "find"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.listIndexes succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listIndexes",
          "object": "collection"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listIndexes"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listIndexes"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.listIndexes succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listIndexes",
          "object": "collection"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listIndexes"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listIndexes"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.listIndexNames succeeds after retryable handshake network error",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listIndexNames",
          "object": "collection"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listIndexes"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listIndexes"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.listIndexNames succeeds after retryable handshake server error (ShutdownInProgress)",
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "listIndexNames",
          "object": "collection"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "listIndexes"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "listIndexes"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.createChangeStream succeeds after retryable handshake network error",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "createChangeStream",
          "object": "collection",
          "arguments": {
            "pipeline": []
          },
          "saveResultAsEntity": "changeStream"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    },
    {
      "description": "collection.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)",
      "runOnRequirements": [
        {
          "serverless": "forbid"
        }
      ],
      "operations": [
        {
          "name": "failPoint",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 2
              },
              "data": {
                "failCommands": [
                  "ping",
                  "saslContinue"
                ],
                "closeConnection": true
              }
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "createChangeStream",
          "object": "collection",
          "arguments": {
            "pipeline": []
          },
          "saveResultAsEntity": "changeStream"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "cmap",
          "events": [
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            },
            {
              "connectionCheckOutStartedEvent": {}
            }
          ]
        },
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "ping": 1
                },
                "databaseName": "retryable-reads-handshake-tests"
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "ping"
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "aggregate"
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "aggregate"
              }
            }
          ]
        }
      ]
    }
  ]
}
