summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/configExpand_exec_digest.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/configExpand_exec_digest.js')
-rw-r--r--jstests/noPassthrough/configExpand_exec_digest.js109
1 files changed, 53 insertions, 56 deletions
diff --git a/jstests/noPassthrough/configExpand_exec_digest.js b/jstests/noPassthrough/configExpand_exec_digest.js
index 90457f70dc8..e01c1fcd1d6 100644
--- a/jstests/noPassthrough/configExpand_exec_digest.js
+++ b/jstests/noPassthrough/configExpand_exec_digest.js
@@ -1,60 +1,57 @@
// Test config file expansion using EXEC with digests.
(function() {
- 'use strict';
-
- load('jstests/noPassthrough/libs/configExpand/lib.js');
-
- // hash === SHA256HMAC('12345', 'secret')
- const hash = 'f88c7ebe4740db59c873cecf5e1f18e3726a1ad64068a13d764b79028430ab0e';
-
- // Simple positive case.
- configExpandSuccess({
- setParameter: {
- scramIterationCount:
- {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: '736563726574'}
- }
- });
-
- // Invalid digest length.
- configExpandFailure({
- setParameter: {
- scramIteratorCount:
- {__exec: makeReflectionCmd('12345'), digest: '123', digest_key: '736563726574'}
- }
- },
- /digest: Not a valid, even length hex string/);
-
- // Invalid characters.
- configExpandFailure({
- setParameter: {
- scramIteratorCount:
- {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: '736563X26574'}
- }
- },
- /digest_key: Not a valid, even length hex string/);
-
- // Digest without key.
- configExpandFailure(
- {setParameter: {scramIteratorCount: {__exec: makeReflectionCmd('12345'), digest: hash}}},
- /digest requires digest_key/);
-
- // Empty digest_key.
- configExpandFailure({
- setParameter: {
- scramIteratorCount:
- {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: ''}
- }
- },
- /digest_key must not be empty/);
-
- // Mismatched digests.
- configExpandFailure({
- setParameter: {
- scramIteratorCount:
- {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: '736563726575'}
- }
- },
- /does not match expected digest/);
-
+'use strict';
+
+load('jstests/noPassthrough/libs/configExpand/lib.js');
+
+// hash === SHA256HMAC('12345', 'secret')
+const hash = 'f88c7ebe4740db59c873cecf5e1f18e3726a1ad64068a13d764b79028430ab0e';
+
+// Simple positive case.
+configExpandSuccess({
+ setParameter: {
+ scramIterationCount:
+ {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: '736563726574'}
+ }
+});
+
+// Invalid digest length.
+configExpandFailure({
+ setParameter: {
+ scramIteratorCount:
+ {__exec: makeReflectionCmd('12345'), digest: '123', digest_key: '736563726574'}
+ }
+},
+ /digest: Not a valid, even length hex string/);
+
+// Invalid characters.
+configExpandFailure({
+ setParameter: {
+ scramIteratorCount:
+ {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: '736563X26574'}
+ }
+},
+ /digest_key: Not a valid, even length hex string/);
+
+// Digest without key.
+configExpandFailure(
+ {setParameter: {scramIteratorCount: {__exec: makeReflectionCmd('12345'), digest: hash}}},
+ /digest requires digest_key/);
+
+// Empty digest_key.
+configExpandFailure({
+ setParameter:
+ {scramIteratorCount: {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: ''}}
+},
+ /digest_key must not be empty/);
+
+// Mismatched digests.
+configExpandFailure({
+ setParameter: {
+ scramIteratorCount:
+ {__exec: makeReflectionCmd('12345'), digest: hash, digest_key: '736563726575'}
+ }
+},
+ /does not match expected digest/);
})();