@@ -34,27 +34,14 @@ describe('Kerberos', function () {
34
34
client = null ;
35
35
} ) ;
36
36
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 ;
44
39
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' ) ;
47
42
return ;
48
43
}
49
44
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
-
58
45
it ( 'should authenticate with original uri' , async function ( ) {
59
46
client = new MongoClient ( krb5Uri ) ;
60
47
await client . connect ( ) ;
@@ -231,7 +218,9 @@ describe('Kerberos', function () {
231
218
if ( ! expectedError ) {
232
219
expect . fail ( 'Expected connect with invalid SERVICE_HOST to fail' ) ;
233
220
}
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
+ ) ;
235
224
} ) ;
236
225
} ) ;
237
226
@@ -277,7 +266,7 @@ describe('Kerberos', function () {
277
266
278
267
it ( 'should fail to authenticate with bad credentials' , async function ( ) {
279
268
client = new MongoClient (
280
- krb5Uri . replace ( encodeURIComponent ( process . env . KRB5_PRINCIPAL ) , 'bad%40creds.cc' )
269
+ krb5Uri . replace ( encodeURIComponent ( process . env . PRINCIPAL ) , 'bad%40creds.cc' )
281
270
) ;
282
271
const err = await client . connect ( ) . catch ( e => e ) ;
283
272
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