{
  "runOn": [
    {
      "minServerVersion": "7.0.0",
      "topology": [
        "replicaset",
        "sharded",
        "load-balanced"
      ]
    }
  ],
  "database_name": "default",
  "collection_name": "default",
  "tests": [
    {
      "description": "state collections and index are created",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "default state collection names are applied",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "drop removes all state collections",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        },
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "CreateCollection without encryptedFields.",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "plaintextCollection"
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "plaintextCollection"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "plaintextCollection"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "listCollections": 1,
              "filter": {
                "name": "plaintextCollection"
              }
            },
            "command_name": "listCollections",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "plaintextCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "plaintextCollection"
            },
            "command_name": "create",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "CreateCollection from encryptedFieldsMap.",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "CreateCollection from encryptedFields.",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "listCollections": 1,
              "filter": {
                "name": "encryptedCollection"
              }
            },
            "command_name": "listCollections",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "DropCollection from encryptedFieldsMap",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "DropCollection from encryptedFields",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {}
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        },
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "listCollections": 1,
              "filter": {
                "name": "encryptedCollection"
              }
            },
            "command_name": "listCollections",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "DropCollection from remote encryptedFields",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {}
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection",
            "encryptedFields": {
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection",
            "index": "__safeContent___1"
          }
        },
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.esc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "enxcol_.encryptedCollection.ecoc"
          }
        },
        {
          "name": "assertCollectionNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "default",
            "collection": "encryptedCollection"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.esc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "enxcol_.encryptedCollection.ecoc",
              "clusteredIndex": {
                "key": {
                  "_id": 1
                },
                "unique": true
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "encryptedCollection",
              "encryptedFields": {
                "fields": [
                  {
                    "path": "firstName",
                    "bsonType": "string",
                    "keyId": {
                      "$binary": {
                        "subType": "04",
                        "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                      }
                    }
                  }
                ]
              }
            },
            "command_name": "create",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "listCollections": 1,
              "filter": {
                "name": "encryptedCollection"
              }
            },
            "command_name": "listCollections",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "encryptedCollection",
              "indexes": [
                {
                  "name": "__safeContent___1",
                  "key": {
                    "__safeContent__": 1
                  }
                }
              ]
            },
            "command_name": "createIndexes",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "listCollections": 1,
              "filter": {
                "name": "encryptedCollection"
              }
            },
            "command_name": "listCollections",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.esc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "enxcol_.encryptedCollection.ecoc"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        },
        {
          "command_started_event": {
            "command": {
              "drop": "encryptedCollection"
            },
            "command_name": "drop",
            "database_name": "default"
          }
        }
      ]
    },
    {
      "description": "encryptedFields are consulted for metadata collection names",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "aws": {}
          },
          "encryptedFieldsMap": {
            "default.encryptedCollection": {
              "escCollection": "invalid_esc_name",
              "ecocCollection": "invalid_ecoc_name",
              "fields": [
                {
                  "path": "firstName",
                  "bsonType": "string",
                  "keyId": {
                    "$binary": {
                      "subType": "04",
                      "base64": "AAAAAAAAAAAAAAAAAAAAAA=="
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          }
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "collection": "encryptedCollection"
          },
          "result": {
            "errorContains": "Encrypted State Collection name should follow"
          }
        }
      ]
    }
  ]
}
