@@ -54,22 +54,6 @@ describe('x509 Authentication', function () {
5454 } ) ;
5555 } ) ;
5656
57- context (
58- 'when a valid cert is provided but the certificate does not correspond to a user' ,
59- function ( ) {
60- it . skip ( 'fails to authenticate' , async function ( ) {
61- client = new MongoClient ( connectionString . toString ( ) , validOptions ) ;
62- const error = await client . connect ( ) . then (
63- ( ) => null ,
64- e => e
65- ) ;
66-
67- expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
68- expect ( error . codeName ) . to . match ( / U s e r N o t F o u n d / i) ;
69- } ) . skipReason = 'TODO(NODE-6834): fix flaky test' ;
70- }
71- ) ;
72-
7357 context ( 'when the client connects with an invalid certificate' , function ( ) {
7458 // unlike other authentication mechanisms, x509 authentication 1) requires TLS and
7559 // 2) the server uses the client certificate to derive a username to authenticate with
@@ -93,6 +77,19 @@ describe('x509 Authentication', function () {
9377 expect ( error ) . to . be . instanceOf ( MongoServerSelectionError ) ;
9478 } ) ;
9579 } ) ;
80+
81+ context (
82+ 'when a valid cert is provided but the certificate does not correspond to a user' ,
83+ function ( ) {
84+ it ( 'fails to authenticate' , async function ( ) {
85+ client = new MongoClient ( connectionString . toString ( ) , validOptions ) ;
86+ const error = await client . connect ( ) . catch ( error => error ) ;
87+
88+ expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
89+ expect ( error . codeName ) . to . match ( / U s e r N o t F o u n d / i) ;
90+ } ) ;
91+ }
92+ ) ;
9693} ) ;
9794
9895async function createX509User ( ) {
@@ -110,8 +107,7 @@ async function createX509User() {
110107 roles : [
111108 { role : 'readWrite' , db : 'test' } ,
112109 { role : 'userAdminAnyDatabase' , db : 'admin' }
113- ] ,
114- writeConcern : { w : 'majority' , wtimeout : 5000 }
110+ ]
115111 } ) ;
116112 } finally {
117113 await utilClient . close ( ) ;
@@ -128,8 +124,7 @@ async function dropX509User() {
128124 try {
129125 await utilClient . connect ( ) ;
130126 await utilClient . db ( '$external' ) . command ( {
131- dropUser : process . env . SUBJECT ,
132- writeConcern : { w : 'majority' , wtimeout : 5000 }
127+ dropUser : process . env . SUBJECT
133128 } ) ;
134129 } finally {
135130 await utilClient . close ( ) ;
0 commit comments