@@ -513,205 +513,6 @@ describe('AbortSignal support', () => {
513513 test ( cursorAPI , args ) ;
514514 }
515515 } ) ;
516-
517- const fleMetadata : MongoDBMetadataUI = {
518- requires : {
519- clientSideEncryption : true ,
520- mongodb : '>=7.0.0' ,
521- topology : '!single'
522- }
523- } ;
524-
525- if ( cursorName !== 'listCollections' ) {
526- describe ( 'setup fle' , fleMetadata , ( ) => {
527- let autoEncryption : AutoEncryptionOptions ;
528- let client : MongoClient ;
529- let db ;
530- let collection ;
531- let method ;
532- let filter ;
533-
534- before ( async function ( ) {
535- if (
536- ! this . configuration . clientSideEncryption . enabled ||
537- semver . lt ( this . configuration . version , '7.0.0' ) ||
538- this . configuration . topologyType === 'Single'
539- ) {
540- return this . skip ( ) ;
541- }
542-
543- autoEncryption = {
544- keyVaultNamespace : 'admin.datakeys' ,
545- kmsProviders : {
546- local : { key : Buffer . alloc ( 96 ) }
547- } ,
548- tlsOptions : {
549- kmip : {
550- tlsCAFile : process . env . KMIP_TLS_CA_FILE ,
551- tlsCertificateKeyFile : process . env . KMIP_TLS_CERT_FILE
552- }
553- } ,
554- encryptedFieldsMap : {
555- 'abortSignal.support' : {
556- fields : [
557- {
558- path : 'ssn' ,
559- keyId : null ,
560- bsonType : 'string'
561- }
562- ]
563- }
564- }
565- } ;
566-
567- let utilClient = this . configuration . newClient ( { } , { } ) ;
568-
569- try {
570- await utilClient
571- . db ( 'abortSignal' )
572- . collection ( 'support' )
573- . drop ( { } )
574- . catch ( ( ) => null ) ;
575-
576- const clientEncryption = new ClientEncryption ( utilClient , {
577- ...autoEncryption ,
578- encryptedFieldsMap : undefined
579- } ) ;
580-
581- autoEncryption . encryptedFieldsMap [ 'abortSignal.support' ] = (
582- await clientEncryption . createEncryptedCollection (
583- utilClient . db ( 'abortSignal' ) ,
584- 'support' ,
585- {
586- provider : 'local' ,
587- createCollectionOptions : {
588- encryptedFields : autoEncryption . encryptedFieldsMap [ 'abortSignal.support' ]
589- }
590- }
591- )
592- ) . encryptedFields ;
593- } finally {
594- await utilClient . close ( ) ;
595- }
596-
597- utilClient = this . configuration . newClient ( { } , { autoEncryption } ) ;
598- try {
599- await utilClient
600- . db ( 'abortSignal' )
601- . collection ( 'support' )
602- . insertMany ( [
603- { a : 1 , ssn : '0000-00-0001' } ,
604- { a : 2 , ssn : '0000-00-0002' } ,
605- { a : 3 , ssn : '0000-00-0003' }
606- ] ) ;
607- } finally {
608- await utilClient . close ( ) ;
609- }
610- } ) ;
611-
612- beforeEach ( async function ( ) {
613- client = this . configuration . newClient (
614- { } ,
615- {
616- autoEncryption,
617- monitorCommands : true ,
618- appName : 'abortSignalClient' ,
619- __enableMongoLogger : true ,
620- __internalLoggerConfig : { MONGODB_LOG_SERVER_SELECTION : 'debug' } ,
621- mongodbLogPath : { write : log => logs . push ( log ) } ,
622- serverSelectionTimeoutMS : 10_000 ,
623- maxPoolSize : 1
624- }
625- ) ;
626- await client . connect ( ) ;
627- db = client . db ( 'abortSignal' ) ;
628- collection = db . collection ( 'support' ) ;
629-
630- method = collection [ cursorName ] . bind ( collection ) ;
631- filter = cursorName === 'aggregate' ? [ ] : { } ;
632- } ) ;
633-
634- afterEach ( async function ( ) {
635- await client ?. close ( ) ;
636- } ) ;
637-
638- describe ( 'and the signal is aborted during command encryption' , fleMetadata , ( ) => {
639- function test ( cursorAPI , args ) {
640- let controller : AbortController ;
641- let signal : AbortSignal ;
642- let cursor : AbstractCursor < { a : number } > ;
643-
644- beforeEach ( async function ( ) {
645- controller = new AbortController ( ) ;
646- signal = controller . signal ;
647- cursor = method ( filter , { signal } ) ;
648- } ) ;
649-
650- afterEach ( async function ( ) {
651- sinon . restore ( ) ;
652- await cursor ?. close ( ) ;
653- } ) ;
654-
655- it ( `rejects ${ cursorAPI . toString ( ) } ` , fleMetadata , async ( ) => {
656- const willBeResultBlocked = iterateUntilDocumentOrError ( cursor , cursorAPI , args ) ;
657-
658- const stub = sinon
659- . stub ( client . options . autoEncrypter , 'encrypt' )
660- . callsFake ( function ( ...args ) {
661- controller . abort ( ) ;
662- return stub . wrappedMethod . apply ( this , args ) ;
663- } ) ;
664-
665- const result = await willBeResultBlocked ;
666-
667- expect ( result ) . to . be . instanceOf ( DOMException ) ;
668- } ) ;
669- }
670-
671- for ( const [ cursorAPI , { value : args } ] of getAllProps ( cursorAPIs ) ) {
672- test ( cursorAPI , args ) ;
673- }
674- } ) ;
675-
676- describe ( 'and the signal is aborted during command decryption' , fleMetadata , ( ) => {
677- function test ( cursorAPI , args ) {
678- let controller : AbortController ;
679- let signal : AbortSignal ;
680- let cursor : AbstractCursor < { a : number } > ;
681-
682- beforeEach ( async function ( ) {
683- controller = new AbortController ( ) ;
684- signal = controller . signal ;
685- cursor = method ( filter , { signal } ) ;
686- } ) ;
687-
688- afterEach ( async function ( ) {
689- sinon . restore ( ) ;
690- await cursor ?. close ( ) ;
691- } ) ;
692-
693- it ( `rejects ${ cursorAPI . toString ( ) } ` , fleMetadata , async ( ) => {
694- const willBeResultBlocked = iterateUntilDocumentOrError ( cursor , cursorAPI , args ) ;
695-
696- const stub = sinon
697- . stub ( client . options . autoEncrypter , 'decrypt' )
698- . callsFake ( function ( ...args ) {
699- controller . abort ( ) ;
700- return stub . wrappedMethod . apply ( this , args ) ;
701- } ) ;
702-
703- const result = await willBeResultBlocked ;
704-
705- expect ( result ) . to . be . instanceOf ( DOMException ) ;
706- } ) ;
707- }
708-
709- for ( const [ cursorAPI , { value : args } ] of getAllProps ( cursorAPIs ) ) {
710- test ( cursorAPI , args ) ;
711- }
712- } ) ;
713- } ) ;
714- }
715516 } ) ;
716517 }
717518
0 commit comments