summaryrefslogtreecommitdiff
path: root/jstests/fle2
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/fle2')
-rw-r--r--jstests/fle2/convert_encrypted_to_capped.js2
-rw-r--r--jstests/fle2/rename_encrypted_collection.js70
2 files changed, 1 insertions, 71 deletions
diff --git a/jstests/fle2/convert_encrypted_to_capped.js b/jstests/fle2/convert_encrypted_to_capped.js
index afed1674036..256a247258e 100644
--- a/jstests/fle2/convert_encrypted_to_capped.js
+++ b/jstests/fle2/convert_encrypted_to_capped.js
@@ -2,7 +2,7 @@
/**
* @tags: [
- * requires_fcv_60
+ * requires_fcv_60,
* assumes_unsharded_collection,
* requires_non_retryable_commands,
* assumes_against_mongod_not_mongos
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);
-}());