summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough
diff options
context:
space:
mode:
authorErwin Pe <erwin.pe@mongodb.com>2023-05-04 16:30:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-04 17:38:37 +0000
commitfba9dd05de659730512c9f2af0752cc71793c2fd (patch)
treed6532c6921c3d114ece4c819ab80fc848545b3b5 /jstests/noPassthrough
parent5a32ec32026d0d43c1d1748f8d4584a317b667c6 (diff)
downloadmongo-fba9dd05de659730512c9f2af0752cc71793c2fd.tar.gz
SERVER-76188 Integrate cleanup implementation with unsharded command invocation
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r--jstests/noPassthrough/fle2_shardsvr_cleanup.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/jstests/noPassthrough/fle2_shardsvr_cleanup.js b/jstests/noPassthrough/fle2_shardsvr_cleanup.js
new file mode 100644
index 00000000000..ac9a1b57751
--- /dev/null
+++ b/jstests/noPassthrough/fle2_shardsvr_cleanup.js
@@ -0,0 +1,40 @@
+/**
+ * Cannot run cleanup against a shard server
+ *
+ * @tags: [
+ * requires_fcv_70,
+ * requires_sharding,
+ * featureFlagFLE2CleanupCommand
+ * ]
+ */
+load("jstests/fle2/libs/encrypted_client_util.js");
+
+(function() {
+'use strict';
+
+function runTest(mongosConn, shardConn) {
+ let dbName = 'testdb';
+
+ let clientMongoS = new EncryptedClient(mongosConn, dbName);
+
+ assert.commandWorked(clientMongoS.createEncryptionCollection("basic", {
+ encryptedFields: {
+ "fields":
+ [{"path": "first", "bsonType": "string", "queries": {"queryType": "equality"}}]
+ }
+ }));
+
+ let clientShard = new EncryptedClient(shardConn, dbName);
+
+ assert.commandFailedWithCode(clientShard.getDB().basic.cleanup(), 7618804);
+}
+
+jsTestLog("Sharding: Testing fle2 cleanup not allowed against a shard server");
+{
+ const st = new ShardingTest({shards: 1, mongos: 1, config: 1});
+
+ runTest(st.s, st.shard0);
+
+ st.stop();
+}
+}());