summaryrefslogtreecommitdiff
path: root/jstests/fle2/rename_encrypted_collection.js
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
commit294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch)
tree279b1e0bab53901a1647ac63c1c724f0f789a663 /jstests/fle2/rename_encrypted_collection.js
parent70be7c27a251621187a1de533462ae2bb1e3bd39 (diff)
parent1e917fd798aa25b7066d4b414b51184f13d5a092 (diff)
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10' with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'jstests/fle2/rename_encrypted_collection.js')
-rw-r--r--jstests/fle2/rename_encrypted_collection.js70
1 files changed, 0 insertions, 70 deletions
diff --git a/jstests/fle2/rename_encrypted_collection.js b/jstests/fle2/rename_encrypted_collection.js
deleted file mode 100644
index badff5a34f3..00000000000
--- a/jstests/fle2/rename_encrypted_collection.js
+++ /dev/null
@@ -1,70 +0,0 @@
-// Verify renaming to/from a collection with encrypted fields is disallowed
-
-/**
- * @tags: [
- * requires_fcv_60,
- * assumes_unsharded_collection,
- * ]
- */
-load("jstests/fle2/libs/encrypted_client_util.js");
-
-(function() {
-'use strict';
-
-const srcDbName = 'rename_encrypted_collection_src_db';
-const tgtDbName = 'rename_encrypted_collection_tgt_db';
-const dbSrc = db.getSiblingDB(srcDbName);
-const dbTgt = db.getSiblingDB(tgtDbName);
-
-dbSrc.encrypted.drop();
-dbSrc.unencrypted.drop();
-dbSrc.renamed.drop();
-dbTgt.encrypted.drop();
-dbTgt.unencrypted.drop();
-
-const sampleEncryptedFields = {
- "fields": [
- {
- "path": "firstName",
- "keyId": UUID("11d58b8a-0c6c-4d69-a0bd-70c6d9befae9"),
- "bsonType": "string",
- "queries": {"queryType": "equality"}
- },
- ]
-};
-const srcEncryptedErrmsg = "Cannot rename an encrypted collection";
-const tgtEncryptedErrmsg = "Cannot rename to an existing encrypted collection";
-
-assert.commandWorked(dbSrc.createCollection("encrypted", {encryptedFields: sampleEncryptedFields}));
-assert.commandWorked(dbSrc.createCollection("unencrypted"));
-
-assert.commandWorked(dbTgt.createCollection("encrypted", {encryptedFields: sampleEncryptedFields}));
-
-jsTestLog("Test renaming encrypted collection to another namespace is prohibited");
-let res = assert.commandFailedWithCode(
- dbSrc.adminCommand({renameCollection: dbSrc + ".encrypted", to: dbSrc + ".renamed"}),
- ErrorCodes.IllegalOperation,
- "Renaming an encrypted collection within same DB passed");
-assert.eq(res.errmsg, srcEncryptedErrmsg);
-
-res = assert.commandFailedWithCode(
- dbSrc.adminCommand({renameCollection: dbSrc + ".encrypted", to: dbTgt + ".unencrypted"}),
- ErrorCodes.IllegalOperation,
- "Renaming an encrypted collection between DBs passed");
-assert.eq(res.errmsg, srcEncryptedErrmsg);
-
-jsTestLog("Test renaming unencrypted collection to an encrypted namespace is prohibited");
-res = assert.commandFailedWithCode(
- dbSrc.adminCommand(
- {renameCollection: dbSrc + ".unencrypted", to: dbSrc + ".encrypted", dropTarget: true}),
- ErrorCodes.IllegalOperation,
- "Renaming to an encrypted collection within same DB passed");
-assert.eq(res.errmsg, tgtEncryptedErrmsg);
-
-res = assert.commandFailedWithCode(
- dbSrc.adminCommand(
- {renameCollection: dbSrc + ".unencrypted", to: dbTgt + ".encrypted", dropTarget: true}),
- ErrorCodes.IllegalOperation,
- "Renaming to an encrypted collection between DBs passed");
-assert.eq(res.errmsg, tgtEncryptedErrmsg);
-}());