...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/unified/getKeys.json

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-encryption/unified

     1{
     2  "description": "getKeys",
     3  "schemaVersion": "1.8",
     4  "runOnRequirements": [
     5    {
     6      "csfle": true
     7    }
     8  ],
     9  "createEntities": [
    10    {
    11      "client": {
    12        "id": "client0",
    13        "observeEvents": [
    14          "commandStartedEvent"
    15        ]
    16      }
    17    },
    18    {
    19      "clientEncryption": {
    20        "id": "clientEncryption0",
    21        "clientEncryptionOpts": {
    22          "keyVaultClient": "client0",
    23          "keyVaultNamespace": "keyvault.datakeys",
    24          "kmsProviders": {
    25            "local": {
    26              "key": {
    27                "$$placeholder": 1
    28              }
    29            }
    30          }
    31        }
    32      }
    33    },
    34    {
    35      "database": {
    36        "id": "database0",
    37        "client": "client0",
    38        "databaseName": "keyvault"
    39      }
    40    },
    41    {
    42      "collection": {
    43        "id": "collection0",
    44        "database": "database0",
    45        "collectionName": "datakeys"
    46      }
    47    }
    48  ],
    49  "initialData": [
    50    {
    51      "databaseName": "keyvault",
    52      "collectionName": "datakeys",
    53      "documents": []
    54    }
    55  ],
    56  "tests": [
    57    {
    58      "description": "getKeys with zero key documents",
    59      "operations": [
    60        {
    61          "name": "getKeys",
    62          "object": "clientEncryption0",
    63          "expectResult": []
    64        }
    65      ],
    66      "expectEvents": [
    67        {
    68          "client": "client0",
    69          "events": [
    70            {
    71              "commandStartedEvent": {
    72                "databaseName": "keyvault",
    73                "command": {
    74                  "find": "datakeys",
    75                  "filter": {},
    76                  "readConcern": {
    77                    "level": "majority"
    78                  }
    79                }
    80              }
    81            }
    82          ]
    83        }
    84      ]
    85    },
    86    {
    87      "description": "getKeys with single key documents",
    88      "operations": [
    89        {
    90          "name": "createDataKey",
    91          "object": "clientEncryption0",
    92          "arguments": {
    93            "kmsProvider": "local",
    94            "opts": {
    95              "keyAltNames": [
    96                "abc"
    97              ]
    98            }
    99          },
   100          "expectResult": {
   101            "$$type": "binData"
   102          }
   103        },
   104        {
   105          "name": "getKeys",
   106          "object": "clientEncryption0",
   107          "expectResult": [
   108            {
   109              "_id": {
   110                "$$type": "binData"
   111              },
   112              "keyAltNames": [
   113                "abc"
   114              ],
   115              "keyMaterial": {
   116                "$$type": "binData"
   117              },
   118              "creationDate": {
   119                "$$type": "date"
   120              },
   121              "updateDate": {
   122                "$$type": "date"
   123              },
   124              "status": {
   125                "$$type": "int"
   126              },
   127              "masterKey": {
   128                "$$type": "object"
   129              }
   130            }
   131          ]
   132        }
   133      ],
   134      "expectEvents": [
   135        {
   136          "client": "client0",
   137          "events": [
   138            {
   139              "commandStartedEvent": {
   140                "commandName": "insert"
   141              }
   142            },
   143            {
   144              "commandStartedEvent": {
   145                "databaseName": "keyvault",
   146                "command": {
   147                  "find": "datakeys",
   148                  "filter": {},
   149                  "readConcern": {
   150                    "level": "majority"
   151                  }
   152                }
   153              }
   154            }
   155          ]
   156        }
   157      ]
   158    },
   159    {
   160      "description": "getKeys with many key documents",
   161      "operations": [
   162        {
   163          "name": "createDataKey",
   164          "object": "clientEncryption0",
   165          "arguments": {
   166            "kmsProvider": "local"
   167          },
   168          "expectResult": {
   169            "$$type": "binData"
   170          }
   171        },
   172        {
   173          "name": "createDataKey",
   174          "object": "clientEncryption0",
   175          "arguments": {
   176            "kmsProvider": "local"
   177          },
   178          "expectResult": {
   179            "$$type": "binData"
   180          }
   181        },
   182        {
   183          "name": "getKeys",
   184          "object": "clientEncryption0",
   185          "expectResult": [
   186            {
   187              "_id": {
   188                "$$type": "binData"
   189              },
   190              "keyMaterial": {
   191                "$$type": "binData"
   192              },
   193              "creationDate": {
   194                "$$type": "date"
   195              },
   196              "updateDate": {
   197                "$$type": "date"
   198              },
   199              "status": {
   200                "$$type": "int"
   201              },
   202              "masterKey": {
   203                "$$type": "object"
   204              }
   205            },
   206            {
   207              "_id": {
   208                "$$type": "binData"
   209              },
   210              "keyMaterial": {
   211                "$$type": "binData"
   212              },
   213              "creationDate": {
   214                "$$type": "date"
   215              },
   216              "updateDate": {
   217                "$$type": "date"
   218              },
   219              "status": {
   220                "$$type": "int"
   221              },
   222              "masterKey": {
   223                "$$type": "object"
   224              }
   225            }
   226          ]
   227        }
   228      ],
   229      "expectEvents": [
   230        {
   231          "client": "client0",
   232          "events": [
   233            {
   234              "commandStartedEvent": {
   235                "commandName": "insert"
   236              }
   237            },
   238            {
   239              "commandStartedEvent": {
   240                "commandName": "insert"
   241              }
   242            },
   243            {
   244              "commandStartedEvent": {
   245                "databaseName": "keyvault",
   246                "command": {
   247                  "find": "datakeys",
   248                  "filter": {},
   249                  "readConcern": {
   250                    "level": "majority"
   251                  }
   252                }
   253              }
   254            }
   255          ]
   256        }
   257      ]
   258    }
   259  ]
   260}

View as plain text