Skip to content

Commit 0333741

Browse files
committed
test(satp-hermes): add jest reporter to satp-hermes
Signed-off-by: Rafael Belchior <[email protected]>
1 parent 83f9482 commit 0333741

File tree

10 files changed

+304
-101
lines changed

10 files changed

+304
-101
lines changed

.github/workflows/satp-hermes-gateway.yaml

Lines changed: 80 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: SATP CI - tests and docker deployments
99
# 4. Tags images appropriately (version-specific and latest)
1010
#
1111
env:
12-
NODEJS_VERSION: v18.18.2
12+
NODEJS_VERSION: v22.18.0
1313
on:
1414
# Run tests on PR
1515
pull_request:
@@ -23,7 +23,6 @@ jobs:
2323
runs-on: ubuntu-22.04
2424
continue-on-error: false
2525
env:
26-
NODEJS_VERSION: v18.19.0
2726
FULL_BUILD_DISABLED: true
2827
TOOLS_VALIDATE_BUNDLE_NAMES_DISABLED: true
2928
CUSTOM_CHECKS_DISABLED: true
@@ -75,12 +74,12 @@ jobs:
7574
echo "No build log found."
7675
fi
7776
77+
# We could cache the artefacts but we found out it is quicker to re-run install and configure
7878
yarn-code-gen:
7979
needs: build-satp-dev
8080
runs-on: ubuntu-22.04
8181
continue-on-error: false
8282
env:
83-
NODEJS_VERSION: v18.19.0
8483
FULL_BUILD_DISABLED: true
8584
TOOLS_VALIDATE_BUNDLE_NAMES_DISABLED: true
8685
CUSTOM_CHECKS_DISABLED: true
@@ -104,8 +103,6 @@ jobs:
104103
restore-keys: |
105104
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
106105
107-
108-
109106
- name: Set working directory
110107
run: cd packages/cactus-plugin-satp-hermes && pwd
111108

@@ -160,14 +157,12 @@ jobs:
160157
runs-on: ubuntu-22.04
161158
continue-on-error: false
162159
env:
163-
NODEJS_VERSION: v18.19.0
164160
FULL_BUILD_DISABLED: true
165161
TOOLS_VALIDATE_BUNDLE_NAMES_DISABLED: true
166162
CUSTOM_CHECKS_DISABLED: true
167163
CONFIGURE_DISABLED: false
168164
CHECK_WORK_TREE_STATUS_DISABLED: true
169165
steps:
170-
# Install Cacti pre-requisites
171166
- name: Use Node.js
172167
uses: actions/[email protected]
173168
with:
@@ -234,7 +229,7 @@ jobs:
234229

235230
- name: Check Lint Side-effects
236231
if: ${{ steps.set-result-git_index_file_count.outputs.result != 0 }}
237-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
232+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
238233
with:
239234
script: |
240235
const failMsg = "yarn lint script produced version control " +
@@ -250,21 +245,17 @@ jobs:
250245
runs-on: ubuntu-22.04
251246
continue-on-error: false
252247
env:
253-
NODEJS_VERSION: v18.19.0
254248
FULL_BUILD_DISABLED: true
255249
TOOLS_VALIDATE_BUNDLE_NAMES_DISABLED: true
256250
CUSTOM_CHECKS_DISABLED: true
257251
CONFIGURE_DISABLED: false
258252
CHECK_WORK_TREE_STATUS_DISABLED: true
259253
steps:
260-
# Install Cacti pre-requisites
261254
- name: Use Node.js
262255
uses: actions/[email protected]
263256
with:
264257
node-version: ${{ env.NODEJS_VERSION }}
265258
- uses: actions/[email protected]
266-
267-
# Install Cacti dependencies
268259
- id: yarn-cache
269260
name: Initialize Yarn Cache
270261
uses: actions/cache@v4
@@ -274,8 +265,6 @@ jobs:
274265
restore-keys: |
275266
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
276267
277-
278-
279268
- name: Set working directory
280269
run: cd packages/cactus-plugin-satp-hermes && pwd
281270

@@ -301,12 +290,8 @@ jobs:
301290
needs: build-satp-dev
302291
runs-on: ubuntu-22.04
303292
env:
304-
NODEJS_VERSION: v18.18.2
305293
FULL_BUILD_DISABLED: true
306-
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
307294
JEST_TEST_RUNNER_DISABLED: false
308-
309-
# SATP specific configuration
310295
SATP_ENABLE_CRASH_RECOVERY: false
311296
SATP_LOG_LEVEL: DEBUG
312297
SATP_ENABLE_LOCAL_REPOSITORY: true
@@ -326,7 +311,6 @@ jobs:
326311
path: ./.yarn/
327312
restore-keys: |
328313
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
329-
330314
331315
- name: Install Foundry
332316
uses: foundry-rs/foundry-toolchain@v1
@@ -339,17 +323,20 @@ jobs:
339323

340324
- name: Run SATP unit tests
341325
run: yarn workspace @hyperledger/cactus-plugin-satp-hermes test:unit
326+
327+
- name: Upload SATP unit test report
328+
uses: actions/upload-artifact@v4
329+
with:
330+
name: satp-unit-junit-report
331+
path: packages/cactus-plugin-satp-hermes/reports/junit/satp-hermes-tests-unit.xml
342332

343333
run-satp-tests-integration-bridge:
344334
needs: build-satp-dev
345335
runs-on: ubuntu-22.04
346336
env:
347-
NODEJS_VERSION: v18.18.2
348337
FULL_BUILD_DISABLED: true
349-
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
350338
JEST_TEST_RUNNER_DISABLED: false
351339

352-
# SATP specific configuration
353340
SATP_ENABLE_CRASH_RECOVERY: false
354341
SATP_LOG_LEVEL: DEBUG
355342
SATP_ENABLE_LOCAL_REPOSITORY: true
@@ -382,13 +369,17 @@ jobs:
382369
- name: Run SATP integration tests
383370
run: yarn workspace @hyperledger/cactus-plugin-satp-hermes test:integration:bridge
384371

372+
- name: Upload SATP integration test report - bridge
373+
uses: actions/upload-artifact@v4
374+
with:
375+
name: satp-integration-junit-report-bridge
376+
path: packages/cactus-plugin-satp-hermes/reports/junit/satp-hermes-tests-integration-bridge.xml
377+
385378
run-satp-tests-integration-oracle:
386379
needs: build-satp-dev
387380
runs-on: ubuntu-22.04
388381
env:
389-
NODEJS_VERSION: v18.18.2
390382
FULL_BUILD_DISABLED: true
391-
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
392383
JEST_TEST_RUNNER_DISABLED: false
393384

394385
# SATP specific configuration
@@ -423,14 +414,18 @@ jobs:
423414

424415
- name: Run SATP integration tests
425416
run: yarn workspace @hyperledger/cactus-plugin-satp-hermes test:integration:oracle
426-
417+
418+
- name: Upload SATP integration test report - oracle
419+
uses: actions/upload-artifact@v4
420+
with:
421+
name: satp-integration-junit-report-oracle
422+
path: packages/cactus-plugin-satp-hermes/reports/junit/satp-hermes-tests-integration-oracle.xml
423+
427424
run-satp-tests-integration-gateway:
428425
needs: build-satp-dev
429426
runs-on: ubuntu-22.04
430427
env:
431-
NODEJS_VERSION: v18.18.2
432428
FULL_BUILD_DISABLED: true
433-
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
434429
JEST_TEST_RUNNER_DISABLED: false
435430

436431
# SATP specific configuration
@@ -466,13 +461,65 @@ jobs:
466461
- name: Run SATP integration tests
467462
run: yarn workspace @hyperledger/cactus-plugin-satp-hermes test:integration:gateway
468463

464+
- name: Upload SATP integration test report - gateway
465+
uses: actions/upload-artifact@v4
466+
with:
467+
name: satp-integration-junit-report-gateway
468+
path: packages/cactus-plugin-satp-hermes/reports/junit/satp-hermes-tests-integration-gateway.xml
469+
470+
run-satp-tests-integration-docker:
471+
needs: [build-bundle, set-docker-tags]
472+
runs-on: ubuntu-22.04
473+
continue-on-error: true # Allow this job to fail due to known issues with Fabric
474+
env:
475+
FULL_BUILD_DISABLED: true
476+
JEST_TEST_RUNNER_DISABLED: false
477+
478+
# SATP specific configuration
479+
SATP_ENABLE_CRASH_RECOVERY: false
480+
SATP_LOG_LEVEL: DEBUG
481+
SATP_ENABLE_LOCAL_REPOSITORY: true
482+
SATP_ENABLE_REMOTE_REPOSITORY: false
483+
484+
steps:
485+
- uses: actions/[email protected]
486+
- name: Use Node.js ${{ env.NODEJS_VERSION }}
487+
uses: actions/[email protected]
488+
with:
489+
node-version: ${{ env.NODEJS_VERSION }}
490+
- id: yarn-cache
491+
name: Initialize Yarn Cache
492+
uses: actions/cache@v4
493+
with:
494+
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
495+
path: ./.yarn/
496+
restore-keys: |
497+
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
498+
- run: ./tools/ci-env-clean-up.sh
499+
- name: Install Foundry
500+
uses: foundry-rs/foundry-toolchain@v1
501+
with:
502+
version: stable
503+
- name: Install dependencies
504+
run: yarn install
505+
- name: Configure
506+
run: yarn configure
507+
508+
- name: Run SATP integration tests
509+
run: yarn workspace @hyperledger/cactus-plugin-satp-hermes test:integration:docker
510+
511+
- name: Upload SATP integration test report - docker
512+
uses: actions/upload-artifact@v4
513+
with:
514+
name: satp-integration-junit-report-docker
515+
path: packages/cactus-plugin-satp-hermes/reports/junit/satp-hermes-tests-integration-docker.xml
516+
517+
469518
run-satp-tests-integration-cbdc:
470519
needs: build-satp-dev
471520
runs-on: ubuntu-22.04
472521
env:
473-
NODEJS_VERSION: v18.18.2
474522
FULL_BUILD_DISABLED: true
475-
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
476523
JEST_TEST_RUNNER_DISABLED: false
477524

478525
# SATP specific configuration
@@ -512,8 +559,6 @@ jobs:
512559
run-all-tests:
513560
needs: [run-satp-tests-unit, run-satp-tests-integration-bridge, run-satp-tests-integration-oracle, run-satp-tests-integration-gateway, run-satp-tests-integration-cbdc]
514561
runs-on: ubuntu-22.04
515-
env:
516-
NODEJS_VERSION: v18.18.2
517562
steps:
518563
- uses: actions/[email protected]
519564
- name: Test Summary
@@ -529,11 +574,7 @@ jobs:
529574
(github.event_name == 'push' &&
530575
(github.ref == 'refs/heads/main' ||
531576
github.ref == 'refs/heads/satp-dev' ||
532-
github.ref == 'refs/heads/satp-stg')) ||
533-
(github.event_name == 'pull_request' &&
534-
(github.base_ref == 'main' ||
535-
github.base_ref == 'satp-dev' ||
536-
github.base_ref == 'satp-stg'))
577+
github.ref == 'refs/heads/satp-stg'))
537578
runs-on: ubuntu-22.04
538579
outputs:
539580
tag_suffix: ${{ steps.set_tags.outputs.tag_suffix }}
@@ -579,14 +620,8 @@ jobs:
579620
(github.event_name == 'push' &&
580621
(github.ref == 'refs/heads/main' ||
581622
github.ref == 'refs/heads/satp-dev' ||
582-
github.ref == 'refs/heads/satp-stg')) ||
583-
(github.event_name == 'pull_request' &&
584-
(github.base_ref == 'main' ||
585-
github.base_ref == 'satp-dev' ||
586-
github.base_ref == 'satp-stg'))
623+
github.ref == 'refs/heads/satp-stg'))
587624
runs-on: ubuntu-22.04
588-
env:
589-
NODEJS_VERSION: v18.18.2
590625
steps:
591626
- uses: actions/[email protected]
592627
- name: Debug Build Info
@@ -668,14 +703,8 @@ jobs:
668703
(github.event_name == 'push' &&
669704
(github.ref == 'refs/heads/main' ||
670705
github.ref == 'refs/heads/satp-dev' ||
671-
github.ref == 'refs/heads/satp-stg')) ||
672-
(github.event_name == 'pull_request' &&
673-
(github.base_ref == 'main' ||
674-
github.base_ref == 'satp-dev' ||
675-
github.base_ref == 'satp-stg'))
706+
github.ref == 'refs/heads/satp-stg'))
676707
runs-on: ubuntu-22.04
677-
env:
678-
NODEJS_VERSION: v18.18.2
679708
steps:
680709
- uses: actions/[email protected]
681710
- name: Debug Build Info
@@ -750,48 +779,4 @@ jobs:
750779
docker pull "${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}"
751780
docker tag "${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}" "${{ needs.set-docker-tags.outputs.ghcr_image }}:latest"
752781
docker push "${{ needs.set-docker-tags.outputs.ghcr_image }}:latest"
753-
754-
run-satp-tests-integration-docker:
755-
needs: [build-bundle, set-docker-tags]
756-
runs-on: ubuntu-22.04
757-
continue-on-error: true # Allow this job to fail due to known issues with Fabric
758-
env:
759-
NODEJS_VERSION: v18.18.2
760-
FULL_BUILD_DISABLED: true
761-
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
762-
JEST_TEST_RUNNER_DISABLED: false
763-
764-
# SATP specific configuration
765-
SATP_ENABLE_CRASH_RECOVERY: false
766-
SATP_LOG_LEVEL: DEBUG
767-
SATP_ENABLE_LOCAL_REPOSITORY: true
768-
SATP_ENABLE_REMOTE_REPOSITORY: false
769-
770-
steps:
771-
- uses: actions/[email protected]
772-
- name: Use Node.js ${{ env.NODEJS_VERSION }}
773-
uses: actions/[email protected]
774-
with:
775-
node-version: ${{ env.NODEJS_VERSION }}
776-
- id: yarn-cache
777-
name: Initialize Yarn Cache
778-
uses: actions/cache@v4
779-
with:
780-
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
781-
path: ./.yarn/
782-
restore-keys: |
783-
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
784-
- run: ./tools/ci-env-clean-up.sh
785-
- name: Install Foundry
786-
uses: foundry-rs/foundry-toolchain@v1
787-
with:
788-
version: stable
789-
- name: Install dependencies
790-
run: yarn install
791-
- name: Configure
792-
run: yarn configure
793-
794-
- name: Run SATP integration tests
795-
run: yarn workspace @hyperledger/cactus-plugin-satp-hermes test:integration:docker
796-
797-
782+

packages/cactus-plugin-satp-hermes/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ src/keys/
55
src/test/typescript/gateway-info
66
cache/
77
src/test/solidity/generated/build-info/
8-
src/main/solidity/generated/build-info/
8+
src/main/solidity/generated/build-info/
9+
src/main/typescript/database/*
10+
reports/junit/satp-hermes-tests-unit.xml
11+
reports/junit/satp-hermes-tests-integration.xml
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
2+
const path = require('path');
3+
module.exports = {
4+
preset: 'ts-jest',
5+
logHeapUsage: true,
6+
testEnvironment: 'node',
7+
maxWorkers: 1,
8+
maxConcurrency: 3,
9+
testTimeout: 60 * 60 * 1000,
10+
setupFilesAfterEnv: [
11+
'jest-extended/all',
12+
path.resolve(__dirname, '../../jest.setup.console.logs.js'),
13+
],
14+
moduleNameMapper: {
15+
'^(\\.\\.?\\/.+)\\.jsx?$': '$1',
16+
'^(.+)/(.+)_pb\\.js$': '$1/$2_pb',
17+
},
18+
testMatch: [
19+
'**/src/test/typescript/integration/bridge/*.test.ts',
20+
],
21+
testPathIgnorePatterns: [],
22+
reporters: [
23+
'default',
24+
[
25+
'jest-junit',
26+
{
27+
outputDirectory: 'reports/junit',
28+
outputName: 'satp-hermes-tests-integration-bridge.xml',
29+
},
30+
],
31+
],
32+
};

0 commit comments

Comments
 (0)