@@ -233,10 +233,10 @@ export class ConnectionStorage {
233
233
return deleteCompassAppNameParam ( connectionInfo ) ;
234
234
}
235
235
236
+ // This method is only called when compass tries to migrate connections to a new version.
237
+ // In e2e-tests we do not migrate any connections as all the connections are created
238
+ // in the new format, so keychain is not triggered (using keytar) and hence test is not blocked.
236
239
private static async getKeytarCredentials ( ) {
237
- if ( process . env . COMPASS_E2E_DISABLE_KEYCHAIN_USAGE === 'true' ) {
238
- return { } ;
239
- }
240
240
try {
241
241
const credentials = await keytar . findCredentials ( getKeytarServiceName ( ) ) ;
242
242
return Object . fromEntries (
@@ -326,34 +326,26 @@ export class ConnectionStorage {
326
326
// where we use storage-mixin. storage-mixin uses this prop
327
327
// to map keytar credentials to the stored connection.
328
328
329
- // While testing, we don't use keychain to store secrets
330
- if ( process . env . COMPASS_E2E_DISABLE_KEYCHAIN_USAGE === 'true' ) {
331
- await this . userData . write ( connectionInfo . id , {
332
- connectionInfo,
333
- _id : connectionInfo . id ,
334
- } ) ;
335
- } else {
336
- const { secrets, connectionInfo : connectionInfoWithoutSecrets } =
337
- extractSecrets ( connectionInfo ) ;
338
-
339
- let connectionSecrets : string | undefined = undefined ;
340
- try {
341
- connectionSecrets = this . encryptSecrets ( secrets ) ;
342
- } catch ( e ) {
343
- log . error (
344
- mongoLogId ( 1_001_000_202 ) ,
345
- 'Connection Storage' ,
346
- 'Failed to encrypt secrets' ,
347
- { message : ( e as Error ) . message }
348
- ) ;
349
- }
350
- await this . userData . write ( connectionInfo . id , {
351
- _id : connectionInfo . id ,
352
- connectionInfo : connectionInfoWithoutSecrets ,
353
- connectionSecrets,
354
- version : this . version ,
355
- } ) ;
329
+ const { secrets, connectionInfo : connectionInfoWithoutSecrets } =
330
+ extractSecrets ( connectionInfo ) ;
331
+
332
+ let connectionSecrets : string | undefined = undefined ;
333
+ try {
334
+ connectionSecrets = this . encryptSecrets ( secrets ) ;
335
+ } catch ( e ) {
336
+ log . error (
337
+ mongoLogId ( 1_001_000_202 ) ,
338
+ 'Connection Storage' ,
339
+ 'Failed to encrypt secrets' ,
340
+ { message : ( e as Error ) . message }
341
+ ) ;
356
342
}
343
+ await this . userData . write ( connectionInfo . id , {
344
+ _id : connectionInfo . id ,
345
+ connectionInfo : connectionInfoWithoutSecrets ,
346
+ connectionSecrets,
347
+ version : this . version ,
348
+ } ) ;
357
349
await this . afterConnectionHasBeenSaved ( connectionInfo ) ;
358
350
} catch ( err ) {
359
351
log . error (
0 commit comments