@@ -10,7 +10,7 @@ import type { TestShell } from './test-shell';
10
10
import path from 'path' ;
11
11
import { expect } from 'chai' ;
12
12
import { createServer as createHTTPSServer } from 'https' ;
13
- import { getCertPath , useTmpdir } from './repl-helpers' ;
13
+ import { getCertPath , readReplLogFile , useTmpdir } from './repl-helpers' ;
14
14
import {
15
15
baseOidcServerConfig ,
16
16
commonOidcServerArgs ,
@@ -530,6 +530,34 @@ describe('OIDC auth e2e', function () {
530
530
shell . assertContainsOutput ( / " r e f r e s h T o k e n " : " (? ! d e b u g i d : ) / ) ;
531
531
} ) ;
532
532
533
+ it ( 'logs OIDC HTTP calls' , async function ( ) {
534
+ shell = this . startTestShell ( {
535
+ args : [
536
+ await testServer . connectionString ( ) ,
537
+ '--authenticationMechanism=MONGODB-OIDC' ,
538
+ '--oidcRedirectUri=http://localhost:0/' ,
539
+ `--browser=${ fetchBrowserFixture } ` ,
540
+ '--eval=log.getPath()' ,
541
+ '--quiet' ,
542
+ '--json' ,
543
+ ] ,
544
+ env : {
545
+ ...process . env ,
546
+ HOME : tmpdir . path ,
547
+ LOCALAPPDATA : tmpdir . path ,
548
+ APPDATA : tmpdir . path ,
549
+ } ,
550
+ } ) ;
551
+ await shell . waitForSuccessfulExit ( ) ;
552
+ const logs = await readReplLogFile ( JSON . parse ( shell . output ) ) ;
553
+ const inbound = logs . find ( ( e ) => e . id === 1_002_000_024 ) ;
554
+ const outbound = logs . find ( ( e ) => e . id === 1_002_000_023 ) ;
555
+ expect ( inbound ?. attr . url ) . to . be . a ( 'string' ) ;
556
+ expect ( inbound ?. s ) . to . equal ( 'D1' ) ;
557
+ expect ( outbound ?. attr . url ) . to . be . a ( 'string' ) ;
558
+ expect ( outbound ?. s ) . to . equal ( 'D1' ) ;
559
+ } ) ;
560
+
533
561
it ( 'can successfully authenticate using workload OIDC' , async function ( ) {
534
562
// Get a token from the OIDC server, store it to disk, then pass that to mongosh
535
563
const tokenFile = path . join ( tmpdir . path , 'token' ) ;
0 commit comments