@@ -10,7 +10,7 @@ import type { TestShell } from './test-shell';
1010import path from 'path' ;
1111import { expect } from 'chai' ;
1212import { createServer as createHTTPSServer } from 'https' ;
13- import { getCertPath , useTmpdir } from './repl-helpers' ;
13+ import { getCertPath , readReplLogFile , useTmpdir } from './repl-helpers' ;
1414import {
1515 baseOidcServerConfig ,
1616 commonOidcServerArgs ,
@@ -530,6 +530,34 @@ describe('OIDC auth e2e', function () {
530530 shell . assertContainsOutput ( / " r e f r e s h T o k e n " : " (? ! d e b u g i d : ) / ) ;
531531 } ) ;
532532
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+
533561 it ( 'can successfully authenticate using workload OIDC' , async function ( ) {
534562 // Get a token from the OIDC server, store it to disk, then pass that to mongosh
535563 const tokenFile = path . join ( tmpdir . path , 'token' ) ;
0 commit comments