@@ -242,79 +242,6 @@ describe.only('crypt_shared library', function () {
242242 ) ;
243243 } ) ;
244244
245- describe ( 'noAutoSpawn' , function ( ) {
246- [ 'mongocryptdBypassSpawn' , 'bypassAutoEncryption' , 'bypassQueryAnalysis' ] . forEach ( opt => {
247- const encryptionOptions = {
248- keyVaultNamespace : 'admin.datakeys' ,
249- kmsProviders : {
250- aws : { accessKeyId : 'example' , secretAccessKey : 'example' } ,
251- local : { key : Buffer . alloc ( 96 ) }
252- } ,
253- extraOptions : {
254- mongocryptdBypassSpawn : opt === 'mongocryptdBypassSpawn'
255- } ,
256- bypassAutoEncryption : opt === 'bypassAutoEncryption' ,
257- bypassQueryAnalysis : opt === 'bypassQueryAnalysis'
258- } ;
259-
260- it (
261- `should not spawn mongocryptd on startup if ${ opt } is true` ,
262- { requires : { clientSideEncryption : true , predicate : cryptShared ( 'disabled' ) } } ,
263- async function ( ) {
264- autoEncrypter = new AutoEncrypter ( client , encryptionOptions ) ;
265-
266- const localMcdm = autoEncrypter . _mongocryptdManager || {
267- spawn : ( ) => {
268- // intentional empty function
269- }
270- } ;
271- sandbox . spy ( localMcdm , 'spawn' ) ;
272-
273- await autoEncrypter . init ( ) ;
274- expect ( localMcdm . spawn ) . to . have . a . callCount ( 0 ) ;
275- }
276- ) ;
277- } ) ;
278-
279- it (
280- 'should not spawn a mongocryptd or retry on a server selection error if mongocryptdBypassSpawn: true' ,
281- { requires : { clientSideEncryption : true , predicate : cryptShared ( 'disabled' ) } } ,
282- async function ( ) {
283- let called = false ;
284- const timeoutError = new MongoNetworkTimeoutError ( 'msg' ) ;
285- StateMachine . prototype . markCommand . callsFake ( async ( _client , _ns , _filter ) => {
286- if ( ! called ) {
287- called = true ;
288- throw timeoutError ;
289- }
290-
291- return MOCK_MONGOCRYPTD_RESPONSE ;
292- } ) ;
293-
294- autoEncrypter = new AutoEncrypter ( client , {
295- keyVaultNamespace : 'admin.datakeys' ,
296- kmsProviders : {
297- aws : { accessKeyId : 'example' , secretAccessKey : 'example' } ,
298- local : { key : Buffer . alloc ( 96 ) }
299- } ,
300- extraOptions : {
301- mongocryptdBypassSpawn : true
302- }
303- } ) ;
304-
305- const localMcdm = autoEncrypter . _mongocryptdManager ;
306- sandbox . spy ( localMcdm , 'spawn' ) ;
307-
308- await autoEncrypter . init ( ) ;
309- expect ( localMcdm . spawn ) . to . not . have . been . called ;
310-
311- const err = await autoEncrypter . encrypt ( 'test.test' , TEST_COMMAND ) . catch ( e => e ) ;
312- expect ( localMcdm . spawn ) . to . not . have . been . called ;
313- expect ( err ) . to . equal ( timeoutError ) ;
314- }
315- ) ;
316- } ) ;
317-
318245 describe ( 'crypt shared library' , ( ) => {
319246 it ( 'should fail if no library can be found in the search path and cryptSharedLibRequired is set' , async function ( ) {
320247 const env = {
0 commit comments