- it('Verify buildInternalWorkerChoiceStrategyOptions() behavior', () => {
- const poolMaxSize = 10
- const internalWorkerChoiceStrategyOptions =
- buildInternalWorkerChoiceStrategyOptions(poolMaxSize)
- expect(internalWorkerChoiceStrategyOptions).toStrictEqual({
- retries:
- poolMaxSize +
- Object.keys(internalWorkerChoiceStrategyOptions.weights).length,
+ it('Verify getWorkerChoiceStrategyRetries() behavior', async () => {
+ const numberOfThreads = 4
+ const pool = new FixedThreadPool(
+ numberOfThreads,
+ './tests/worker-files/thread/testWorker.mjs'
+ )
+ expect(getWorkerChoiceStrategyRetries(pool)).toBe(pool.info.maxSize * 2)
+ await pool.destroy()
+ })
+
+ it('Verify buildWorkerChoiceStrategyOptions() behavior', async () => {
+ const numberOfWorkers = 4
+ const pool = new FixedClusterPool(
+ numberOfWorkers,
+ './tests/worker-files/cluster/testWorker.cjs'
+ )
+ expect(buildWorkerChoiceStrategyOptions(pool)).toStrictEqual({