The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(server): shard the server-test unit job to stop the intermittent crash (#23009)
Félix Malfait6e1e98f4ab9f
diff --git a/.github/workflows/ci-server.yaml b/.github/workflows/ci-server.yamlindex af4add5fd13..b5da2d5c48e 100644--- a/.github/workflows/ci-server.yaml+++ b/.github/workflows/ci-server.yaml@@ -376,6 +376,10 @@ jobs:needs: server-buildtimeout-minutes: 30runs-on: ubuntu-latest+ strategy:+ fail-fast: false+ matrix:+ shard: [1, 2, 3, 4]steps:- name: Fetch custom Github Actions and base branch historyuses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1@@ -389,11 +393,8 @@ jobs:key: ${{ env.SERVER_BUILD_CACHE_KEY }}- name: Build twenty-sharedrun: npx nx build twenty-shared- - name: Server / Run Tests- uses: ./.github/actions/nx-affected- with:- tag: scope:backend- tasks: test+ - name: Server / Run Tests (shard ${{ matrix.shard }}/4)+ run: npx nx run twenty-server:test:ci --shard=${{ matrix.shard }}/4server-integration-test:timeout-minutes: 30diff --git a/packages/twenty-server/project.json b/packages/twenty-server/project.jsonindex 2a3a651d1f4..9cf6148549b 100644--- a/packages/twenty-server/project.json+++ b/packages/twenty-server/project.json@@ -36,6 +36,14 @@}}},+ "test:ci": {+ "executor": "nx:run-commands",+ "dependsOn": ["^build"],+ "options": {+ "cwd": "packages/twenty-server",+ "command": "jest --config ./jest.config.mjs --ci --runInBand"+ }+ },"build:packageJson": {"executor": "@nx/js:tsc","options": {diff --git a/packages/twenty-server/src/engine/core-modules/application/application-registration/__tests__/application-registration-upsert-from-catalog.spec.ts b/packages/twenty-server/src/engine/core-modules/application/application-registration/__tests__/application-registration-upsert-from-catalog.spec.tsindex 1e17f4a44c6..b8278630968 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-registration/__tests__/application-registration-upsert-from-catalog.spec.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-registration/__tests__/application-registration-upsert-from-catalog.spec.ts@@ -10,6 +10,7 @@ import { ApplicationEntity } from 'src/engine/core-modules/application/applicatiimport { CacheLockService } from 'src/engine/core-modules/cache-lock/cache-lock.service';import { CoreEntityCacheService } from 'src/engine/core-entity-cache/services/core-entity-cache.service';import { ServerFileStorageService } from 'src/engine/core-modules/file-storage/services/server-file-storage.service';+import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';describe('ApplicationRegistrationService - upsertFromCatalog', () => {@@ -18,6 +19,7 @@ describe('ApplicationRegistrationService - upsertFromCatalog', () => {findOne: jest.Mock;save: jest.Mock;create: jest.Mock;+ createQueryBuilder: jest.Mock;};const catalogParams = {@@ -45,6 +47,13 @@ describe('ApplicationRegistrationService - upsertFromCatalog', () => {findOne: jest.fn(),save: jest.fn(),create: jest.fn((entity) => entity),+ createQueryBuilder: jest.fn(() => ({+ update: jest.fn().mockReturnThis(),+ set: jest.fn().mockReturnThis(),+ where: jest.fn().mockReturnThis(),+ andWhere: jest.fn().mockReturnThis(),+ execute: jest.fn().mockResolvedValue({ affected: 0 }),+ })),};const module: TestingModule = await Test.createTestingModule({@@ -82,6 +91,10 @@ describe('ApplicationRegistrationService - upsertFromCatalog', () => {provide: CoreEntityCacheService,useValue: { invalidate: jest.fn() },},+ {+ provide: MetricsService,+ useValue: { incrementCounterBy: jest.fn() },+ },],}).compile();