Skip to content

Commit 17f380a

Browse files
authored
Implement test parallel execution within a single job (#129)
* Added parallel test execution within the same job. * Removed some unnecessary launch configs from launch.json. * run-suite-if-main-module.ts now also works if test file name isn't the 3rd argument.
1 parent c6ae4b2 commit 17f380a

13 files changed

Lines changed: 135 additions & 134 deletions

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
run: npm run test:formatting
6565

6666
test_service:
67-
name: Test (Service Client)
67+
name: Tests (Service Client)
6868
runs-on: ubuntu-latest
6969
environment: QA
7070
needs: build
@@ -87,16 +87,16 @@ jobs:
8787
name: build
8888

8989
- name: Test (Service Client)
90+
run: npm run test:service
9091
env:
9192
ITP_API_URL: ${{ vars.ITP_API_URL }}
9293
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
9394
ITP_SERVICE_CLIENT_ID: ${{ vars.ITP_SERVICE_CLIENT_ID }}
9495
ITP_SERVICE_CLIENT_SECRET: ${{ secrets.ITP_SERVICE_CLIENT_SECRET }}
9596
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
96-
run: npm run test:service
9797

9898
test_native:
99-
name: Test (Native Client)
99+
name: Tests (Native Client)
100100
runs-on: ubuntu-latest
101101
environment: QA
102102
needs: build
@@ -119,11 +119,11 @@ jobs:
119119
name: build
120120

121121
- name: Test (Native Client)
122+
run: npm run test:native
122123
env:
123124
ITP_API_URL: ${{ vars.ITP_API_URL }}
124125
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
125126
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
126127
ITP_NATIVE_TEST_CLIENT_ID: ${{ vars.ITP_NATIVE_TEST_CLIENT_ID }}
127128
ITP_TEST_USER_EMAIL: ${{ vars.ITP_TEST_USER_EMAIL }}
128-
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}
129-
run: npm run test:native
129+
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}

.vscode/launch.json

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -47,57 +47,6 @@
4747
"console": "integratedTerminal",
4848
"internalConsoleOptions": "neverOpen"
4949
},
50-
{
51-
"name": "Debug Formatting Tests",
52-
"skipFiles": [
53-
"<node_internals>/**"
54-
],
55-
"type": "node",
56-
"request": "launch",
57-
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
58-
"args": [
59-
"--forbid-only",
60-
"--timeout",
61-
"999999",
62-
"integration-tests/main-cases/formatting.test.ts"
63-
],
64-
"console": "integratedTerminal",
65-
"internalConsoleOptions": "neverOpen"
66-
},
67-
{
68-
"name": "Debug Service Client Tests",
69-
"skipFiles": [
70-
"<node_internals>/**"
71-
],
72-
"type": "node",
73-
"request": "launch",
74-
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
75-
"args": [
76-
"--forbid-only",
77-
"--timeout",
78-
"999999",
79-
"integration-tests/main-cases/service-client.test.ts"
80-
],
81-
"console": "integratedTerminal",
82-
"internalConsoleOptions": "neverOpen"
83-
},
84-
{
85-
"name": "Debug Native Client Tests",
86-
"skipFiles": [
87-
"<node_internals>/**"
88-
],
89-
"type": "node",
90-
"request": "launch",
91-
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
92-
"args": [
93-
"--forbid-only",
94-
"--timeout",
95-
"999999",
96-
"integration-tests/main-cases/native-client.test.ts"
97-
],
98-
"console": "integratedTerminal",
99-
"internalConsoleOptions": "neverOpen"
100-
},
10150
{
10251
"name": "Debug Active Test",
10352
"skipFiles": [

integration-tests/imodel/imodel.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import connectionTests from './connection.test';
88
import createDeleteTests from "./create-delete.test";
99
import infoTests from "./info.test";
1010
import listTests from "./list.test";
11-
import populateTests from './populate.test';
1211
import updateTests from "./update.test";
1312

1413
const tests = () => describe('iModel Integration Tests', () => {
@@ -17,7 +16,6 @@ const tests = () => describe('iModel Integration Tests', () => {
1716
updateTests();
1817
listTests();
1918
connectionTests();
20-
populateTests();
2119
});
2220

2321
export default tests;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import iModelPopulateTests from '../../imodel/populate.test';
7+
import { nativeLoginToCli } from '../../utils/helpers';
8+
9+
describe('Native Client Tests (imodel populate)', async () => {
10+
before(async () => {
11+
await nativeLoginToCli();
12+
})
13+
14+
iModelPopulateTests();
15+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import accessControlNativeTests from '../../access-control-native/access-control-native.test'
7+
import { nativeLoginToCli } from '../../utils/helpers';
8+
import sharedQuickUseCasesParallel from '../shared-quick-use-cases-parallel';
9+
10+
describe('Native Client Tests', async () => {
11+
before(async () => {
12+
await nativeLoginToCli();
13+
})
14+
15+
accessControlNativeTests();
16+
sharedQuickUseCasesParallel();
17+
18+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import authTests from '../auth/auth.test'
7+
import { nativeLoginToCli } from '../utils/helpers';
8+
9+
describe('Native Client Tests (serial)', async () => {
10+
before(async () => {
11+
await nativeLoginToCli();
12+
})
13+
14+
describe('Authentication Integration Tests', async () => {
15+
after(async () => {
16+
await nativeLoginToCli();
17+
})
18+
19+
authTests();
20+
})
21+
});

integration-tests/main-cases/native-client.test.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import iModelPopulateTests from '../../imodel/populate.test'
7+
import { logoutFromCLI } from '../../utils/helpers';
8+
9+
describe('Service Client Tests (imodel populate)', () => {
10+
before(async () => {
11+
await logoutFromCLI();
12+
})
13+
14+
iModelPopulateTests();
15+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { logoutFromCLI } from '../../utils/helpers'
7+
import sharedQuickUseCasesParallel from '../shared-quick-use-cases-parallel';
8+
9+
describe('Service Client Tests', () => {
10+
before(async () => {
11+
await logoutFromCLI();
12+
})
13+
14+
sharedQuickUseCasesParallel();
15+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import authTests from '../auth/auth.test'
7+
import authTestsService from '../auth-service/auth-service.test'
8+
import { logoutFromCLI } from '../utils/helpers'
9+
10+
describe('Service Client Tests (serial)', () => {
11+
before(async () => {
12+
await logoutFromCLI();
13+
})
14+
describe('Authentication Integration Tests', () => {
15+
authTestsService();
16+
authTests();
17+
});
18+
});

0 commit comments

Comments
 (0)