@@ -34,27 +34,14 @@ describe('Kerberos', function () {
3434 client = null ;
3535 } ) ;
3636
37- if ( process . env . MONGODB_URI == null ) {
38- console . error ( 'skipping Kerberos tests, MONGODB_URI environment variable is not defined' ) ;
39- return ;
40- }
41- let krb5Uri = process . env . MONGODB_URI ;
42- const parts = krb5Uri . split ( '@' , 2 ) ;
43- const host = parts [ 1 ] . split ( '/' ) [ 0 ] ;
37+ const krb5Uri = process . env . MONGODB_URI ;
38+ const host = process . env . SASL_HOST ;
4439
45- if ( ! process . env . KRB5_PRINCIPAL ) {
46- console . error ( 'skipping Kerberos tests, KRB5_PRINCIPAL environment variable is not defined' ) ;
40+ if ( ! process . env . PRINCIPAL ) {
41+ console . error ( 'skipping Kerberos tests, PRINCIPAL environment variable is not defined' ) ;
4742 return ;
4843 }
4944
50- if ( process . platform === 'win32' ) {
51- console . error ( 'Win32 run detected' ) ;
52- if ( process . env . LDAPTEST_PASSWORD == null ) {
53- throw new Error ( 'The env parameter LDAPTEST_PASSWORD must be set' ) ;
54- }
55- krb5Uri = `${ parts [ 0 ] } :${ process . env . LDAPTEST_PASSWORD } @${ parts [ 1 ] } ` ;
56- }
57-
5845 it ( 'should authenticate with original uri' , async function ( ) {
5946 client = new MongoClient ( krb5Uri ) ;
6047 await client . connect ( ) ;
@@ -231,7 +218,9 @@ describe('Kerberos', function () {
231218 if ( ! expectedError ) {
232219 expect . fail ( 'Expected connect with invalid SERVICE_HOST to fail' ) ;
233220 }
234- expect ( expectedError . message ) . to . match ( / G S S f a i l u r e | U N K N O W N _ S E R V E R / ) ;
221+ expect ( expectedError . message ) . to . match (
222+ / G S S f a i l u r e | U N K N O W N _ S E R V E R | S e r v e r n o t f o u n d i n K e r b e r o s d a t a b a s e /
223+ ) ;
235224 } ) ;
236225 } ) ;
237226
@@ -277,7 +266,7 @@ describe('Kerberos', function () {
277266
278267 it ( 'should fail to authenticate with bad credentials' , async function ( ) {
279268 client = new MongoClient (
280- krb5Uri . replace ( encodeURIComponent ( process . env . KRB5_PRINCIPAL ) , 'bad%40creds.cc' )
269+ krb5Uri . replace ( encodeURIComponent ( process . env . PRINCIPAL ) , 'bad%40creds.cc' )
281270 ) ;
282271 const err = await client . connect ( ) . catch ( e => e ) ;
283272 expect ( err . message ) . to . match ( / A u t h e n t i c a t i o n f a i l e d / ) ;
0 commit comments