summaryrefslogtreecommitdiff
path: root/jstests/client_encrypt
diff options
context:
space:
mode:
authorJames Wahlin <james.wahlin@mongodb.com>2019-08-14 13:52:59 +0000
committerevergreen <evergreen@mongodb.com>2019-08-14 13:52:59 +0000
commit39c3a5d77b976e131d37476f2e7255d6058f5093 (patch)
tree01cc28719f215b17196ec913f475cd8efda9b37d /jstests/client_encrypt
parent69d0dd1dc4fb1f78d21c47aa5dd82aa9077b69eb (diff)
downloadmongo-39c3a5d77b976e131d37476f2e7255d6058f5093.tar.gz
SERVER-42773 Replace uses of the assert.writeOK() Javascript assertion with assert.commandWorked()
Diffstat (limited to 'jstests/client_encrypt')
-rw-r--r--jstests/client_encrypt/fle_auto_decrypt.js5
-rw-r--r--jstests/client_encrypt/fle_aws_faults.js6
-rw-r--r--jstests/client_encrypt/fle_encrypt_decrypt_shell.js2
-rw-r--r--jstests/client_encrypt/fle_key_faults.js2
-rw-r--r--jstests/client_encrypt/fle_keys.js6
-rw-r--r--jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js3
6 files changed, 13 insertions, 11 deletions
diff --git a/jstests/client_encrypt/fle_auto_decrypt.js b/jstests/client_encrypt/fle_auto_decrypt.js
index 182c8af3ac4..1b6d1335ad2 100644
--- a/jstests/client_encrypt/fle_auto_decrypt.js
+++ b/jstests/client_encrypt/fle_auto_decrypt.js
@@ -34,7 +34,8 @@ const deterministicAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic";
const shell = Mongo(conn.host, clientSideFLEOptions);
const keyVault = shell.getKeyVault();
-assert.writeOK(keyVault.createKey("local", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']));
+assert.commandWorked(
+ 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;
@@ -45,7 +46,7 @@ const encryptedStr = clientEncrypt.encrypt(keyId, "mongodb", deterministicAlgori
const collection = conn.getDB("test").getCollection("collection");
for (var i = 0; i < 150; i++) {
- assert.writeOK(collection.insert({string: encryptedStr, id: 1}));
+ assert.commandWorked(collection.insert({string: encryptedStr, id: 1}));
}
// Ensure string is auto decrypted
diff --git a/jstests/client_encrypt/fle_aws_faults.js b/jstests/client_encrypt/fle_aws_faults.js
index 1d9a621b42a..1f295310cbc 100644
--- a/jstests/client_encrypt/fle_aws_faults.js
+++ b/jstests/client_encrypt/fle_aws_faults.js
@@ -84,7 +84,7 @@ function testBadDecryptResult(fault) {
runKMS(mock_kms, (shell) => {
const keyVault = shell.getKeyVault();
- assert.writeOK(
+ assert.commandWorked(
keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"]));
const keyId = keyVault.getKeys("mongoKey").toArray()[0]._id;
const str = "mongo";
@@ -102,7 +102,7 @@ function testBadDecryptKeyResult(fault) {
runKMS(mock_kms, (shell, cleanCacheShell) => {
const keyVault = shell.getKeyVault();
- assert.writeOK(
+ assert.commandWorked(
keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"]));
const keyId = keyVault.getKeys("mongoKey").toArray()[0]._id;
const str = "mongo";
@@ -123,7 +123,7 @@ function testBadDecryptError() {
runKMS(mock_kms, (shell) => {
const keyVault = shell.getKeyVault();
- assert.writeOK(
+ assert.commandWorked(
keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ["mongoKey"]));
const keyId = keyVault.getKeys("mongoKey").toArray()[0]._id;
const str = "mongo";
diff --git a/jstests/client_encrypt/fle_encrypt_decrypt_shell.js b/jstests/client_encrypt/fle_encrypt_decrypt_shell.js
index f67bc72dccc..db0f8285a07 100644
--- a/jstests/client_encrypt/fle_encrypt_decrypt_shell.js
+++ b/jstests/client_encrypt/fle_encrypt_decrypt_shell.js
@@ -87,7 +87,7 @@ for (const kmsType of kmsTypes) {
for (const encryptionAlgorithm of encryptionAlgorithms) {
collection.drop();
- assert.writeOK(
+ assert.commandWorked(
keyVault.createKey(kmsType, "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']));
const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id;
diff --git a/jstests/client_encrypt/fle_key_faults.js b/jstests/client_encrypt/fle_key_faults.js
index 41b2505c8ba..4df4d7eb6b6 100644
--- a/jstests/client_encrypt/fle_key_faults.js
+++ b/jstests/client_encrypt/fle_key_faults.js
@@ -48,7 +48,7 @@ function testFault(kmsType, func) {
const shell = Mongo(conn.host, clientSideFLEOptions);
const keyVault = shell.getKeyVault();
- assert.writeOK(
+ assert.commandWorked(
keyVault.createKey(kmsType, "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']));
const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id;
diff --git a/jstests/client_encrypt/fle_keys.js b/jstests/client_encrypt/fle_keys.js
index 646b95141ad..526fac471da 100644
--- a/jstests/client_encrypt/fle_keys.js
+++ b/jstests/client_encrypt/fle_keys.js
@@ -68,9 +68,9 @@ result = keyVault.deleteKey(keyId);
assert.eq(0, keyVault.getKey(keyId).itcount());
assert.eq(0, keyVault.getKeys().itcount());
-assert.writeOK(keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake1"));
-assert.writeOK(keyVault.createKey("aws", "arn:aws:kms:us-east-2:fake:fake:fake2"));
-assert.writeOK(keyVault.createKey("aws", "arn:aws:kms:us-east-3:fake:fake:fake3"));
+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"));
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 da83d69c87b..dc2e954281f 100644
--- a/jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js
+++ b/jstests/client_encrypt/lib/fle_command_line_explicit_encryption.js
@@ -51,7 +51,8 @@ const failTestCases = [null, undefined, MinKey(), MaxKey(), DBRef("test", "test"
for (const encryptionAlgorithm of encryptionAlgorithms) {
collection.drop();
- assert.writeOK(keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']));
+ assert.commandWorked(
+ keyVault.createKey("aws", "arn:aws:kms:us-east-1:fake:fake:fake", ['mongoKey']));
const keyId = keyVault.getKeyByAltName("mongoKey").toArray()[0]._id;
let pass;