Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tests): Added an integration test suite #664

Merged
merged 7 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ jobs:
with:
custom-job-label: Standard

e2e-integration-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: Integration
npm-test-script: test-${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-integration-coverage-report }}

e2e-standard-tests:
name: E2E Tests
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
Expand Down Expand Up @@ -226,6 +239,7 @@ jobs:
needs:
- env-vars
- unit-tests
- e2e-integration-tests
- e2e-standard-tests
- e2e-mirror-node-tests
- e2e-node-pem-stop-tests
Expand All @@ -245,6 +259,7 @@ jobs:
enable-codecov-analysis: true
enable-codacy-coverage: true
enable-e2e-coverage-report: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
e2e-integration-test-subdir: ${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
e2e-standard-test-subdir: ${{ needs.env-vars.outputs.e2e-standard-test-subdir }}
e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
e2e-node-pem-stop-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-test-subdir }}
Expand All @@ -257,6 +272,7 @@ jobs:
e2e-node-delete-separate-commands-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
e2e-node-upgrade-test-subdir: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-integration-coverage-report: ${{ needs.env-vars.outputs.e2e-integration-coverage-report }}
e2e-standard-coverage-report: ${{ needs.env-vars.outputs.e2e-standard-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
e2e-node-pem-stop-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-coverage-report }}
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ jobs:
GH_ACCESS_GPG_KEY: ${{ secrets.GH_ACCESS_GPG_KEY }}
GH_ACCESS_PASSPHRASE: ${{ secrets.GH_ACCESS_PASSPHRASE }}

e2e-integration-tests:
name: E2E Tests
if: ${{ !cancelled() && always() }}
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Integration
npm-test-script: test-${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-integration-coverage-report }}

e2e-standard-tests:
name: E2E Tests
if: ${{ !cancelled() && always() }}
Expand Down Expand Up @@ -224,6 +237,7 @@ jobs:
needs:
- env-vars
- unit-tests
- e2e-integration-tests
- e2e-standard-tests
- e2e-mirror-node-tests
- e2e-node-pem-stop-tests
Expand All @@ -241,6 +255,7 @@ jobs:
custom-job-label: Standard
enable-codecov-analysis: true
enable-e2e-coverage-report: true
e2e-integration-test-subdir: ${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
e2e-standard-test-subdir: ${{ needs.env-vars.outputs.e2e-standard-test-subdir }}
e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
e2e-node-pem-stop-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-test-subdir }}
Expand All @@ -253,6 +268,7 @@ jobs:
e2e-node-delete-separate-commands-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
e2e-node-upgrade-test-subdir: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-integration-coverage-report: ${{ needs.env-vars.outputs.e2e-integration-coverage-report }}
e2e-standard-coverage-report: ${{ needs.env-vars.outputs.e2e-standard-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
e2e-node-pem-stop-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-coverage-report }}
Expand All @@ -274,6 +290,7 @@ jobs:
needs:
- env-vars
- unit-tests
- e2e-integration-tests
- e2e-standard-tests
- e2e-mirror-node-tests
- e2e-node-pem-stop-tests
Expand All @@ -291,6 +308,7 @@ jobs:
custom-job-label: Coverage
enable-codacy-coverage: true
enable-e2e-coverage-report: true
e2e-integration-test-subdir: ${{ needs.env-vars.outputs.e2e-integration-test-subdir }}
e2e-standard-test-subdir: ${{ needs.env-vars.outputs.e2e-standard-test-subdir }}
e2e-mirror-node-test-subdir: ${{ needs.env-vars.outputs.e2e-mirror-node-test-subdir }}
e2e-node-pem-stop-test-subdir: ${{ needs.env-vars.outputs.e2e-node-pem-stop-test-subdir }}
Expand All @@ -303,6 +321,7 @@ jobs:
e2e-node-delete-separate-commands-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
e2e-node-upgrade-test-subdir: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-integration-coverage-report: ${{ needs.env-vars.outputs.e2e-integration-coverage-report }}
e2e-standard-coverage-report: ${{ needs.env-vars.outputs.e2e-standard-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
e2e-node-pem-stop-coverage-report: ${{ needs.env-vars.outputs.e2e-node-pem-stop-coverage-report }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ downloadArtifactActionComment: v4.1.8
tests:
# name: capitalized noun form
# testFilePrefix: node-update # for node-update.test.mjs
- name: Integration
mochaPostfix: "--grep '.*\\/e2e\\/integration\\/.*'"

- name: Standard
mochaPostfix: "'test/e2e/**/*.mjs' --ignore 'test/unit/**/*.mjs' --ignore 'test/e2e/commands/mirror_node*.mjs' --ignore 'test/e2e/commands/node*.mjs' --ignore 'test/e2e/commands/separate_node*.mjs' --ignore 'test/e2e/commands/relay*.mjs'"
timeout: 30000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
echo "::endgroup::"

- name: Publish Snyk Reports
uses: actions/upload-artifact@84480863f228bb9747b473957fcc9e309aa96097 # v4.4.2
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ inputs.enable-snyk-scan && !cancelled() && !failure() }}
with:
name: Snyk Reports
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/zxc-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ on:
type: string
required: false
default: "Analyze"
e2e-integration-test-subdir:
description: "E2E Integration Test Subdirectory:"
type: string
required: false
default: "e2e-integration"
e2e-standard-test-subdir:
description: "E2E Standard Test Subdirectory:"
type: string
Expand Down Expand Up @@ -115,6 +120,11 @@ on:
type: string
required: false
default: "e2e-relay"
e2e-integration-coverage-report:
description: "E2E Integration Coverage Report:"
type: string
required: false
default: "E2E Integration Tests Coverage Report"
e2e-standard-coverage-report:
description: "E2E Standard Coverage Report:"
type: string
Expand Down Expand Up @@ -225,6 +235,13 @@ jobs:
name: Unit Test Coverage Report
path: 'coverage/unit'

- name: Download E2E Integration Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-integration-coverage-report }}
path: 'coverage/${{ inputs.e2e-integration-test-subdir }}'

- name: Download E2E Standard Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/zxc-env-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ on:
required: false
default: "Set Environment Variables"
outputs:
e2e-integration-test-subdir:
description: "E2E Integration Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_integration_test_subdir }}
e2e-standard-test-subdir:
description: "E2E Standard Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_standard_test_subdir }}
Expand Down Expand Up @@ -62,6 +65,9 @@ on:
e2e-relay-test-subdir:
description: "E2E Relay Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_relay_test_subdir }}
e2e-integration-coverage-report:
description: "E2E Integration Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_integration_coverage_report }}
e2e-standard-coverage-report:
description: "E2E Standard Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_standard_coverage_report }}
Expand Down Expand Up @@ -108,6 +114,7 @@ jobs:
name: ${{ inputs.custom-job-label || 'Set Environment Variables' }}
runs-on: solo-linux-medium
outputs:
e2e_integration_test_subdir: e2e-integration
e2e_standard_test_subdir: e2e-standard
e2e_mirror_node_test_subdir: e2e-mirror-node
e2e_node_pem_stop_test_subdir: e2e-node-pem-stop
Expand All @@ -120,6 +127,7 @@ jobs:
e2e_node_delete_separate_commands_test_subdir: e2e-node-delete-separate-commands
e2e_node_upgrade_test_subdir: e2e-node-upgrade
e2e_relay_test_subdir: e2e-relay
e2e_integration_coverage_report: "E2E Integration Tests Coverage Report"
e2e_standard_coverage_report: "E2E Standard Tests Coverage Report"
e2e_mirror_node_coverage_report: "E2E Mirror Node Tests Coverage Report"
e2e_node_pem_stop_coverage_report: "E2E Node PEM Stop Tests Coverage Report"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"access": "public"
},
"scripts": {
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Unit Tests\" c8 --reporter=lcov --reporter=text --reporter=html --report-dir='coverage/unit' mocha --verbose --recursive --file 'test/setup.mjs' 'test/unit/**/*.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit.xml --check-leaks --timeout 20000",
"test-e2e-all": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Mocha E2E All Tests\" c8 --reporter=lcov --reporter=text --reporter=html --report-dir='coverage/e2e-all' mocha --verbose --recursive --file 'test/setup.mjs' 'test/e2e/**/*.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit-e2e-all.xml --check-leaks --timeout 20000",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Unit Tests\" c8 --reporter=text --reporter=html --report-dir='coverage/unit' mocha --recursive --file 'test/setup.mjs' 'test/unit/**/*.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit.xml --check-leaks --timeout 20000",
"test-e2e-all": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Mocha E2E All Tests\" nyc --reporter=text --reporter=html --report-dir='coverage/e2e-all' mocha --recursive --file 'test/setup.mjs' 'test/e2e/**/*.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit-e2e-all.xml --check-leaks --timeout 20000",
"test-e2e-integration": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Mocha E2E Integration Tests\" c8 --reporter=clover --reporter=lcov --reporter=text --report-dir='coverage/e2e-integration' mocha --verbose --recursive --file 'test/setup.mjs' --grep '.*\/e2e\/integration\/.*' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit-e2e-integration.xml --check-leaks --timeout 20000",
"test-e2e-standard": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Mocha E2E Standard Tests\" c8 --reporter=clover --reporter=lcov --reporter=text --report-dir='coverage/e2e-standard' mocha --verbose --recursive --file 'test/setup.mjs' 'test/e2e/**/*.mjs' --ignore 'test/unit/**/*.mjs' --ignore 'test/e2e/commands/mirror_node*.mjs' --ignore 'test/e2e/commands/node*.mjs' --ignore 'test/e2e/commands/separate_node*.mjs' --ignore 'test/e2e/commands/relay*.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit-e2e-standard.xml --check-leaks --timeout 30000",
"test-e2e-mirror-node": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Mocha E2E Mirror Node Tests\" c8 --reporter=clover --reporter=lcov --reporter=text --report-dir='coverage/e2e-mirror-node' mocha --verbose --recursive --file 'test/setup.mjs' 'test/e2e/commands/mirror_node.test.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit-e2e-mirror-node.xml --check-leaks --timeout 20000",
"test-e2e-node-pem-stop": "cross-env NODE_OPTIONS=--experimental-vm-modules MOCHA_SUITE_NAME=\"Mocha E2E Node PEM Stop Tests\" c8 --reporter=clover --reporter=lcov --reporter=text --report-dir='coverage/e2e-node-pem-stop' mocha --verbose --recursive --file 'test/setup.mjs' 'test/e2e/commands/node_pem_stop.test.mjs' --exit --reporter mocha-junit-reporter --reporter-options mochaFile=junit-e2e-node-pem-stop.xml --check-leaks --timeout 20000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import { it, describe, after } from 'mocha'
import { expect } from 'chai'

import { flags } from '../../../src/commands/index.mjs'
import { bootstrapNetwork, getDefaultArgv, TEST_CLUSTER } from '../../test_util.js'
import * as version from '../../../version.mjs'
import { MINUTES } from '../../../src/core/constants.mjs'
import { flags } from '../../../../src/commands/index.mjs'
import { bootstrapNetwork, getDefaultArgv, TEST_CLUSTER } from '../../../test_util.js'
import * as version from '../../../../version.mjs'
import { MINUTES } from '../../../../src/core/constants.mjs'

describe('AccountManager', async () => {
const namespace = 'account-mngr-e2e'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import { it, describe } from 'mocha'
import { expect } from 'chai'

import { ChartManager, Helm, constants } from '../../../src/core/index.mjs'
import { testLogger } from '../../test_util.js'
import { ChartManager, Helm, constants } from '../../../../src/core/index.mjs'
import { testLogger } from '../../../test_util.js'

describe('ChartManager', () => {
const helm = new Helm(testLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { expect } from 'chai'

import fs from 'fs'
import path from 'path'
import { KeytoolDependencyManager } from '../../../../src/core/dependency_managers/index.mjs'
import { PackageDownloader, Zippy } from '../../../../src/core/index.mjs'
import { getTestCacheDir, testLogger } from '../../../test_util.js'
import { KeytoolDependencyManager } from '../../../../../src/core/dependency_managers/index.mjs'
import { PackageDownloader, Zippy } from '../../../../../src/core/index.mjs'
import { getTestCacheDir, testLogger } from '../../../../test_util.js'
import os from 'os'
import { MINUTES } from '../../../../src/core/constants.mjs'
import { MINUTES } from '../../../../../src/core/constants.mjs'

describe('KeytoolDependencyManager', () => {
const downloader = new PackageDownloader(testLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import net from 'net'
import os from 'os'
import path from 'path'
import { v4 as uuid4 } from 'uuid'
import { SoloError } from '../../../src/core/errors.mjs'
import { ConfigManager, constants, logging, Templates } from '../../../src/core/index.mjs'
import { K8 } from '../../../src/core/k8.mjs'
import { flags } from '../../../src/commands/index.mjs'
import { SoloError } from '../../../../src/core/errors.mjs'
import { ConfigManager, constants, logging, Templates } from '../../../../src/core/index.mjs'
import { K8 } from '../../../../src/core/k8.mjs'
import { flags } from '../../../../src/commands/index.mjs'
import {
V1Container,
V1ExecAction,
Expand All @@ -41,7 +41,7 @@ import {
V1VolumeResourceRequirements
} from '@kubernetes/client-node'
import crypto from 'crypto'
import { MINUTES } from '../../../src/core/constants.mjs'
import { MINUTES } from '../../../../src/core/constants.mjs'

const defaultTimeout = 2 * MINUTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { it, describe } from 'mocha'
import { expect } from 'chai'

import * as fs from 'fs'
import { logging, PackageDownloader, Templates } from '../../../src/core/index.mjs'
import { MINUTES } from '../../../src/core/constants.mjs'
import { logging, PackageDownloader, Templates } from '../../../../src/core/index.mjs'
import { MINUTES } from '../../../../src/core/constants.mjs'

describe('PackageDownloaderE2E', () => {
const testLogger = logging.NewLogger('debug', true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { it, describe, after, before } from 'mocha'
import { expect } from 'chai'

import { constants } from '../../../src/core/index.mjs'
import { constants } from '../../../../src/core/index.mjs'
import * as fs from 'fs'

import {
Expand All @@ -26,10 +26,10 @@ import {
getTestCacheDir,
TEST_CLUSTER,
testLogger
} from '../../test_util.js'
import { flags } from '../../../src/commands/index.mjs'
import * as version from '../../../version.mjs'
import { MINUTES, SECONDS } from '../../../src/core/constants.mjs'
} from '../../../test_util.js'
import { flags } from '../../../../src/commands/index.mjs'
import * as version from '../../../../version.mjs'
import { MINUTES, SECONDS } from '../../../../src/core/constants.mjs'

const defaultTimeout = 20 * SECONDS

Expand Down
Loading