Skip to content

Commit 5e477ff

Browse files
committed
Batch v5 tests
1 parent 5a00ef7 commit 5e477ff

3 files changed

Lines changed: 58 additions & 20 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
fail-fast: false
29-
# Integration tests use one worker to reduce 503s and shared-state flakes.
29+
# Unit on all Node versions; v5 integration in batches on all Node versions; v4 full suite on 22.
3030
matrix:
3131
include:
3232
- node-version: 20
@@ -36,11 +36,35 @@ jobs:
3636
- node-version: 24
3737
test: unit
3838
- node-version: 20
39-
test: integration:v5
39+
test: integration:v5:batch1
4040
- node-version: 22
41-
test: integration:v5
41+
test: integration:v5:batch1
4242
- node-version: 24
43-
test: integration:v5
43+
test: integration:v5:batch1
44+
- node-version: 20
45+
test: integration:v5:batch2
46+
- node-version: 22
47+
test: integration:v5:batch2
48+
- node-version: 24
49+
test: integration:v5:batch2
50+
- node-version: 20
51+
test: integration:v5:batch3
52+
- node-version: 22
53+
test: integration:v5:batch3
54+
- node-version: 24
55+
test: integration:v5:batch3
56+
- node-version: 20
57+
test: integration:v5:batch4
58+
- node-version: 22
59+
test: integration:v5:batch4
60+
- node-version: 24
61+
test: integration:v5:batch4
62+
- node-version: 20
63+
test: integration:v5:batch5
64+
- node-version: 22
65+
test: integration:v5:batch5
66+
- node-version: 24
67+
test: integration:v5:batch5
4468
- node-version: 20
4569
test: integration:v4
4670
- node-version: 22
@@ -59,20 +83,20 @@ jobs:
5983
run: npm ci
6084
- name: Run ${{ matrix.test }} Tests and Add Annotations
6185
id: tests
62-
run: npm run test:${{ matrix.test }} -- --ci --coverage --reporters=default --reporters=github-actions --reporters=jest-junit ${{ (matrix.test == 'integration:v4' || matrix.test == 'integration:v5') && '--maxWorkers=1' || '' }}
86+
run: npm run test:${{ matrix.test }} -- --ci --coverage --reporters=default --reporters=github-actions --reporters=jest-junit
6387
env:
64-
ORKES_BACKEND_VERSION: ${{ matrix.test == 'integration:v4' && '4' || (matrix.test == 'integration:v5' && '5' || '') }}
65-
CONDUCTOR_SERVER_URL: ${{ matrix.test == 'integration:v4' && vars.SERVER_URL_V4 || vars.SERVER_URL }}
66-
CONDUCTOR_AUTH_KEY: ${{ matrix.test == 'integration:v4' && secrets.AUTH_KEY_V4 || secrets.AUTH_KEY }}
67-
CONDUCTOR_AUTH_SECRET: ${{ matrix.test == 'integration:v4' && secrets.AUTH_SECRET_V4 || secrets.AUTH_SECRET }}
68-
CONDUCTOR_SDK_INITIAL_TOKEN_STAGGER_MS: ${{ (matrix.test == 'integration:v4' || matrix.test == 'integration:v5') && '2000' || '' }}
69-
JEST_JUNIT_OUTPUT_NAME: ${{ matrix.test }}-test-results.xml
88+
ORKES_BACKEND_VERSION: ${{ matrix.test == 'integration:v4' && '4' || (contains(matrix.test, 'integration:v5') && '5' || '') }}
89+
CONDUCTOR_SERVER_URL: ${{ matrix.test == 'integration:v4' && vars.SERVER_URL_V4 || (contains(matrix.test, 'integration') && vars.SERVER_URL || '') }}
90+
CONDUCTOR_AUTH_KEY: ${{ matrix.test == 'integration:v4' && secrets.AUTH_KEY_V4 || (contains(matrix.test, 'integration') && secrets.AUTH_KEY || '') }}
91+
CONDUCTOR_AUTH_SECRET: ${{ matrix.test == 'integration:v4' && secrets.AUTH_SECRET_V4 || (contains(matrix.test, 'integration') && secrets.AUTH_SECRET || '') }}
92+
CONDUCTOR_SDK_INITIAL_TOKEN_STAGGER_MS: ${{ (matrix.test == 'integration:v4' || contains(matrix.test, 'integration')) && '2000' || '' }}
93+
JEST_JUNIT_OUTPUT_NAME: ${{ matrix.test }}-node-${{ matrix.node-version }}-test-results.xml
7094
- name: Publish ${{ matrix.test }} Test Results
7195
uses: dorny/test-reporter@v2
7296
if: ${{ !cancelled() }}
7397
with:
74-
name: ${{ matrix.test }} Test Report
75-
path: reports/${{ matrix.test }}-test-results.xml
98+
name: ${{ matrix.test }} (Node ${{ matrix.node-version }})
99+
path: reports/${{ matrix.test }}-node-${{ matrix.node-version }}-test-results.xml
76100
reporter: jest-junit
77101
- name: Upload coverage to Codecov
78102
if: always()

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
"test:integration:base": "jest --force-exit --detectOpenHandles --testMatch='**/src/integration-tests/*.test.[jt]s?(x)'",
5252
"test:integration:v5": "cross-env ORKES_BACKEND_VERSION=5 npm run test:integration:base --",
5353
"test:integration:v4": "cross-env ORKES_BACKEND_VERSION=4 npm run test:integration:base --",
54+
"test:integration:v5:batch1": "cross-env ORKES_BACKEND_VERSION=5 npm run test:integration:base -- --testPathPatterns=\"EventClient|ApplicationClient|AuthorizationClient\"",
55+
"test:integration:v5:batch2": "cross-env ORKES_BACKEND_VERSION=5 npm run test:integration:base -- --testPathPatterns=\"WorkflowExecutor|ConductorWorkflow\"",
56+
"test:integration:v5:batch3": "cross-env ORKES_BACKEND_VERSION=5 npm run test:integration:base -- --testPathPatterns=\"TaskManager|TaskRunner|TaskClient|WorkerRegistration|WorkerAdvanced\"",
57+
"test:integration:v5:batch4": "cross-env ORKES_BACKEND_VERSION=5 npm run test:integration:base -- --testPathPatterns=\"MetadataClient|IntegrationClient|SecretClient|SchemaClient|PromptClient\"",
58+
"test:integration:v5:batch5": "cross-env ORKES_BACKEND_VERSION=5 npm run test:integration:base -- --testPathPatterns=\"ServiceRegistryClient|SchedulerClient|readme|WorkflowResourceService|E2EFiveTaskWorkflow\"",
5459
"ci": "npm run lint && npm run test",
5560
"build": "tsup index.ts",
5661
"generate-openapi-layer": "openapi-ts",

src/integration-tests/TaskManager.test.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,22 @@ describe("TaskManager", () => {
105105
},
106106
};
107107

108-
await metadataClient.registerTask(
109-
taskDefinition({
110-
name: taskName,
111-
timeoutSeconds: 0,
112-
retryCount: 0,
113-
})
114-
);
108+
// Let previous test's cleanup settle on the server; retry register in case of transient failure
109+
await new Promise((r) => setTimeout(r, 1500));
110+
const taskDef = taskDefinition({
111+
name: taskName,
112+
timeoutSeconds: 0,
113+
retryCount: 0,
114+
});
115+
for (let attempt = 1; attempt <= 3; attempt++) {
116+
try {
117+
await metadataClient.registerTask(taskDef);
118+
break;
119+
} catch (e) {
120+
if (attempt === 3) throw e;
121+
await new Promise((r) => setTimeout(r, 1000 * attempt));
122+
}
123+
}
115124
tasksToCleanup.push(taskName);
116125

117126
const manager = new TaskManager(client, [worker], {

0 commit comments

Comments
 (0)