@@ -323,6 +323,7 @@ describe('CliRepl', function () {
323
323
'updateURL' ,
324
324
'disableLogging' ,
325
325
'logLocation' ,
326
+ 'logRetentionDays' ,
326
327
] satisfies ( keyof CliUserConfig ) [ ] ) ;
327
328
} ) ;
328
329
@@ -1427,33 +1428,6 @@ describe('CliRepl', function () {
1427
1428
)
1428
1429
) . to . have . lengthOf ( 1 ) ;
1429
1430
} ) ;
1430
- } ) ;
1431
-
1432
- context ( 'logging configuration' , function ( ) {
1433
- it ( 'logging is enabled by default and event is called' , async function ( ) {
1434
- const onLogInitialized = sinon . stub ( ) ;
1435
- cliRepl . bus . on ( 'mongosh:log-initialized' , onLogInitialized ) ;
1436
-
1437
- await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
1438
-
1439
- expect ( await cliRepl . getConfig ( 'disableLogging' ) ) . is . false ;
1440
-
1441
- expect ( onLogInitialized ) . calledOnce ;
1442
- expect ( cliRepl . logWriter ) . is . instanceOf ( MongoLogWriter ) ;
1443
- } ) ;
1444
-
1445
- it ( 'does not initialize logging when it is disabled' , async function ( ) {
1446
- cliRepl . config . disableLogging = true ;
1447
- const onLogInitialized = sinon . stub ( ) ;
1448
- cliRepl . bus . on ( 'mongosh:log-initialized' , onLogInitialized ) ;
1449
-
1450
- await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
1451
-
1452
- expect ( await cliRepl . getConfig ( 'disableLogging' ) ) . is . true ;
1453
- expect ( onLogInitialized ) . not . called ;
1454
-
1455
- expect ( cliRepl . logWriter ) . is . undefined ;
1456
- } ) ;
1457
1431
1458
1432
it ( 'can set the log location' , async function ( ) {
1459
1433
const testPath = path . join ( './test' , 'path' ) ;
@@ -1463,6 +1437,19 @@ describe('CliRepl', function () {
1463
1437
expect ( cliRepl . getConfig ( 'logLocation' ) ) . is . true ;
1464
1438
expect ( cliRepl . logWriter ?. logFilePath ) . equals ( testPath ) ;
1465
1439
} ) ;
1440
+
1441
+ it ( 'can set log retention days' , async function ( ) {
1442
+ const testRetentionDays = 123 ;
1443
+ cliRepl . config . logRetentionDays = testRetentionDays ;
1444
+ await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
1445
+
1446
+ expect ( cliRepl . getConfig ( 'logRetentionDays' ) ) . equals (
1447
+ testRetentionDays
1448
+ ) ;
1449
+ expect ( cliRepl . logManager ?. _options . retentionDays ) . equals (
1450
+ testRetentionDays
1451
+ ) ;
1452
+ } ) ;
1466
1453
} ) ;
1467
1454
1468
1455
it ( 'times out fast' , async function ( ) {
0 commit comments