Skip to content

Commit

Permalink
ci: split node.test.mjs into multiple tests to increase pipeline stab…
Browse files Browse the repository at this point in the history
…ility (#297)

Signed-off-by: Jeromy Cannon <[email protected]>
  • Loading branch information
jeromy-cannon authored May 14, 2024
1 parent 20eac14 commit f9ace1e
Show file tree
Hide file tree
Showing 9 changed files with 486 additions and 375 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,31 @@ jobs:
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}

e2e-node-tests:
e2e-node-pem-stop-add-tests:
name: E2E Tests
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Node
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-coverage-report }}
custom-job-label: Node PEM Stop Add
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-coverage-report }}

e2e-node-pfx-kill-add-tests:
name: E2E Tests
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Node PFX Kill Add
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-coverage-report }}

e2e-relay-tests:
name: E2E Tests
Expand All @@ -124,7 +137,8 @@ jobs:
- unit-tests
- e2e-tests
- e2e-mirror-node-tests
- e2e-node-tests
- e2e-node-pem-stop-add-tests
- e2e-node-pfx-kill-add-tests
- e2e-relay-tests
if: ${{ (github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-e2e-tests == 'true') && !failure() && !cancelled() }}
with:
Expand All @@ -135,11 +149,13 @@ jobs:
enable-e2e-coverage-report: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
e2e-test-subdir: ${{ needs.env-vars.outputs.e2e-test-subdir }}
e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
e2e-node-test-subdir: ${{ needs.env-vars.outputs.e2e-node-test-subdir }}
e2e-node-pem-stop-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
e2e-node-pfx-kill-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-coverage-report: ${{ needs.env-vars.outputs.e2e-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
e2e-node-coverage-report: ${{ needs.env-vars.outputs.e2e-node-coverage-report }}
e2e-node-pem-stop-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-coverage-report }}
e2e-node-pfx-kill-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-coverage-report }}
e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
secrets:
snyk-token: ${{ secrets.SNYK_TOKEN }}
Expand Down
49 changes: 35 additions & 14 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,29 @@ jobs:
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}

e2e-node-tests:
e2e-node-pem-stop-add-tests:
name: E2E Tests
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Node
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-coverage-report }}
custom-job-label: Node PEM Stop Add
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-coverage-report }}

e2e-node-pfx-kill-add-tests:
name: E2E Tests
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Node PFX Kill Add
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-coverage-report }}

e2e-relay-tests:
name: E2E Tests
Expand All @@ -108,7 +120,8 @@ jobs:
- unit-tests
- e2e-tests
- e2e-mirror-node-tests
- e2e-node-tests
- e2e-node-pem-stop-add-tests
- e2e-node-pfx-kill-add-tests
- e2e-relay-tests
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
with:
Expand All @@ -117,11 +130,13 @@ jobs:
enable-e2e-coverage-report: true
e2e-test-subdir: ${{ needs.env-vars.outputs.e2e-test-subdir }}
e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
e2e-node-test-subdir: ${{ needs.env-vars.outputs.e2e-node-test-subdir }}
e2e-node-pem-stop-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
e2e-node-pfx-kill-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-coverage-report: ${{ needs.env-vars.outputs.e2e-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
e2e-node-coverage-report: ${{ needs.env-vars.outputs.e2e-node-coverage-report }}
e2e-node-pem-stop-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-coverage-report }}
e2e-node-pfx-kill-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-coverage-report }}
e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -134,7 +149,8 @@ jobs:
- unit-tests
- e2e-tests
- e2e-mirror-node-tests
- e2e-node-tests
- e2e-node-pem-stop-add-tests
- e2e-node-pfx-kill-add-tests
- e2e-relay-tests
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
with:
Expand All @@ -143,11 +159,13 @@ jobs:
enable-e2e-coverage-report: true
e2e-test-subdir: ${{ needs.env-vars.outputs.e2e-test-subdir }}
e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
e2e-node-test-subdir: ${{ needs.env-vars.outputs.e2e-node-test-subdir }}
e2e-node-pem-stop-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
e2e-node-pfx-kill-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-coverage-report: ${{ needs.env-vars.outputs.e2e-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
e2e-node-coverage-report: ${{ needs.env-vars.outputs.e2e-node-coverage-report }}
e2e-node-pem-stop-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-coverage-report }}
e2e-node-pfx-kill-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-coverage-report }}
e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
secrets:
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
Expand All @@ -160,19 +178,22 @@ jobs:
# - unit-tests
# - e2e-tests
# - e2e-mirror-node-tests
# - e2e-node-tests
# - e2e-node-pem-stop-add-tests
# - e2e-node-pfx-kill-add-tests
# - e2e-relay-tests
# if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot[bot]' }}
# with:
# custom-job-label: Standard
# enable-snyk-scan: true
# e2e-test-subdir: ${{ needs.env-vars.outputs.e2e-test-subdir }}
# e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
# e2e-node-test-subdir: ${{ needs.env-vars.outputs.e2e-node-test-subdir }}
# e2e-node-pem-stop-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-test-subdir }}
# e2e-node-pfx-kill-add-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-test-subdir }}
# e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
# e2e-coverage-report: ${{ needs.env-vars.outputs.e2e-coverage-report }}
# e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
# e2e-node-coverage-report: ${{ needs.env-vars.outputs.e2e-node-coverage-report }}
# e2e-node-pem-stop-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-add-coverage-report }}
# e2e-node-pfx-kill-add-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pfx-kill-add-coverage-report }}
# e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
# secrets:
# snyk-token: ${{ secrets.SNYK_TOKEN }}
35 changes: 26 additions & 9 deletions .github/workflows/zxc-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ on:
type: string
required: false
default: "e2e-mirror-node"
e2e-node-test-subdir:
description: "E2E Node Test Subdirectory:"
e2e-node-pem-stop-add-test-subdir:
description: "E2E Node PEM Stop Add Test Subdirectory:"
type: string
required: false
default: "e2e-node"
default: "e2e-node-pem-stop-add"
e2e-node-pfx-kill-add-test-subdir:
description: "E2E Node PFX Kill Add Test Subdirectory:"
type: string
required: false
default: "e2e-node-pfx-kill-add"
e2e-relay-test-subdir:
description: "E2E Relay Test Subdirectory:"
type: string
Expand All @@ -85,11 +90,16 @@ on:
type: string
required: false
default: "E2E Mirror Node Tests Coverage Report"
e2e-node-coverage-report:
description: "E2E Node Coverage Report:"
e2e-node-pem-stop-add-coverage-report:
description: "E2E Node PEM Stop Add Coverage Report:"
type: string
required: false
default: "E2E Node PEM Stop Add Tests Coverage Report"
e2e-node-pfx-kill-add-coverage-report:
description: "E2E Node PFX Kill Add Coverage Report:"
type: string
required: false
default: "E2E Node Tests Coverage Report"
default: "E2E Node PFX Kill Add Tests Coverage Report"
e2e-relay-coverage-report:
description: "E2E Relay Coverage Report:"
type: string
Expand Down Expand Up @@ -159,12 +169,19 @@ jobs:
name: ${{ inputs.e2e-mirror-node-coverage-report }}
path: 'coverage/${{ inputs.e2e-mirror-node-test-subdir }}'

- name: Download E2E Node Coverage Report
- name: Download E2E Node PEM Stop Add Coverage Report
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-node-pem-stop-add-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-pem-stop-add-test-subdir }}'

- name: Download E2E Node PFX Kill Add Coverage Report
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-node-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-test-subdir }}'
name: ${{ inputs.e2e-node-pfx-kill-add-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-pfx-kill-add-test-subdir }}'

- name: Download E2E Relay Coverage Report
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/zxc-env-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ on:
e2e-mirror-node-test-subdir:
description: "E2E Mirror Node Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_mirror_node_test_subdir }}
e2e-node-test-subdir:
description: "E2E Node Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_test_subdir }}
e2e-node-pem-stop-add-test-subdir:
description: "E2E Node PEM Stop Add Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_pem_stop_add_test_subdir }}
e2e-node-pfx-kill-add-test-subdir:
description: "E2E Node PFX Kill Add Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_pfx_kill_add_test_subdir }}
e2e-relay-test-subdir:
description: "E2E Relay Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_relay_test_subdir }}
Expand All @@ -44,9 +47,12 @@ on:
e2e-mirror-node-coverage-report:
description: "E2E Mirror Node Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_mirror_node_coverage_report }}
e2e-node-coverage-report:
description: "E2E Node Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_coverage_report }}
e2e-node-pem-stop-add-coverage-report:
description: "E2E Node PEM Stop Add Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_pem_stop_add_coverage_report }}
e2e-node-pfx-kill-add-coverage-report:
description: "E2E Node PFX Kill Add Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_pfx_kill_add_coverage_report }}
e2e-relay-coverage-report:
description: "E2E Relay Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_relay_coverage_report }}
Expand All @@ -62,11 +68,13 @@ jobs:
outputs:
e2e_test_subdir: e2e
e2e_mirror_node_test_subdir: e2e-mirror-node
e2e_node_test_subdir: e2e-node
e2e_node_pem_stop_add_test_subdir: e2e-node-pem-stop-add
e2e_node_pfx_kill_add_test_subdir: e2e-node-pfx-kill-add
e2e_relay_test_subdir: e2e-relay
e2e_coverage_report: "E2E Tests Coverage Report"
e2e_mirror_node_coverage_report: "E2E Mirror Node Tests Coverage Report"
e2e_node_coverage_report: "E2E Node Tests Coverage Report"
e2e_node_pem_stop_add_coverage_report: "E2E Node PEM Stop Add Tests Coverage Report"
e2e_node_pfx_kill_add_coverage_report: "E2E Node PFX Kill Add Tests Coverage Report"
e2e_relay_coverage_report: "E2E Relay Tests Coverage Report"
steps:
- run: echo "Exposing environment variables to reusable workflows"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"test-e2e-all": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E All Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e' --testPathIgnorePatterns=\".*/unit/.*\"",
"test-e2e": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e' --testPathIgnorePatterns=\".*/unit/.*\" --testPathIgnorePatterns=\".*/e2e/commands/mirror_node.*\" --testPathIgnorePatterns=\".*/e2e/commands/node.*\" --testPathIgnorePatterns=\".*/e2e/commands/relay.*\"",
"test-e2e-mirror-node": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Mirror Node Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-mirror-node.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-mirror-node' --testRegex=\".*\\/e2e\\/commands\\/mirror_node\\.test\\.mjs\"",
"test-e2e-node": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node' --testRegex=\".*\\/e2e\\/commands\\/node\\.test\\.mjs\"",
"test-e2e-node-pem-stop-add": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node PEM Stop Add Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node-pem-stop-add.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node-pem-stop-add' --testRegex=\".*\\/e2e\\/commands\\/node_pem_stop_add\\.test\\.mjs\"",
"test-e2e-node-pfx-kill-add": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node PFX Kill Add Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node-pfx-kill-add.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node-pfx-kill-add' --testRegex=\".*\\/e2e\\/commands\\/node_pfx_kill_add\\.test\\.mjs\"",
"test-e2e-relay": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Relay Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-relay.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-relay' --testRegex=\".*\\/e2e\\/commands\\/relay\\.test\\.mjs\"",
"merge-clean": "rm -rf .nyc_output && mkdir .nyc_output && rm -rf coverage/lcov-report && rm -rf coverage/solo && rm coverage/*.*",
"merge-e2e": "nyc merge ./coverage/e2e/ .nyc_output/coverage.json",
Expand Down
Loading

0 comments on commit f9ace1e

Please sign in to comment.