Skip to content

Commit 225b084

Browse files
committed
test: ignore flaky workerNodeKeys affinity test on Linux
1 parent 9b295f9 commit 225b084

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

tests/pools/abstract-pool.test.mjs

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,37 +1941,45 @@ describe({
19411941
await dynamicThreadPool.destroy()
19421942
})
19431943

1944-
it('Verify that execute() creates dynamic workers for workerNodeKeys affinity', async () => {
1945-
const dynamicThreadPool = new DynamicThreadPool(
1946-
1,
1947-
4,
1948-
new URL('./../worker-files/thread/testWorker.mjs', import.meta.url),
1949-
)
1950-
await waitPoolEvents(dynamicThreadPool, PoolEvents.ready, 1)
1951-
expect(dynamicThreadPool.workerNodes.length).toBe(1)
1944+
it({
1945+
name:
1946+
'Verify that execute() creates dynamic workers for workerNodeKeys affinity',
1947+
ignore: Deno.build.os === 'linux' &&
1948+
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
1949+
fn: async () => {
1950+
const dynamicThreadPool = new DynamicThreadPool(
1951+
1,
1952+
4,
1953+
new URL('./../worker-files/thread/testWorker.mjs', import.meta.url),
1954+
)
1955+
await waitPoolEvents(dynamicThreadPool, PoolEvents.ready, 1)
1956+
expect(dynamicThreadPool.workerNodes.length).toBe(1)
19521957

1953-
await dynamicThreadPool.addTaskFunction('affinityBeyondMin', {
1954-
taskFunction: (data) => data,
1955-
workerNodeKeys: [2, 3],
1956-
})
1958+
await dynamicThreadPool.addTaskFunction('affinityBeyondMin', {
1959+
taskFunction: (data) => data,
1960+
workerNodeKeys: [2, 3],
1961+
})
19571962

1958-
for (const workerNode of dynamicThreadPool.workerNodes) {
1959-
workerNode.usage.tasks.executed = 0
1960-
}
1963+
for (const workerNode of dynamicThreadPool.workerNodes) {
1964+
workerNode.usage.tasks.executed = 0
1965+
}
19611966

1962-
const tasks = []
1963-
for (let i = 0; i < 4; i++) {
1964-
tasks.push(dynamicThreadPool.execute({ test: i }, 'affinityBeyondMin'))
1965-
}
1966-
await Promise.all(tasks)
1967+
const tasks = []
1968+
for (let i = 0; i < 4; i++) {
1969+
tasks.push(
1970+
dynamicThreadPool.execute({ test: i }, 'affinityBeyondMin'),
1971+
)
1972+
}
1973+
await Promise.all(tasks)
19671974

1968-
expect(dynamicThreadPool.workerNodes.length).toBeGreaterThanOrEqual(4)
1969-
const executedOnAffinity =
1970-
dynamicThreadPool.workerNodes[2].usage.tasks.executed +
1971-
dynamicThreadPool.workerNodes[3].usage.tasks.executed
1972-
expect(executedOnAffinity).toBe(4)
1975+
expect(dynamicThreadPool.workerNodes.length).toBeGreaterThanOrEqual(4)
1976+
const executedOnAffinity =
1977+
dynamicThreadPool.workerNodes[2].usage.tasks.executed +
1978+
dynamicThreadPool.workerNodes[3].usage.tasks.executed
1979+
expect(executedOnAffinity).toBe(4)
19731980

1974-
await dynamicThreadPool.destroy()
1981+
await dynamicThreadPool.destroy()
1982+
},
19751983
})
19761984

19771985
it('Verify that removeTaskFunction() is working', async () => {

0 commit comments

Comments
 (0)