|
| 1 | +description: QE-Text-cleanupStructuredEncryptionData |
| 2 | +schemaVersion: "1.25" |
| 3 | +runOnRequirements: |
| 4 | + - minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries. |
| 5 | + topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone. |
| 6 | + csfle: |
| 7 | + minLibmongocryptVersion: 1.15.0 # For SPM-4158. |
| 8 | +createEntities: |
| 9 | + - client: |
| 10 | + id: &client "client" |
| 11 | + autoEncryptOpts: |
| 12 | + keyVaultNamespace: keyvault.datakeys |
| 13 | + kmsProviders: |
| 14 | + local: |
| 15 | + key: Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk |
| 16 | + observeEvents: |
| 17 | + - commandStartedEvent |
| 18 | + - database: |
| 19 | + id: &db "db" |
| 20 | + client: *client |
| 21 | + databaseName: *db |
| 22 | + - collection: |
| 23 | + id: &coll "coll" |
| 24 | + database: *db |
| 25 | + collectionName: *coll |
| 26 | +initialData: |
| 27 | + # Insert data encryption key: |
| 28 | + - databaseName: keyvault |
| 29 | + collectionName: datakeys |
| 30 | + documents: |
| 31 | + [ |
| 32 | + { |
| 33 | + "_id": &keyid { "$binary": { "base64": "q83vqxI0mHYSNBI0VniQEg==", "subType": "04" } }, |
| 34 | + "keyMaterial": |
| 35 | + { |
| 36 | + "$binary": |
| 37 | + { |
| 38 | + "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", |
| 39 | + "subType": "00", |
| 40 | + }, |
| 41 | + }, |
| 42 | + "creationDate": { "$date": { "$numberLong": "1648914851981" } }, |
| 43 | + "updateDate": { "$date": { "$numberLong": "1648914851981" } }, |
| 44 | + "status": { "$numberInt": "0" }, |
| 45 | + "masterKey": { "provider": "local" }, |
| 46 | + }, |
| 47 | + ] |
| 48 | + # Create encrypted collection: |
| 49 | + - databaseName: *db |
| 50 | + collectionName: *coll |
| 51 | + documents: [] |
| 52 | + createOptions: |
| 53 | + encryptedFields: |
| 54 | + { |
| 55 | + "fields": |
| 56 | + [ |
| 57 | + { |
| 58 | + "keyId": *keyid, |
| 59 | + "path": "encryptedText", |
| 60 | + "bsonType": "string", |
| 61 | + "queries": [ |
| 62 | + { |
| 63 | + "queryType": "suffixPreview", |
| 64 | + "contention": { "$numberLong": "0" }, |
| 65 | + "strMinQueryLength": { "$numberLong": "3" }, |
| 66 | + "strMaxQueryLength": { "$numberLong": "30" }, |
| 67 | + "caseSensitive": true, |
| 68 | + "diacriticSensitive": true, |
| 69 | + }, |
| 70 | + ], |
| 71 | + }, |
| 72 | + ], |
| 73 | + } |
| 74 | +tests: |
| 75 | + - description: "QE Text cleanupStructuredEncryptionData works" |
| 76 | + operations: |
| 77 | + - name: runCommand |
| 78 | + object: *db |
| 79 | + arguments: |
| 80 | + command: |
| 81 | + cleanupStructuredEncryptionData: *coll |
| 82 | + commandName: cleanupStructuredEncryptionData |
| 83 | + expectResult: { ok: 1 } |
| 84 | + expectEvents: |
| 85 | + - client: *client |
| 86 | + events: |
| 87 | + - commandStartedEvent: |
| 88 | + command: |
| 89 | + listCollections: 1 |
| 90 | + filter: |
| 91 | + name: *coll |
| 92 | + commandName: listCollections |
| 93 | + - commandStartedEvent: |
| 94 | + command: |
| 95 | + find: datakeys |
| 96 | + filter: |
| 97 | + { |
| 98 | + "$or": |
| 99 | + [ |
| 100 | + "_id": { "$in": [ *keyid ] }, |
| 101 | + "keyAltNames": { "$in": [] }, |
| 102 | + ], |
| 103 | + } |
| 104 | + $db: keyvault |
| 105 | + readConcern: { level: "majority" } |
| 106 | + commandName: find |
| 107 | + - commandStartedEvent: |
| 108 | + command: |
| 109 | + { |
| 110 | + "cleanupStructuredEncryptionData": *coll, |
| 111 | + "cleanupTokens": { |
| 112 | + "encryptedText": { |
| 113 | + "ecoc": { |
| 114 | + "$binary": { |
| 115 | + "base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=", |
| 116 | + "subType": "00" |
| 117 | + } |
| 118 | + }, |
| 119 | + "anchorPaddingToken": { |
| 120 | + "$binary": { |
| 121 | + "base64": "YAiF7Iwhqq1UyfxPvm70xfQJtrIRPrjfD2yRLG1+saQ=", |
| 122 | + "subType": "00" |
| 123 | + } |
| 124 | + } |
| 125 | + } |
| 126 | + } |
| 127 | + } |
| 128 | + commandName: cleanupStructuredEncryptionData |
0 commit comments