@@ -11,7 +11,6 @@ import * as bson from 'bson';
1111import { expect } from 'chai' ;
1212import { EventEmitter } from 'events' ;
1313import { promises as fs } from 'fs' ;
14- import path from 'path' ;
1514import { Duplex } from 'stream' ;
1615import sinon from 'sinon' ;
1716import type { StubbedInstance } from 'ts-sinon' ;
@@ -33,6 +32,7 @@ import {
3332 startSharedTestServer ,
3433 makeFakeHTTPConnection ,
3534 fakeAWSHandlers ,
35+ getTestCertificatePath ,
3636} from '@mongosh/testing' ;
3737import { Collection } from './collection' ;
3838import { dummyOptions } from './helpers.spec' ;
@@ -84,10 +84,6 @@ const exampleUUID = new bson.Binary(
8484 4
8585) . toUUID ( ) ;
8686
87- function getCertPath ( filename : string ) : string {
88- return path . join ( __dirname , '..' , '..' , 'testing' , 'certificates' , filename ) ;
89- }
90-
9187describe ( 'Field Level Encryption' , function ( ) {
9288 let sp : StubbedInstance < ServiceProvider > ;
9389 let mongo : Mongo ;
@@ -871,9 +867,11 @@ srDVjIT3LsvTqw==`,
871867 {
872868 endpoint : 'kmip.example.com:123' ,
873869 tlsOptions : {
874- tlsCertificateKeyFile : getCertPath ( 'client.bundle.encrypted.pem' ) ,
870+ tlsCertificateKeyFile : getTestCertificatePath (
871+ 'client.bundle.encrypted.pem'
872+ ) ,
875873 tlsCertificateKeyFilePassword : 'p4ssw0rd' ,
876- tlsCAFile : getCertPath ( 'ca.crt' ) ,
874+ tlsCAFile : getTestCertificatePath ( 'ca.crt' ) ,
877875 } ,
878876 } ,
879877 ] ,
@@ -941,19 +939,20 @@ srDVjIT3LsvTqw==`,
941939 servername : 'kmip.example.com' ,
942940 port : 123 ,
943941 passphrase : 'p4ssw0rd' ,
944- ca : await fs . readFile ( getCertPath ( 'ca.crt' ) ) ,
942+ ca : await fs . readFile ( getTestCertificatePath ( 'ca.crt' ) ) ,
945943 cert : await fs . readFile (
946- getCertPath ( 'client.bundle.encrypted.pem' )
944+ getTestCertificatePath ( 'client.bundle.encrypted.pem' )
947945 ) ,
948946 key : await fs . readFile (
949- getCertPath ( 'client.bundle.encrypted.pem' )
947+ getTestCertificatePath ( 'client.bundle.encrypted.pem' )
950948 ) ,
951949 } ,
952950 } ,
953951 ] ) ;
954952 return ;
955953 }
956954 expect . fail ( 'missed exception' ) ;
955+ break ;
957956 default :
958957 throw new Error ( `unreachable ${ kmsName } ` ) ;
959958 }
0 commit comments