mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
fix(test): do not force eight int workers on CI
An explicit maxWorkers: 8 raised parallelism on 2–4 vCPU runners and starved shared invite/consent advisory leases (15s timeouts). Cap only on local high-core hosts; leave CI on Vitest's CPU-relative default.
This commit is contained in:
parent
1a3084a6ee
commit
13f9940f53
1 changed files with 12 additions and 5 deletions
|
|
@ -1,9 +1,20 @@
|
|||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
// Cap forks on high-core local machines so Payload pools stay under Docker
|
||||
// Postgres max_connections (default worker count ≈ CPUs; 16× pool-max-10 ≈
|
||||
// 160 clients → "too many clients already"). Do NOT set a literal
|
||||
// `maxWorkers: 8` on CI: Vitest treats that as "use up to 8" even on 2–4
|
||||
// vCPU runners, which starves shared advisory leases (invite/consent) and
|
||||
// times out at 15s. Leave CI on Vitest's CPU-relative default.
|
||||
const maxWorkers = process.env.CI
|
||||
? undefined
|
||||
: Math.min(8, os.availableParallelism())
|
||||
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
@ -15,11 +26,7 @@ export default defineConfig({
|
|||
environment: 'jsdom',
|
||||
setupFiles: ['./vitest.setup.ts'],
|
||||
include: ['tests/int/**/*.int.spec.ts'],
|
||||
// Cap forks so each worker's Payload pg pool stays under Docker Postgres
|
||||
// max_connections=100 on high-core laptops (default worker count ≈ CPUs;
|
||||
// 16× pool-max-10 ≈ 160 clients → "too many clients already", which then
|
||||
// cascades into unrelated QueryError noise). CI runners have fewer CPUs.
|
||||
maxWorkers: 8,
|
||||
...(maxWorkers === undefined ? {} : { maxWorkers }),
|
||||
// Int specs hit a real Postgres under a parallel suite, so wall time is
|
||||
// dominated by pool contention, not by the code under test. The 5s
|
||||
// default made legitimately heavy RSC-composition tests flake as the
|
||||
|
|
|
|||
Loading…
Reference in a new issue