Skip to content

Commit

Permalink
Merge pull request #1830 from zowe/remove-perf-timing-v2
Browse files Browse the repository at this point in the history
Perform the actions required to remove perf-timing on v2
  • Loading branch information
zFernand0 authored Oct 24, 2023
2 parents 50001a2 + 3f59b2f commit 799e5b4
Show file tree
Hide file tree
Showing 27 changed files with 13,943 additions and 5,744 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/zowe-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
NODE: ${{ matrix.node-version }}
NODE_OPTIONS: --max_old_space_size=4096

timeout-minutes: 60
timeout-minutes: 75

concurrency:
group: ${{ matrix.os }}-node-${{ matrix.node-version }}-ci-${{ github.ref }}
Expand Down Expand Up @@ -122,8 +122,6 @@ jobs:
- name: Unit Tests
if: ${{ always() && steps.build.outcome == 'success' }}
run: npm run test:unit
env:
NODE_OPTIONS: --max_old_space_size=8192

- name: Unlock Keyring
id: unlock-keyring
Expand All @@ -141,7 +139,7 @@ jobs:

- name: Integration Tests (Daemon)
if: ${{ always() && steps.build.outcome == 'success' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push') }}
run: npm run test:integration -- --runInBand
run: npm run test:integration:inband

- name: Archive Results
if: ${{ always() && steps.build.outcome == 'success' }}
Expand Down
4 changes: 4 additions & 0 deletions __tests__/__packages__/cli-test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Zowe CLI test utils package will be documented in this file.

## Recent Changes

- Enhancement: Adds the `CLI_TEST_UTILS_USE_PROJECT_ROOT_DIR` environment variable to force the test utility to use the global project dir instead of workspace dirs if set.

## `7.16.1`

- BugFix: Don't assume that folder containing `lerna.json` is root directory unless it also contains a `__tests__` subfolder.
Expand Down
2 changes: 2 additions & 0 deletions __tests__/__packages__/cli-test-utils/src/TestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function projectRootDir() {
};

const testRootDir = getTestRootDir(finalProjectRootDir);

if (process.env.CLI_TEST_UTILS_USE_PROJECT_ROOT_DIR && lernaTestDirExists) { return finalProjectRootDir; }
// lernaTestDirExists == true XOR (finalProjectRootDir == testRootDir)
TEST_USING_WORKSPACE = lernaTestDirExists ? finalProjectRootDir != testRootDir : finalProjectRootDir == testRootDir;
return TEST_USING_WORKSPACE ? testRootDir : finalProjectRootDir;
Expand Down
11 changes: 11 additions & 0 deletions __tests__/__resources__/env/integration-imperative.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# environmental variable settings for integration tests

FORCE_COLOR=1
JEST_JUNIT_OUTPUT_DIR=__tests__/__results__/integration
JEST_JUNIT_OUTPUT_NAME=junit-imperative.xml
JEST_SUITE_NAME="Integration Tests"
JEST_JUNIT_ANCESTOR_SEPARATOR=" > "
JEST_JUNIT_CLASSNAME="Integration.{classname}"
JEST_JUNIT_TITLE="{title}"
JEST_STARE_RESULT_DIR=__tests__/__results__/integration/jest-stare
JEST_STARE_RESULT_HTML=index.html
2 changes: 1 addition & 1 deletion __tests__/__resources__/env/unit.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environmental variable settings for unit tests

FORCE_COLOR=1
NODE_OPTIONS=--max-old-space-size=8192
NODE_OPTIONS=--max-old-space-size=4096
JEST_JUNIT_OUTPUT_DIR=__tests__/__results__/unit
JEST_SUITE_NAME="Unit Tests"
JEST_JUNIT_ANCESTOR_SEPARATOR=" > "
Expand Down
8 changes: 8 additions & 0 deletions __tests__/beforeTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@
*/

jest.setTimeout(60000);

// Set this to be true always in case someone runs npx jest
process.env.CLI_TEST_UTILS_USE_PROJECT_ROOT_DIR = true;

beforeAll(() => {
// If the worker runs out of memory, this needs to be reset
require('events').EventEmitter.defaultMaxListeners = Infinity;
});
14 changes: 0 additions & 14 deletions __tests__/setup.js

This file was deleted.

153 changes: 153 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
const sharedConfig = {
"globalTeardown": "<rootDir>/__tests__/teardown.js",
"watchPathIgnorePatterns": [
".*jest-stare.*\\.js"
],
"modulePathIgnorePatterns": [
"__tests__/__snapshots__/",
".*/node_modules/.*",
".*/lib/.*"
],
"setupFilesAfterEnv": [
"<rootDir>/__tests__/beforeTests.js"
],
"transformIgnorePatterns": [ "^.+\\.js$", "^.+\\.json$" ],
"snapshotFormat": {
"escapeString": true,
"printBasicPrototype": true
},
"workerIdleMemoryLimit": "2GB",
"transform": {
"\\.ts$": ["ts-jest", { "disableSourceMapSupport": true }]
},
"testRegex": "__tests__.*\\.(spec|test)\\.ts$",
"moduleFileExtensions": [
"ts",
"js"
],
"testEnvironment": "node",
"testPathIgnorePatterns": [
"node_modules"
]
}

const projectConfig = {
"projects": [
{
"displayName": "Global Tests",
...sharedConfig,
"roots": ["__tests__", "mocks"],
},
{
"displayName": "Zowe CLI",
...sharedConfig,
"roots": ["packages/cli", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!cli)"]
},
{
"displayName": "Imperative",
...sharedConfig,
"roots": ["packages/imperative", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!imperative)"]
},
{
"displayName": "Core SDK",
...sharedConfig,
"roots": ["packages/core", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!core)"]
},
{
"displayName": "Provisioning SDK",
...sharedConfig,
"roots": ["packages/provisioning", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!provisioning)"]
},
{
"displayName": "Secrets SDK",
...sharedConfig,
"roots": ["packages/secrets", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!secrets)"]
},
{
"displayName": "Workflows SDK",
...sharedConfig,
"roots": ["packages/workflows", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!workflows)"]
},
{
"displayName": "z/OS Console SDK",
...sharedConfig,
"roots": ["packages/zosconsole", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zosconsole)"]
},
{
"displayName": "z/OS Files SDK",
...sharedConfig,
"roots": ["packages/zosfiles", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zosfiles)"]
},
{
"displayName": "z/OS Jobs SDK",
...sharedConfig,
"roots": ["packages/zosjobs", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zosjobs)"]
},
{
"displayName": "z/OS Logs SDK",
...sharedConfig,
"roots": ["packages/zoslogs", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zoslogs)"]
},
{
"displayName": "z/OSMF SDK",
...sharedConfig,
"roots": ["packages/zosmf", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zosmf)"]
},
{
"displayName": "z/OS TSO SDK",
...sharedConfig,
"roots": ["packages/zostso", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zostso)"]
},
{
"displayName": "z/OS USS SDK",
...sharedConfig,
"roots": ["packages/zosuss", "mocks"],
"coveragePathIgnorePatterns": ["packages/(?!zosuss)"]
}
]
}

module.exports = {
...sharedConfig,
...projectConfig,
"reporters": [
"default",
["jest-junit", {
"outputDirectory": "__tests__/__results__",
"reportTestSuiteErrors": true
}],
["jest-stare", {
"resultDir": "__tests__/__results__/jest-stare",
"coverageLink": "../unit/coverage/lcov-report/index.html"
}],
["github-actions", { "silent": false } ]
],
"coverageReporters": [
"json",
"lcov",
"text",
"cobertura"
],
"coverageDirectory": "__tests__/__results__/unit/coverage",
"collectCoverageFrom": [
"packages/**/*.ts",
"!**/packages/imperative/web-help/**/*.ts",
"!**/packages/**/__tests__/**/*.ts",
"__tests__/__packages__/*.ts",
"!**/node_modules/**",
"!**/lib/**"
],
"maxWorkers": "67%", // You may need to specify maxWorkers if you run out of RAM
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 799e5b4

Please sign in to comment.