@@ -293,64 +293,69 @@ describe('Selection strategies test suite', () => {
293293 await pool . destroy ( )
294294 } )
295295
296- it ( 'Verify ROUND_ROBIN strategy can be run in a dynamic pool' , async ( ) => {
297- const workerChoiceStrategy = WorkerChoiceStrategies . ROUND_ROBIN
298- const pool = new DynamicThreadPool (
299- min ,
300- max ,
301- new URL ( './../../worker-files/thread/testWorker.mjs' , import . meta. url ) ,
302- { workerChoiceStrategy } ,
303- )
304- // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
305- const promises = new Set ( )
306- const maxMultiplier = 2
307- for ( let i = 0 ; i < max * maxMultiplier ; i ++ ) {
308- promises . add ( pool . execute ( ) )
309- }
310- await Promise . all ( promises )
311- for ( const workerNode of pool . workerNodes ) {
312- expect ( workerNode . usage ) . toStrictEqual ( {
313- tasks : {
314- executed : expect . any ( Number ) ,
315- executing : 0 ,
316- queued : 0 ,
317- maxQueued : 0 ,
318- sequentiallyStolen : 0 ,
319- stolen : 0 ,
320- failed : 0 ,
321- } ,
322- runTime : {
323- history : expect . any ( CircularBuffer ) ,
324- } ,
325- waitTime : {
326- history : expect . any ( CircularBuffer ) ,
327- } ,
328- elu : {
329- idle : {
296+ it ( {
297+ name : 'Verify ROUND_ROBIN strategy can be run in a dynamic pool' ,
298+ ignore : Deno . build . os === 'linux' &&
299+ parseInt ( Deno . version . deno . split ( '.' ) [ 0 ] ) >= 2 ,
300+ fn : async ( ) => {
301+ const workerChoiceStrategy = WorkerChoiceStrategies . ROUND_ROBIN
302+ const pool = new DynamicThreadPool (
303+ min ,
304+ max ,
305+ new URL ( './../../worker-files/thread/testWorker.mjs' , import . meta. url ) ,
306+ { workerChoiceStrategy } ,
307+ )
308+ // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
309+ const promises = new Set ( )
310+ const maxMultiplier = 2
311+ for ( let i = 0 ; i < max * maxMultiplier ; i ++ ) {
312+ promises . add ( pool . execute ( ) )
313+ }
314+ await Promise . all ( promises )
315+ for ( const workerNode of pool . workerNodes ) {
316+ expect ( workerNode . usage ) . toStrictEqual ( {
317+ tasks : {
318+ executed : expect . any ( Number ) ,
319+ executing : 0 ,
320+ queued : 0 ,
321+ maxQueued : 0 ,
322+ sequentiallyStolen : 0 ,
323+ stolen : 0 ,
324+ failed : 0 ,
325+ } ,
326+ runTime : {
330327 history : expect . any ( CircularBuffer ) ,
331328 } ,
332- active : {
329+ waitTime : {
333330 history : expect . any ( CircularBuffer ) ,
334331 } ,
335- } ,
336- } )
337- expect ( workerNode . usage . tasks . executed ) . toBeGreaterThanOrEqual ( 0 )
338- expect ( workerNode . usage . tasks . executed ) . toBeLessThanOrEqual (
339- max * maxMultiplier ,
340- )
341- }
342- expect (
343- pool . workerChoiceStrategiesContext . workerChoiceStrategies . get (
344- pool . workerChoiceStrategiesContext . defaultWorkerChoiceStrategy ,
345- ) . nextWorkerNodeKey ,
346- ) . toBe ( pool . workerNodes . length - 1 )
347- expect (
348- pool . workerChoiceStrategiesContext . workerChoiceStrategies . get (
349- pool . workerChoiceStrategiesContext . defaultWorkerChoiceStrategy ,
350- ) . previousWorkerNodeKey ,
351- ) . toBe ( pool . workerNodes . length - 2 )
352- // We need to clean up the resources after our test
353- await pool . destroy ( )
332+ elu : {
333+ idle : {
334+ history : expect . any ( CircularBuffer ) ,
335+ } ,
336+ active : {
337+ history : expect . any ( CircularBuffer ) ,
338+ } ,
339+ } ,
340+ } )
341+ expect ( workerNode . usage . tasks . executed ) . toBeGreaterThanOrEqual ( 0 )
342+ expect ( workerNode . usage . tasks . executed ) . toBeLessThanOrEqual (
343+ max * maxMultiplier ,
344+ )
345+ }
346+ expect (
347+ pool . workerChoiceStrategiesContext . workerChoiceStrategies . get (
348+ pool . workerChoiceStrategiesContext . defaultWorkerChoiceStrategy ,
349+ ) . nextWorkerNodeKey ,
350+ ) . toBe ( pool . workerNodes . length - 1 )
351+ expect (
352+ pool . workerChoiceStrategiesContext . workerChoiceStrategies . get (
353+ pool . workerChoiceStrategiesContext . defaultWorkerChoiceStrategy ,
354+ ) . previousWorkerNodeKey ,
355+ ) . toBe ( pool . workerNodes . length - 2 )
356+ // We need to clean up the resources after our test
357+ await pool . destroy ( )
358+ } ,
354359 } )
355360
356361 it ( 'Verify ROUND_ROBIN strategy runtime behavior' , async ( ) => {
0 commit comments