diff options
Diffstat (limited to 'jstests/client_encrypt')
-rw-r--r-- | jstests/client_encrypt/fle_auto_decrypt.js | 5 | ||||
-rw-r--r-- | jstests/client_encrypt/fle_aws_faults.js | 11 | ||||
-rw-r--r-- | jstests/client_encrypt/fle_encrypt_decrypt_shell.js | 5 | ||||
-rw-r--r-- | jstests/client_encrypt/fle_key_faults.js | 3 | ||||
-rw-r--r-- | jstests/client_encrypt/fle_keys.js | 8 | ||||
-rw-r--r-- | jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js | 3 |
6 files changed, 13 insertions, 22 deletions
diff --git a/jstests/client_encrypt/fle_auto_decrypt.js b/jstests/client_encrypt/fle_auto_decrypt.js index 1b6d1335ad2..63c8a0044f0 100644 --- a/jstests/client_encrypt/fle_auto_decrypt.js +++ b/jstests/client_encrypt/fle_auto_decrypt.js @@ -34,12 +34,9 @@ const deterministicAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"; const shell = Mongo(conn.host, clientSideFLEOptions); const keyVault = shell.getKeyVault(); -assert.commandWorked( - keyVault.createKey("local", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey'])); +const keyId = keyVault.createKey("local", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']); const clientEncrypt = shell.getClientEncryption(); -const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id; - const encryptedStr = clientEncrypt.encrypt(keyId, "mongodb", deterministicAlgorithm); // Insert encrypted string into database diff --git a/jstests/client_encrypt/fle_aws_faults.js b/jstests/client_encrypt/fle_aws_faults.js index 1f295310cbc..e0f21d9f99b 100644 --- a/jstests/client_encrypt/fle_aws_faults.js +++ b/jstests/client_encrypt/fle_aws_faults.js @@ -84,9 +84,8 @@ function testBadDecryptResult(fault) { runKMS(mock_kms, (shell) => { const keyVault = shell.getKeyVault(); - assert.commandWorked( - keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"])); - const keyId = keyVault.getKeys("mongoKey").toArray()[0]._id; + const keyId = + keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"]); const str = "mongo"; assert.throws(() => { const encStr = shell.getClientEncryption().encrypt(keyId, str, randomAlgorithm); @@ -102,8 +101,7 @@ function testBadDecryptKeyResult(fault) { runKMS(mock_kms, (shell, cleanCacheShell) => { const keyVault = shell.getKeyVault(); - assert.commandWorked( - keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"])); + keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"]); const keyId = keyVault.getKeys("mongoKey").toArray()[0]._id; const str = "mongo"; const encStr = shell.getClientEncryption().encrypt(keyId, str, randomAlgorithm); @@ -123,8 +121,7 @@ function testBadDecryptError() { runKMS(mock_kms, (shell) => { const keyVault = shell.getKeyVault(); - assert.commandWorked( - keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"])); + keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"]); const keyId = keyVault.getKeys("mongoKey").toArray()[0]._id; const str = "mongo"; let error = assert.throws(() => { diff --git a/jstests/client_encrypt/fle_encrypt_decrypt_shell.js b/jstests/client_encrypt/fle_encrypt_decrypt_shell.js index db0f8285a07..ae323b0fd84 100644 --- a/jstests/client_encrypt/fle_encrypt_decrypt_shell.js +++ b/jstests/client_encrypt/fle_encrypt_decrypt_shell.js @@ -87,9 +87,8 @@ for (const kmsType of kmsTypes) { for (const encryptionAlgorithm of encryptionAlgorithms) { collection.drop(); - assert.commandWorked( - keyVault.createKey(kmsType, "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey'])); - const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id; + const keyId = + keyVault.createKey(kmsType, "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']); let pass; let fail; diff --git a/jstests/client_encrypt/fle_key_faults.js b/jstests/client_encrypt/fle_key_faults.js index 4df4d7eb6b6..8f8133cbaf1 100644 --- a/jstests/client_encrypt/fle_key_faults.js +++ b/jstests/client_encrypt/fle_key_faults.js @@ -48,8 +48,7 @@ function testFault(kmsType, func) { const shell = Mongo(conn.host, clientSideFLEOptions); const keyVault = shell.getKeyVault(); - assert.commandWorked( - keyVault.createKey(kmsType, "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey'])); + keyVault.createKey(kmsType, "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']); const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id; func(keyId, shell); diff --git a/jstests/client_encrypt/fle_keys.js b/jstests/client_encrypt/fle_keys.js index 526fac471da..d7039e2dfaf 100644 --- a/jstests/client_encrypt/fle_keys.js +++ b/jstests/client_encrypt/fle_keys.js @@ -39,7 +39,7 @@ const conn_str = "mongodb://" + conn.host + "/?ssl=true"; const shell = Mongo(conn_str, clientSideFLEOptions); const keyVault = shell.getKeyVault(); -var key = keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']); +keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']); assert.eq(1, keyVault.getKeys().itcount()); var result = keyVault.createKey("aws", "arn:aws:kms:us-east-4:fake:fake:fake", {}); @@ -68,9 +68,9 @@ result = keyVault.deleteKey(keyId); assert.eq(0, keyVault.getKey(keyId).itcount()); assert.eq(0, keyVault.getKeys().itcount()); -assert.commandWorked(keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake1")); -assert.commandWorked(keyVault.createKey("aws", "arn:aws:kms:us-east-2:fake:fake:fake2")); -assert.commandWorked(keyVault.createKey("aws", "arn:aws:kms:us-east-3:fake:fake:fake3")); +keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake1"); +keyVault.createKey("aws", "arn:aws:kms:us-east-2:fake:fake:fake2"); +keyVault.createKey("aws", "arn:aws:kms:us-east-3:fake:fake:fake3"); assert.eq(3, keyVault.getKeys().itcount()); diff --git a/jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js b/jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js index dc2e954281f..e4e2d159e80 100644 --- a/jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js +++ b/jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js @@ -51,8 +51,7 @@ const failTestCases = [null, undefined, MinKey(), MaxKey(), DBRef("test", "test" for (const encryptionAlgorithm of encryptionAlgorithms) { collection.drop(); - assert.commandWorked( - keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey'])); + keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']); const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id; let pass; |