summaryrefslogtreecommitdiff
path: root/jstests/multiVersion
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2022-04-09 11:08:41 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-09 18:18:22 +0000
commit180baae184f16c26070b4a84d98d86ef164bdfc5 (patch)
tree3a8914cb3e048225e2f04ca072234adc7a21c9e7 /jstests/multiVersion
parentdc271946221f20e8629d74104d3252862741949e (diff)
downloadmongo-180baae184f16c26070b4a84d98d86ef164bdfc5.tar.gz
SERVER-59261 Enable Feature flag for PM-2466
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r--jstests/multiVersion/targetedTestsLast54
1 files changed, 54 insertions, 0 deletions
diff --git a/jstests/multiVersion/targetedTestsLast b/jstests/multiVersion/targetedTestsLast
new file mode 100644
index 00000000000..346e1b13f2d
--- /dev/null
+++ b/jstests/multiVersion/targetedTestsLast
@@ -0,0 +1,54 @@
+/**
+ * Tests that the cluster cannot be downgraded when encrypted fields present
+ *
+ * @tags: [
+ * requires_fcv_60
+ * ]
+ */
+
+load("jstests/fle2/libs/encrypted_client_util.js");
+
+(function() {
+"use strict";
+
+const rst = new ReplSetTest({nodes: 1});
+rst.startSet();
+rst.initiate();
+rst.awaitReplication();
+
+let dbName = 'downgrade_test';
+let conn = rst.getPrimary();
+let db = conn.getDB("admin");
+let client = new EncryptedClient(conn, dbName);
+
+function runTest(targetFCV)
+{
+ assert.commandWorked(client.createEncryptionCollection("basic", {
+ encryptedFields: {
+ "fields": [
+ {"path": "first", "bsonType": "string", "queries": {"queryType": "equality"}},
+ {"path": "middle", "bsonType": "string"},
+ {"path": "aka", "bsonType": "string", "queries": {"queryType": "equality"}},
+ ]
+ }
+}));
+
+
+let res = assert.commandFailedWithCode(
+ db.adminCommand({setFeatureCompatibilityVersion: targetFCV}), ErrorCodes.CannotDowngrade);
+
+ assert(client.getDB().fle2.basic.ecoc.drop());
+ assert(client.getDB().fle2.basic.ecc.drop());
+ assert(client.getDB().fle2.basic.esc.drop());
+assert(client.getDB().basic.drop());
+
+assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: targetFCV}));
+assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
+}
+
+targetFCV(lastLTSFCV);
+targetFCV(lastContinuousFCV);
+
+
+rst.stopSet();
+}()); \ No newline at end of file