@@ -4,13 +4,11 @@ import { clearTimeout, setTimeout } from 'timers';
44import { inspect } from 'util' ;
55
66import {
7- addContainerMetadata ,
87 CMAP_EVENTS ,
98 type Connection ,
109 ConnectionPool ,
1110 type ConnectionPoolOptions ,
1211 type HostAddress ,
13- makeClientMetadata ,
1412 type MongoClient ,
1513 type Server ,
1614 shuffle ,
@@ -324,7 +322,9 @@ export class ThreadContext {
324322 hostAddress : this . #hostAddress,
325323 serverApi : process . env . MONGODB_API_VERSION
326324 ? { version : process . env . MONGODB_API_VERSION }
327- : undefined
325+ : undefined ,
326+
327+ extendedMetadata : this . #server. topology . client . options ?. extendedMetadata
328328 } ) ;
329329 this . #originalServerPool = this . #server. pool ;
330330 this . #server. pool = this . pool ;
@@ -376,8 +376,8 @@ async function runCmapTest(test: CmapTest, threadContext: ThreadContext) {
376376 delete poolOptions . backgroundThreadIntervalMS ;
377377 }
378378
379- const metadata = makeClientMetadata ( { appName : poolOptions . appName , driverInfo : { } } ) ;
380- const extendedMetadata = addContainerMetadata ( metadata ) ;
379+ // const metadata = makeClientMetadata({ appName: poolOptions.appName });
380+ // const extendedMetadata = addContainerMetadata(metadata);
381381 delete poolOptions . appName ;
382382
383383 const operations = test . operations ;
@@ -391,8 +391,6 @@ async function runCmapTest(test: CmapTest, threadContext: ThreadContext) {
391391
392392 threadContext . createPool ( {
393393 ...poolOptions ,
394- metadata,
395- extendedMetadata,
396394 minPoolSizeCheckFrequencyMS
397395 } ) ;
398396 // yield control back to the event loop so that the ConnectionPoolCreatedEvent
@@ -513,10 +511,15 @@ export function runCmapTestSuite(
513511 const selectedHostUri = hosts [ 0 ] ;
514512 hostAddress = serverDescriptionMap . get ( selectedHostUri ) . hostAddress ;
515513
514+ const clientOptions : { appName ?: string } = { } ;
515+ if ( test . poolOptions ?. appName ) {
516+ clientOptions . appName = test . poolOptions . appName ;
517+ }
516518 client = this . configuration . newClient (
517519 `mongodb://${ hostAddress } /${
518520 this . configuration . isLoadBalanced ? '?loadBalanced=true' : '?directConnection=true'
519- } `
521+ } `,
522+ clientOptions
520523 ) ;
521524 await client . connect ( ) ;
522525 if ( test . failPoint ) {
0 commit comments