@@ -88,34 +88,39 @@ describe('Kerberos', function () {
88
88
}
89
89
} ) ;
90
90
91
- context ( 'when the value is true' , function ( ) {
92
- it ( 'successfully authenticates' , function ( done ) {
93
- const client = new MongoClient (
94
- `${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:true&maxPoolSize=1`
95
- ) ;
96
- client . connect ( function ( err , client ) {
97
- if ( err ) return done ( err ) ;
98
- expect ( dns . resolveCname ) . to . be . calledOnce ;
99
- verifyKerberosAuthentication ( client , done ) ;
91
+ for ( const option of [ true , 'forward' ] ) {
92
+ context ( `when the value is ${ option } ` , function ( ) {
93
+ it ( 'authenticates with a forward cname lookup' , function ( done ) {
94
+ const client = new MongoClient (
95
+ `${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${ option } &maxPoolSize=1`
96
+ ) ;
97
+ client . connect ( function ( err , client ) {
98
+ if ( err ) return done ( err ) ;
99
+ expect ( dns . resolveCname ) . to . be . calledOnce ;
100
+ verifyKerberosAuthentication ( client , done ) ;
101
+ } ) ;
100
102
} ) ;
101
103
} ) ;
102
- } ) ;
104
+ }
103
105
104
- context ( 'when the value is forward' , function ( ) {
105
- it ( 'successfully authenticates' , function ( done ) {
106
- const client = new MongoClient (
107
- `${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:forward&maxPoolSize=1`
108
- ) ;
109
- client . connect ( function ( err , client ) {
110
- if ( err ) return done ( err ) ;
111
- expect ( dns . resolveCname ) . to . be . calledOnce ;
112
- verifyKerberosAuthentication ( client , done ) ;
106
+ for ( const option of [ false , 'none' ] ) {
107
+ context ( `when the value is ${ option } ` , function ( ) {
108
+ it ( 'authenticates with no dns lookups' , function ( done ) {
109
+ const client = new MongoClient (
110
+ `${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${ option } &maxPoolSize=1`
111
+ ) ;
112
+ client . connect ( function ( err , client ) {
113
+ if ( err ) return done ( err ) ;
114
+ expect ( dns . resolveCname ) . to . not . be . called ;
115
+ expect ( dns . lookup ) . to . not . be . called ;
116
+ verifyKerberosAuthentication ( client , done ) ;
117
+ } ) ;
113
118
} ) ;
114
119
} ) ;
115
- } ) ;
120
+ }
116
121
117
122
context ( 'when the value is forwardAndReverse' , function ( ) {
118
- it ( 'successfully authenticates' , function ( done ) {
123
+ it ( 'authenticates with a forward dns lookup and a reverse ptr lookup ' , function ( done ) {
119
124
const client = new MongoClient (
120
125
`${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:forwardAndReverse&maxPoolSize=1`
121
126
) ;
@@ -127,34 +132,6 @@ describe('Kerberos', function () {
127
132
} ) ;
128
133
} ) ;
129
134
} ) ;
130
-
131
- context ( 'when the value is false' , function ( ) {
132
- it ( 'successfully authenticates' , function ( done ) {
133
- const client = new MongoClient (
134
- `${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:false&maxPoolSize=1`
135
- ) ;
136
- client . connect ( function ( err , client ) {
137
- if ( err ) return done ( err ) ;
138
- expect ( dns . resolveCname ) . to . not . be . calledOnce ;
139
- expect ( dns . lookup ) . to . not . be . calledOnce ;
140
- verifyKerberosAuthentication ( client , done ) ;
141
- } ) ;
142
- } ) ;
143
- } ) ;
144
-
145
- context ( 'when the value is none' , function ( ) {
146
- it ( 'successfully authenticates' , function ( done ) {
147
- const client = new MongoClient (
148
- `${ krb5Uri } &authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:none&maxPoolSize=1`
149
- ) ;
150
- client . connect ( function ( err , client ) {
151
- if ( err ) return done ( err ) ;
152
- expect ( dns . resolveCname ) . to . not . be . calledOnce ;
153
- expect ( dns . lookup ) . to . not . be . calledOnce ;
154
- verifyKerberosAuthentication ( client , done ) ;
155
- } ) ;
156
- } ) ;
157
- } ) ;
158
135
} ) ;
159
136
160
137
// Unskip this test when a proper setup is available - see NODE-3060
0 commit comments