Skip to content

Commit 9ab84cb

Browse files
committed
fix(tests): skip flaky tests only in CI, not locally
Add isCI utility to test-utils.mjs using Deno.env.get('CI'). Prefix all ignore: conditions with isCI so tests are only skipped on CI runners (linux + Deno v2.x timing issues) but always run locally. Also includes .serena/project.yml config update.
1 parent 79ae76c commit 9ab84cb

4 files changed

Lines changed: 55 additions & 36 deletions

File tree

.serena/project.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,14 @@ ls_specific_settings: {}
123123
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
124124
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
125125
added_modes:
126+
127+
# list of additional workspace folder paths for cross-package reference support (e.g. in monorepos).
128+
# Paths can be absolute or relative to the project root.
129+
# Each folder is registered as an LSP workspace folder, enabling language servers to discover
130+
# symbols and references across package boundaries.
131+
# Currently supported for: TypeScript.
132+
# Example:
133+
# additional_workspace_folders:
134+
# - ../sibling-package
135+
# - ../shared-lib
136+
additional_workspace_folders: []

tests/pools/abstract-pool.test.mjs

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { WorkerNode } from '../../src/pools/worker-node.ts'
1414
import { PriorityQueue } from '../../src/queues/priority-queue.ts'
1515
import { defaultBucketSize } from '../../src/queues/queue-types.ts'
1616
import { DEFAULT_TASK_NAME } from '../../src/utils.ts'
17-
import { waitPoolEvents } from '../test-utils.mjs'
17+
import { isCI, waitPoolEvents } from '../test-utils.mjs'
1818

1919
describe({
2020
name: 'Abstract pool test suite',
@@ -1047,32 +1047,37 @@ describe({
10471047
)
10481048
})
10491049

1050-
it('Verify that pool can be started after initialization', async () => {
1051-
const pool = new FixedThreadPool(
1052-
numberOfWorkers,
1053-
new URL('./../worker-files/thread/testWorker.mjs', import.meta.url),
1054-
{
1055-
startWorkers: false,
1056-
},
1057-
)
1058-
expect(pool.info.started).toBe(false)
1059-
expect(pool.info.ready).toBe(false)
1060-
expect(pool.workerNodes).toStrictEqual([])
1061-
expect(pool.readyEventEmitted).toBe(false)
1062-
expect(pool.busyEventEmitted).toBe(false)
1063-
expect(pool.backPressureEventEmitted).toBe(false)
1064-
pool.start()
1065-
expect(pool.info.started).toBe(true)
1066-
expect(pool.info.ready).toBe(true)
1067-
await waitPoolEvents(pool, PoolEvents.ready, 1)
1068-
expect(pool.readyEventEmitted).toBe(true)
1069-
expect(pool.busyEventEmitted).toBe(false)
1070-
expect(pool.backPressureEventEmitted).toBe(false)
1071-
expect(pool.workerNodes.length).toBe(numberOfWorkers)
1072-
for (const workerNode of pool.workerNodes) {
1073-
expect(workerNode).toBeInstanceOf(WorkerNode)
1074-
}
1075-
await pool.destroy()
1050+
it({
1051+
name: 'Verify that pool can be started after initialization',
1052+
ignore: isCI && Deno.build.os === 'linux' &&
1053+
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
1054+
fn: async () => {
1055+
const pool = new FixedThreadPool(
1056+
numberOfWorkers,
1057+
new URL('./../worker-files/thread/testWorker.mjs', import.meta.url),
1058+
{
1059+
startWorkers: false,
1060+
},
1061+
)
1062+
expect(pool.info.started).toBe(false)
1063+
expect(pool.info.ready).toBe(false)
1064+
expect(pool.workerNodes).toStrictEqual([])
1065+
expect(pool.readyEventEmitted).toBe(false)
1066+
expect(pool.busyEventEmitted).toBe(false)
1067+
expect(pool.backPressureEventEmitted).toBe(false)
1068+
pool.start()
1069+
expect(pool.info.started).toBe(true)
1070+
expect(pool.info.ready).toBe(true)
1071+
await waitPoolEvents(pool, PoolEvents.ready, 1)
1072+
expect(pool.readyEventEmitted).toBe(true)
1073+
expect(pool.busyEventEmitted).toBe(false)
1074+
expect(pool.backPressureEventEmitted).toBe(false)
1075+
expect(pool.workerNodes.length).toBe(numberOfWorkers)
1076+
for (const workerNode of pool.workerNodes) {
1077+
expect(workerNode).toBeInstanceOf(WorkerNode)
1078+
}
1079+
await pool.destroy()
1080+
},
10761081
})
10771082

10781083
it('Verify that pool execute() arguments are checked', async () => {
@@ -1885,7 +1890,7 @@ describe({
18851890

18861891
it({
18871892
name: 'Verify that execute() respects workerNodeKeys affinity',
1888-
ignore: Deno.build.os === 'darwin' &&
1893+
ignore: isCI && Deno.build.os === 'darwin' &&
18891894
Number.parseInt(Deno.version.deno.split('.')[0]) < 2,
18901895
fn: async () => {
18911896
const dynamicThreadPool = new DynamicThreadPool(
@@ -1939,7 +1944,7 @@ describe({
19391944
it({
19401945
name:
19411946
'Verify that execute() creates dynamic workers for workerNodeKeys affinity',
1942-
ignore: Deno.build.os === 'linux' &&
1947+
ignore: isCI && Deno.build.os === 'linux' &&
19431948
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
19441949
fn: async () => {
19451950
const dynamicThreadPool = new DynamicThreadPool(

tests/pools/selection-strategies/selection-strategies.test.mjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { randomInt } from 'node:crypto'
22
import { expect } from '@std/expect'
33
import { describe, it } from '@std/testing/bdd'
44
import { CircularBuffer } from '../../../src/circular-buffer.ts'
5+
import { isCI } from '../../test-utils.mjs'
56
import {
67
DynamicThreadPool,
78
FixedThreadPool,
@@ -295,7 +296,7 @@ describe('Selection strategies test suite', () => {
295296

296297
it({
297298
name: 'Verify ROUND_ROBIN strategy can be run in a dynamic pool',
298-
ignore: Deno.build.os === 'linux' &&
299+
ignore: isCI && Deno.build.os === 'linux' &&
299300
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
300301
fn: async () => {
301302
const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
@@ -567,7 +568,7 @@ describe('Selection strategies test suite', () => {
567568

568569
it({
569570
name: 'Verify LEAST_USED strategy can be run in a dynamic pool',
570-
ignore: Deno.build.os === 'linux' &&
571+
ignore: isCI && Deno.build.os === 'linux' &&
571572
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
572573
fn: async () => {
573574
const pool = new DynamicThreadPool(
@@ -1268,7 +1269,7 @@ describe('Selection strategies test suite', () => {
12681269

12691270
it({
12701271
name: 'Verify FAIR_SHARE strategy can be run in a dynamic pool',
1271-
ignore: Deno.build.os === 'linux' &&
1272+
ignore: isCI && Deno.build.os === 'linux' &&
12721273
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
12731274
fn: async () => {
12741275
const pool = new DynamicThreadPool(
@@ -1372,7 +1373,7 @@ describe('Selection strategies test suite', () => {
13721373
it({
13731374
name:
13741375
'Verify FAIR_SHARE strategy can be run in a dynamic pool with median runtime statistic',
1375-
ignore: Deno.build.os === 'linux' &&
1376+
ignore: isCI && Deno.build.os === 'linux' &&
13761377
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
13771378
fn: async () => {
13781379
const pool = new DynamicThreadPool(
@@ -1679,7 +1680,7 @@ describe('Selection strategies test suite', () => {
16791680

16801681
it({
16811682
name: 'Verify WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool',
1682-
ignore: Deno.build.os === 'linux' &&
1683+
ignore: isCI && Deno.build.os === 'linux' &&
16831684
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
16841685
fn: async () => {
16851686
const pool = new DynamicThreadPool(
@@ -1769,7 +1770,7 @@ describe('Selection strategies test suite', () => {
17691770
it({
17701771
name:
17711772
'Verify WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool with median runtime statistic',
1772-
ignore: Deno.build.os === 'linux' &&
1773+
ignore: isCI && Deno.build.os === 'linux' &&
17731774
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
17741775
fn: async () => {
17751776
const pool = new DynamicThreadPool(
@@ -2119,7 +2120,7 @@ describe('Selection strategies test suite', () => {
21192120
it({
21202121
name:
21212122
'Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool',
2122-
ignore: Deno.build.os === 'linux' &&
2123+
ignore: isCI && Deno.build.os === 'linux' &&
21232124
Number.parseInt(Deno.version.deno.split('.')[0]) >= 2,
21242125
fn: async () => {
21252126
const pool = new DynamicThreadPool(

tests/test-utils.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { TaskFunctions } from './test-types.mjs'
22

3+
export const isCI = Deno.env.get('CI') === 'true'
4+
35
export const waitWorkerNodeEvents = async (
46
pool,
57
workerNodeEvent,

0 commit comments

Comments
 (0)