@@ -237,20 +237,22 @@ describe('Lifecycle Conductor', () => {
237237 getData : ( _ , cb ) => cb ( null , null , null ) ,
238238 setData : ( path , data , version , cb ) => cb ( null , { version : 1 } ) ,
239239 } ;
240+ conductor . _producer = { send : ( msg , cb ) => cb ( null , { } ) } ;
240241
241242 sinon . stub ( conductor , '_controlBacklog' ) . callsFake ( cb => cb ( null ) ) ;
243+ sinon . stub ( conductor , 'listBuckets' )
244+ . callsFake ( ( queue , scanId , log , cb ) => {
245+ // Verify scanId is a valid UUID
246+ const uuidRegex = / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 4 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i;
247+ assert ( uuidRegex . test ( scanId ) ,
248+ `conductorScanId should be a valid UUID v4, got: ${ scanId } ` ) ;
249+ cb ( null , 0 ) ;
250+ } ) ;
242251 const metricStub = sinon . stub ( LifecycleMetrics , 'onConductorFullScan' ) ;
243252
244253 conductor . processBuckets ( err => {
245254 assert . ifError ( err ) ;
246255 assert ( metricStub . calledOnce ) ;
247- const scanId = metricStub . firstCall . args [ 0 ] ;
248- assert ( scanId ) ;
249- assert ( typeof scanId === 'string' ) ;
250- // Validate UUID v4 format: 8-4-4-4-12 hex characters
251- const uuidRegex = / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 4 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i;
252- assert ( uuidRegex . test ( scanId ) ,
253- `conductorScanId should be a valid UUID v4, got: ${ scanId } ` ) ;
254256 done ( ) ;
255257 } ) ;
256258 } ) ;
0 commit comments