Verify that the configured worker choice is going to be used when a
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 10 Oct 2022 16:32:03 +0000 (18:32 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 10 Oct 2022 16:32:03 +0000 (18:32 +0200)
dynamic pool is busy

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
tests/pools/selection-strategies/worker-choice-strategy-context.test.js

index ae608fda6133a35c88a4b8fc23d5e6586493e891..c33dad80dc885712e95cfa1945119ebf1b1f53ba 100644 (file)
@@ -108,6 +108,9 @@ describe('Worker choice strategy context test suite', () => {
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf(
       DynamicPoolWorkerChoiceStrategy
     )
+    expect(
+      workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy
+    ).toBeInstanceOf(RoundRobinWorkerChoiceStrategy)
   })
 
   it('Verify that setWorkerChoiceStrategy() works with LESS_RECENTLY_USED and fixed pool', () => {
@@ -132,6 +135,9 @@ describe('Worker choice strategy context test suite', () => {
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf(
       DynamicPoolWorkerChoiceStrategy
     )
+    expect(
+      workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy
+    ).toBeInstanceOf(LessRecentlyUsedWorkerChoiceStrategy)
   })
 
   it('Verify that setWorkerChoiceStrategy() works with FAIR_SHARE and fixed pool', () => {
@@ -156,6 +162,9 @@ describe('Worker choice strategy context test suite', () => {
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf(
       DynamicPoolWorkerChoiceStrategy
     )
+    expect(
+      workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy
+    ).toBeInstanceOf(FairShareWorkerChoiceStrategy)
   })
 
   it('Verify that setWorkerChoiceStrategy() works with WEIGHTED_ROUND_ROBIN and fixed pool', () => {
@@ -180,5 +189,8 @@ describe('Worker choice strategy context test suite', () => {
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf(
       DynamicPoolWorkerChoiceStrategy
     )
+    expect(
+      workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy
+    ).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy)
   })
 })