File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ const ERROR = 0;
15
15
16
16
const __dirname = path . dirname ( url . fileURLToPath ( import . meta. url ) ) ;
17
17
18
- const { CRYPT_SHARED_LIB_PATH : cryptSharedLibPath = '' } = process . env ;
18
+ const { CRYPT_SHARED_LIB_PATH : cryptSharedLibPath = '' , BENCH_WITH_NATIVE_CRYPTO = '' } =
19
+ process . env ;
19
20
20
21
const warmupSecs = 2 ;
21
22
const testInSecs = 57 ;
@@ -57,9 +58,9 @@ function createEncryptedDocument(mongoCrypt) {
57
58
ctx . finishMongoOperation ( ) ;
58
59
}
59
60
60
- console . assert ( ctx . state === READY ) ;
61
+ if ( ctx . state !== READY ) throw new Error ( `not ready: [ ${ ctx . state } ] ${ ctx . status . message } ` ) ;
61
62
const result = ctx . finalize ( ) ;
62
- console . assert ( ctx . state !== ERROR ) ;
63
+ if ( ctx . state === ERROR ) throw new Error ( `error: [ ${ ctx . state } ] ${ ctx . status . message } ` ) ;
63
64
const { v : encryptedValue } = BSON . deserialize ( result ) ;
64
65
encrypted [ key ] = encryptedValue ;
65
66
}
@@ -120,7 +121,8 @@ function main() {
120
121
`testInSecs=${ testInSecs } `
121
122
) ;
122
123
123
- const mongoCryptOptions = { kmsProviders : BSON . serialize ( kmsProviders ) , cryptoCallbacks } ;
124
+ const mongoCryptOptions = { kmsProviders : BSON . serialize ( kmsProviders ) } ;
125
+ if ( ! BENCH_WITH_NATIVE_CRYPTO ) mongoCryptOptions . cryptoCallbacks = cryptoCallbacks ;
124
126
if ( cryptSharedLibPath ) mongoCryptOptions . cryptSharedLibPath = cryptSharedLibPath ;
125
127
126
128
const mongoCrypt = new MongoCrypt ( mongoCryptOptions ) ;
You can’t perform that action at this time.
0 commit comments