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

ZWE Integration Test Framework #3844

Open
wants to merge 28 commits into
base: user/markackert/feat-v3-jcl-rebase
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
baff6f4
test skeleton
MarkAckert May 8, 2024
9512ec4
add gitignores
MarkAckert May 17, 2024
7a1cf2b
Test initialization - vsam
MarkAckert May 17, 2024
5c376df
cleanup lib folder
MarkAckert May 17, 2024
977aaae
improvements to spool collection, dataset management
MarkAckert May 22, 2024
9d7fc5f
checkpoint; apfauth test issues
MarkAckert May 24, 2024
3e542a3
Merge branch 'feature/v3/jcl' into user/markackert/zwe-tests
MarkAckert May 24, 2024
340e977
add defaults.yaml to system setup, adjust class names..
MarkAckert May 24, 2024
3fb88b4
refactors and github action setup
MarkAckert May 31, 2024
e2d242f
Merge branch 'feature/v3/jcl' into user/markackert/zwe-tests
MarkAckert May 31, 2024
55c9f1e
class name fix, matrix update
MarkAckert May 31, 2024
8e016a7
update zoweyamltype with new schema
MarkAckert May 31, 2024
7679de3
Merge branch 'feature/v3/jcl' into user/markackert/zwe-tests
MarkAckert Jun 4, 2024
0e7ec70
Merge branch 'feature/v3/jcl' into user/markackert/zwe-tests
MarkAckert Jun 7, 2024
22d55be
checkpoint
MarkAckert Jun 20, 2024
87e6a05
Merge branch 'feature/v3/jcl' into user/markackert/zwe-tests
MarkAckert Jun 20, 2024
5c37c0b
checkpoint - wip
MarkAckert Jul 2, 2024
862aac5
small refactors, more vsam tests
MarkAckert Jul 3, 2024
e2369e3
Merge branch 'feature/v3/jcl' into user/markackert/zwe-tests
MarkAckert Jul 10, 2024
58c93eb
checkpoint: performance, stc tests, vsam tests, apf tests, runner imp…
MarkAckert Jul 12, 2024
a73fabc
lock in stc tests
MarkAckert Jul 17, 2024
0f7c2cc
lock in apf snapshot
MarkAckert Jul 17, 2024
f6644b0
add defensive cfg re-init on beforeAll
MarkAckert Jul 17, 2024
fa91c95
lock vsam snapshot
MarkAckert Jul 17, 2024
54983c3
checkpoint changes - new/updated tests, updated test runner capabilities
MarkAckert Dec 9, 2024
7ccd278
Merge branch 'user/markackert/feat-v3-jcl-rebase' into user/markacker…
MarkAckert Dec 11, 2024
c3d09b2
fix setup error, update vsam snaps, allow on-disk zowe yamls in tests…
MarkAckert Dec 13, 2024
e1233f1
backend systems with an AUTOCVT option enabled and zopen bash may inc…
MarkAckert Dec 13, 2024
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
6 changes: 6 additions & 0 deletions .github/scripts/cicd_test/make_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

case $install_test_choice in

"ZWE CI Build")
test_file="dummy_not_used"
;;
"ZWE Full Tests")
test_file="dummy_not_used"
;;
"Convenience Pax")
test_file="$CONVENIENCE_PAX_TESTFILE"
;;
Expand Down
208 changes: 208 additions & 0 deletions .github/workflows/zwe-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
name: Zwe Remote Integration Tests

permissions: read-all

on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
test-server:
description: 'Choose Test Server'
type: choice
required: true
default: 'Any zzow servers'
options:
- Any_zzow_servers
- zzow06
- zzow07
- zzow08
zwe-test:
description: 'Choose Zwe Test'
type: choice
required: true
default: CI Build
options:
- ZWE_CI_Build
- ZWE_Full_Tests
RANDOM_DISPATCH_EVENT_ID:
description: 'random dispatch event id'
required: false
type: string

# create a new branch to overwrite following defaults if necessary
env:
# constants
ZWE_TEST_PATH: tests/zwe-remote-integration

jobs:
display-dispatch-event-id:
if: github.event.inputs.RANDOM_DISPATCH_EVENT_ID != ''
runs-on: ubuntu-latest
steps:
- name: RANDOM_DISPATCH_EVENT_ID is ${{ github.event.inputs.RANDOM_DISPATCH_EVENT_ID }}
run: echo "prints random dispatch event id sent from workflow dispatch event"

set-test-vars:
runs-on: ubuntu-latest
outputs:
test-suite:
test-server:
steps:
- name: 'Set vars for manually triggered workflow'
if: github.event_name == 'workflow_dispatch'
run: |
echo "test-suite=${{ github.event.inputs.zwe-test }}" >> $GITHUB_OUTPUT
echo "test-server=${{ github.event.inputs.test-server }}" >> $GITHUB_OUTPUT

- name: 'Set vars for automated PR trigger'
if: github.event_name != 'workflow_dispatch'
run: |
echo "test-suite=ZWE_CI_Build" >> $GITHUB_OUTPUT
echo "test-server=Any_zzow_servers" >> $GITHUB_OUTPUT

check-permission:
runs-on: ubuntu-latest
steps:
# this action will fail the whole workflow if permission check fails
- name: check permission
uses: zowe-actions/shared-actions/permission-check@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

make-matrix:
runs-on: ubuntu-latest
needs: [set-test-vars, check-permission]
steps:
- name: '[Prep 1] Checkout'
uses: actions/checkout@v2

- name: Make matrix
id: set-matrix
run: |
cd .github/scripts/cicd_test
chmod +x make_matrix.sh
source make_matrix.sh
env:
test_server: ${{ steps.set-test-vars.outputs.test-server }}
install_test_choice: ${{ steps.set-test-vars.outputs.test-suite }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

cicd-test:
runs-on: ubuntu-latest
needs: make-matrix
strategy:
matrix: ${{ fromJson(needs.make-matrix.outputs.matrix) }}
fail-fast: false
environment: ${{ matrix.server }}
steps:
- name: '[Prep 1] Checkout'
uses: actions/checkout@v2

- name: '[Prep 2] Setup Node'
uses: actions/setup-node@v3
with:
node-version: '20'

- name: '[Prep 3] Cache node modules'
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: |
~/.npm
~/.nvm/.cache
~/.nvm/versions
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('tests/installation/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-node-modules-

- name: '[Prep 4] Setup jFrog CLI'
uses: jfrog/setup-jfrog-cli@v2
env:
JF_ENV_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }}

- name: '[Prep 5] Validate package.json'
uses: zowe-actions/shared-actions/validate-package-json@main

- name: '[Prep 6] Prepare workflow'
uses: zowe-actions/shared-actions/prepare-workflow@main

- name: '[Setup 1] Test Project Install'
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
npm ci

# Error on this step is likely a schema mismatch. See test README
- name: '[Setup 2] Test Project Build'
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
npm run build

- name: '[Lint 1] Lint 1'
timeout-minutes: 2
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
npm run lint

- name: '[LOCK] Lock marist servers'
uses: zowe-actions/shared-actions/lock-resource@main
with:
lock-repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}
lock-resource-name: zowe-zwe-system-test-${{ steps.more-test-prep.outputs.TEST_SERVER }}-lock
lock-avg-retry-interval: 60

- name: '[Test] Test starts from here'
if: ${{ github.event.inputs.zwe-test == 'ZWE CI Build' }}
timeout-minutes: 180
working-directory: ${{ env.ZWE_TEST_PATH }}
run: npm run test:ci
env:
ANSIBLE_FORCE_COLOR: true
TEST_SERVER: ${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }}
ZOS_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
ZOS_USER: ${{ secrets.SSH_USER }}
ZOS_PASSWORD: ${{ secrets.SSH_PASSWORD }}
ZOSMF_PORT: 10443
ZOS_JAVA_HOME: /ZOWE/node/J8.0_64
ZOS_NODE_HOME: /ZOWE/node/node-v18.16.0
REJECT_UNAUTHORIZED: false
REMOTE_TEST_DIR: /ZOWE/zwe-integration
TEST_VOLUME: ZOS003
JFROG_TOKEN: ${{ secrets.JF_ARTIFACTORY_TOKEN }}

- name: '[Test] Test starts from here'
if: ${{ github.event.inputs.zwe-test == 'ZWE Full Tests' }}
timeout-minutes: 180
working-directory: ${{ env.ZWE_TEST_PATH }}
run: npm run test:extended
env:
ANSIBLE_FORCE_COLOR: true
TEST_SERVER: ${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }}
ZOS_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
ZOS_USER: ${{ secrets.SSH_USER }}
ZOS_PASSWORD: ${{ secrets.SSH_PASSWORD }}
ZOSMF_PORT: 10443
ZOS_JAVA_HOME: /ZOWE/node/J8.0_64
ZOS_NODE_HOME: /ZOWE/node/node-v18.16.0
REJECT_UNAUTHORIZED: false
REMOTE_TEST_DIR: /ZOWE/zwe-integration
TEST_VOLUME: ZOS003
JFROG_TOKEN: ${{ secrets.JF_ARTIFACTORY_TOKEN }}

- name: '[After Test 1] Prepare to upload test report'
if: always()
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
echo CURRENT_TIME=$(date +%s) >> $GITHUB_ENV
echo TEST_NAME=$(echo "${{ matrix.test }}" | sed 's#.*\/##g') >> $GITHUB_ENV

- name: '[After Test 2] Upload test report'
if: always()
uses: actions/upload-artifact@v3
with:
name: ZweTestReports-${{ env.TEST_NAME }}-${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }}-${{ github.run_id }}-${{ env.CURRENT_TIME }}
path: ${{ env.ZWE_TEST_PATH }}/reports/
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ tmp/
# Compiled TS files
bin/libs/*.js
build/zwe/out
bin/**/cli.js
bin/**/index.js
bin/utils/ObjUtils.js
bin/commands/components/handlerutils.js
bin/commands/components/npm.js

# Mac files
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions bin/commands/init/apfauth/.errors
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ZWEL0157E|157|%s (%s) is not defined in Zowe YAML configuration file.
ZWEL0319E|319|zowe.setup.dataset.jcllib does not exist, cannot run. Run 'zwe init', 'zwe init generate', or submit JCL ${prefix}.SZWESAMP(ZWEGENER) before running this command.
ZWEL0320E|320|The dataset specified in '%s' does not exist.
8 changes: 8 additions & 0 deletions bin/commands/init/apfauth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ export function execute() {

let result1 = zosDs.isDatasetSmsManaged(ZOWE_CONFIG.zowe.setup.dataset.authLoadlib);
let result2 = zosDs.isDatasetSmsManaged(ZOWE_CONFIG.zowe.setup.dataset.authPluginLib);

if (result1.rc != 0) {
common.printErrorAndExit(`Error ZWEL0320E: The dataset specified in 'zowe.setup.dataset.authLoadlib' does not exist.`, undefined, 320);
}
if (result2.rc != 0) {
common.printErrorAndExit(`Error ZWEL0320E: The dataset specified in 'zowe.setup.dataset.authPluginLib' does not exist.`, undefined, 320);
}

if (!result1.smsManaged || !result2.smsManaged) {
const COMMAND_LIST = std.getenv('ZWE_CLI_COMMANDS_LIST');
const tmpfile = fs.createTmpFile(`zwe ${COMMAND_LIST}`.replace(new RegExp('\ ', 'g'), '-'));
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/init/generate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function execute(dryRun?: boolean) {
const result = zosJes.waitForJob(jobid);
os.remove(tempFile);

common.printMessage(`Job completed with RC=${result.rc}`);
common.printMessage(`Job ZWEGENER(${jobid}) completed with RC=${result.rc}`);
if (result.rc == 0) {
common.printMessage("Zowe JCL generated successfully");
} else {
Expand Down
2 changes: 2 additions & 0 deletions bin/libs/zos-jes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ export function printAndHandleJcl(jclLocationOrContent: string, jobName: string,
}
if (jobHasFailures) {
common.printLevel2Message(`Job ended with some failures. Please check job log for details.`);
} else {
common.printMessage(`Job ${jobname}(${jobId}) completed with RC=${rc}`)
}
return 0
} else {
Expand Down
2 changes: 1 addition & 1 deletion bin/libs/zos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as zosDataset from './zos-dataset';
import * as initGenerate from '../commands/init/generate/index';

export function tsoCommand(...args:string[]): { rc: number, out: string } {
let message = "tsocmd " + '"' + args.join(' ') + '"';
let message = "tsocmd " + '"' + args.join(' ') + '" < /dev/null';
common.printDebug('- '+message);
//we echo at the end to avoid a configmgr quirk where trying to read stdout when empty can hang waiting for bytes
const result = shell.execOutSync('sh', '-c', `${message} 2>&1 && echo '.'`);
Expand Down
6 changes: 3 additions & 3 deletions build/zwe/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion schemas/server-common.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"minLength": 1,
"maxLength": 32
},
"path": {
"optionalPath": {
"$anchor": "zoweOptionalPath",
"type": "string",
"minLength": 0,
Expand Down
10 changes: 10 additions & 0 deletions tests/sanity/test/ssh-helper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function prepareConnection(): any;
export function cleanUpConnection(): void;
export function executeCommand(command: any, context?: {}): Promise<{
rc: any;
stdout: any;
stderr: any;
}>;
export function executeCommandWithNoError(command: any, context?: {}): Promise<any>;
export function testCommand(command: any, context?: {}, expected?: {}, exact_match?: boolean): Promise<void>;
export function getTmpDir(): Promise<any>;
18 changes: 18 additions & 0 deletions tests/system-integration/resources/custom_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# These below variables can be replaced
host:
user:
password:
ssh_port:
zosmf_port:
remote_test_dir:
zos_java_home:
zos_node_home:
remote_setup: false
remote_teardown: false
test_ds_hlq:
test_volume:
zosmf_reject_unauthorized:
download_configmgr: false
jfrog_user:
jfrog_token:
collect_test_spool: true
Loading
Loading