mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[CI] Combines Jest unit tests (#89948)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
f3399620cf
commit
08c08e88d9
15 changed files with 35 additions and 104 deletions
|
@ -29,7 +29,6 @@ kibanaPipeline(timeoutMinutes: 150) {
|
||||||
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
|
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
|
||||||
parallel([
|
parallel([
|
||||||
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
|
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
|
||||||
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
|
|
||||||
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
|
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
|
||||||
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
|
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
|
||||||
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
|
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
JOB:
|
JOB:
|
||||||
- kibana-intake
|
- kibana-intake
|
||||||
- x-pack-intake
|
|
||||||
- kibana-firefoxSmoke
|
- kibana-firefoxSmoke
|
||||||
- kibana-ciGroup1
|
- kibana-ciGroup1
|
||||||
- kibana-ciGroup2
|
- kibana-ciGroup2
|
||||||
|
|
|
@ -17,6 +17,7 @@ module.exports = {
|
||||||
testPathIgnorePatterns: preset.testPathIgnorePatterns.filter(
|
testPathIgnorePatterns: preset.testPathIgnorePatterns.filter(
|
||||||
(pattern) => !pattern.includes('integration_tests')
|
(pattern) => !pattern.includes('integration_tests')
|
||||||
),
|
),
|
||||||
|
setupFilesAfterEnv: ['<rootDir>/packages/kbn-test/target/jest/setup/after_env.integration.js'],
|
||||||
reporters: [
|
reporters: [
|
||||||
'default',
|
'default',
|
||||||
[
|
[
|
||||||
|
@ -24,5 +25,7 @@ module.exports = {
|
||||||
{ reportName: 'Jest Integration Tests' },
|
{ reportName: 'Jest Integration Tests' },
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
setupFilesAfterEnv: ['<rootDir>/packages/kbn-test/target/jest/setup/after_env.integration.js'],
|
coverageReporters: !!process.env.CI
|
||||||
|
? [['json', { file: 'jest-integration.json' }]]
|
||||||
|
: ['html', 'text'],
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
preset: '@kbn/test',
|
||||||
rootDir: '.',
|
rootDir: '.',
|
||||||
projects: [...require('./jest.config.oss').projects, ...require('./x-pack/jest.config').projects],
|
projects: [
|
||||||
|
'<rootDir>/packages/*/jest.config.js',
|
||||||
|
'<rootDir>/src/*/jest.config.js',
|
||||||
|
'<rootDir>/src/legacy/*/jest.config.js',
|
||||||
|
'<rootDir>/src/plugins/*/jest.config.js',
|
||||||
|
'<rootDir>/test/*/jest.config.js',
|
||||||
|
'<rootDir>/x-pack/plugins/*/jest.config.js',
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
||||||
* or more contributor license agreements. Licensed under the Elastic License
|
|
||||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
||||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
||||||
* Side Public License, v 1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
preset: '@kbn/test',
|
|
||||||
rootDir: '.',
|
|
||||||
projects: [
|
|
||||||
'<rootDir>/packages/*/jest.config.js',
|
|
||||||
'<rootDir>/src/*/jest.config.js',
|
|
||||||
'<rootDir>/src/legacy/*/jest.config.js',
|
|
||||||
'<rootDir>/src/plugins/*/jest.config.js',
|
|
||||||
'<rootDir>/test/*/jest.config.js',
|
|
||||||
],
|
|
||||||
};
|
|
|
@ -19,7 +19,9 @@ module.exports = {
|
||||||
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],
|
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],
|
||||||
|
|
||||||
// A list of reporter names that Jest uses when writing coverage reports
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
|
coverageReporters: !!process.env.CODE_COVERAGE
|
||||||
|
? [['json', { file: 'jest.json' }]]
|
||||||
|
: ['html', 'text'],
|
||||||
|
|
||||||
// An array of file extensions your modules use
|
// An array of file extensions your modules use
|
||||||
moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'],
|
moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'],
|
||||||
|
|
|
@ -6,7 +6,7 @@ EXTRACT_DIR=/tmp/extracted_coverage
|
||||||
mkdir -p $EXTRACT_DIR
|
mkdir -p $EXTRACT_DIR
|
||||||
|
|
||||||
echo "### Extracting downloaded artifacts"
|
echo "### Extracting downloaded artifacts"
|
||||||
for x in kibana-intake x-pack-intake kibana-oss-tests kibana-xpack-tests; do
|
for x in kibana-intake kibana-oss-tests kibana-xpack-tests; do
|
||||||
tar -xzf $DOWNLOAD_DIR/coverage/${x}/kibana-coverage.tar.gz -C $EXTRACT_DIR || echo "### Error 'tarring': ${x}"
|
tar -xzf $DOWNLOAD_DIR/coverage/${x}/kibana-coverage.tar.gz -C $EXTRACT_DIR || echo "### Error 'tarring': ${x}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,6 @@
|
||||||
|
|
||||||
source test/scripts/jenkins_test_setup.sh
|
source test/scripts/jenkins_test_setup.sh
|
||||||
|
|
||||||
rename_coverage_file() {
|
|
||||||
test -f target/kibana-coverage/jest/coverage-final.json \
|
|
||||||
&& mv target/kibana-coverage/jest/coverage-final.json \
|
|
||||||
target/kibana-coverage/jest/$1-coverage-final.json
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ -z "$CODE_COVERAGE" ]] ; then
|
if [[ -z "$CODE_COVERAGE" ]] ; then
|
||||||
# Lint
|
# Lint
|
||||||
./test/scripts/lint/eslint.sh
|
./test/scripts/lint/eslint.sh
|
||||||
|
@ -34,13 +28,8 @@ if [[ -z "$CODE_COVERAGE" ]] ; then
|
||||||
./test/scripts/checks/test_hardening.sh
|
./test/scripts/checks/test_hardening.sh
|
||||||
else
|
else
|
||||||
echo " -> Running jest tests with coverage"
|
echo " -> Running jest tests with coverage"
|
||||||
node scripts/jest --ci --verbose --coverage --config jest.config.oss.js || true;
|
node scripts/jest --ci --verbose --maxWorkers=6 --coverage || true;
|
||||||
rename_coverage_file "oss"
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo " -> Running jest integration tests with coverage"
|
echo " -> Running jest integration tests with coverage"
|
||||||
node --max-old-space-size=8192 scripts/jest_integration --ci --verbose --coverage || true;
|
node scripts/jest_integration --ci --verbose --coverage || true;
|
||||||
rename_coverage_file "oss-integration"
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
source test/scripts/jenkins_test_setup.sh
|
|
||||||
|
|
||||||
if [[ -z "$CODE_COVERAGE" ]] ; then
|
|
||||||
echo " -> Running jest tests"
|
|
||||||
|
|
||||||
./test/scripts/test/xpack_jest_unit.sh
|
|
||||||
else
|
|
||||||
echo " -> Build runtime for canvas"
|
|
||||||
# build runtime for canvas
|
|
||||||
echo "NODE_ENV=$NODE_ENV"
|
|
||||||
node ./x-pack/plugins/canvas/scripts/shareable_runtime
|
|
||||||
echo " -> Running jest tests with coverage"
|
|
||||||
cd x-pack
|
|
||||||
node --max-old-space-size=6144 scripts/jest --ci --verbose --maxWorkers=5 --coverage --config jest.config.js || true;
|
|
||||||
# rename file in order to be unique one
|
|
||||||
test -f ../target/kibana-coverage/jest/coverage-final.json \
|
|
||||||
&& mv ../target/kibana-coverage/jest/coverage-final.json \
|
|
||||||
../target/kibana-coverage/jest/xpack-coverage-final.json
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
fi
|
|
|
@ -2,5 +2,7 @@
|
||||||
|
|
||||||
source src/dev/ci_setup/setup_env.sh
|
source src/dev/ci_setup/setup_env.sh
|
||||||
|
|
||||||
|
export NODE_OPTIONS="--max-old-space-size=2048"
|
||||||
|
|
||||||
checks-reporter-with-killswitch "Jest Unit Tests" \
|
checks-reporter-with-killswitch "Jest Unit Tests" \
|
||||||
node scripts/jest --config jest.config.oss.js --ci --verbose --maxWorkers=5
|
node scripts/jest --ci --verbose --maxWorkers=8
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
source src/dev/ci_setup/setup_env.sh
|
|
||||||
|
|
||||||
checks-reporter-with-killswitch "X-Pack Jest" \
|
|
||||||
node scripts/jest x-pack --ci --verbose --maxWorkers=5
|
|
|
@ -197,13 +197,6 @@ def ingest(jobName, buildNumber, buildUrl, timestamp, previousSha, teamAssignmen
|
||||||
def runTests() {
|
def runTests() {
|
||||||
parallel([
|
parallel([
|
||||||
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
|
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
|
||||||
'x-pack-intake-agent': {
|
|
||||||
withEnv([
|
|
||||||
'NODE_ENV=test' // Needed for jest tests only
|
|
||||||
]) {
|
|
||||||
workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh')()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'kibana-oss-agent' : workers.functional(
|
'kibana-oss-agent' : workers.functional(
|
||||||
'kibana-oss-tests',
|
'kibana-oss-tests',
|
||||||
{ kibanaPipeline.buildOss() },
|
{ kibanaPipeline.buildOss() },
|
||||||
|
|
|
@ -186,20 +186,21 @@ def uploadCoverageArtifacts(prefix, pattern) {
|
||||||
def withGcsArtifactUpload(workerName, closure) {
|
def withGcsArtifactUpload(workerName, closure) {
|
||||||
def uploadPrefix = "kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/${workerName}"
|
def uploadPrefix = "kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/${workerName}"
|
||||||
def ARTIFACT_PATTERNS = [
|
def ARTIFACT_PATTERNS = [
|
||||||
'target/kibana-*',
|
|
||||||
'target/test-metrics/*',
|
|
||||||
'target/kibana-security-solution/**/*.png',
|
|
||||||
'target/junit/**/*',
|
'target/junit/**/*',
|
||||||
|
'target/kibana-*',
|
||||||
|
'target/kibana-coverage/**/*',
|
||||||
|
'target/kibana-security-solution/**/*.png',
|
||||||
|
'target/test-metrics/*',
|
||||||
'target/test-suites-ci-plan.json',
|
'target/test-suites-ci-plan.json',
|
||||||
'test/**/screenshots/session/*.png',
|
|
||||||
'test/**/screenshots/failure/*.png',
|
|
||||||
'test/**/screenshots/diff/*.png',
|
'test/**/screenshots/diff/*.png',
|
||||||
|
'test/**/screenshots/failure/*.png',
|
||||||
|
'test/**/screenshots/session/*.png',
|
||||||
'test/functional/failure_debug/html/*.html',
|
'test/functional/failure_debug/html/*.html',
|
||||||
'x-pack/test/**/screenshots/session/*.png',
|
|
||||||
'x-pack/test/**/screenshots/failure/*.png',
|
|
||||||
'x-pack/test/**/screenshots/diff/*.png',
|
'x-pack/test/**/screenshots/diff/*.png',
|
||||||
'x-pack/test/functional/failure_debug/html/*.html',
|
'x-pack/test/**/screenshots/failure/*.png',
|
||||||
|
'x-pack/test/**/screenshots/session/*.png',
|
||||||
'x-pack/test/functional/apps/reporting/reports/session/*.pdf',
|
'x-pack/test/functional/apps/reporting/reports/session/*.pdf',
|
||||||
|
'x-pack/test/functional/failure_debug/html/*.html',
|
||||||
]
|
]
|
||||||
|
|
||||||
withEnv([
|
withEnv([
|
||||||
|
@ -462,15 +463,10 @@ def allCiTasks() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jest: {
|
jest: {
|
||||||
workers.ci(name: 'jest', size: 'c2-8', ramDisk: true) {
|
workers.ci(name: 'jest', size: 'n2-standard-16', ramDisk: false) {
|
||||||
scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh')()
|
scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh')()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
xpackJest: {
|
|
||||||
workers.ci(name: 'xpack-jest', size: 'c2-8', ramDisk: true) {
|
|
||||||
scriptTask('X-Pack Jest Unit Tests', 'test/scripts/test/xpack_jest_unit.sh')()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ def label(size) {
|
||||||
return 'docker && tests-xl-highmem'
|
return 'docker && tests-xl-highmem'
|
||||||
case 'xxl':
|
case 'xxl':
|
||||||
return 'docker && tests-xxl && gobld/machineType:custom-64-270336'
|
return 'docker && tests-xxl && gobld/machineType:custom-64-270336'
|
||||||
case 'c2-8':
|
case 'n2-standard-16':
|
||||||
return 'docker && linux && immutable && gobld/machineType:c2-standard-8'
|
return 'docker && linux && immutable && gobld/machineType:n2-standard-16'
|
||||||
}
|
}
|
||||||
|
|
||||||
error "unknown size '${size}'"
|
error "unknown size '${size}'"
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
||||||
* or more contributor license agreements. Licensed under the Elastic License
|
|
||||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
||||||
* 2.0.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
preset: '@kbn/test',
|
|
||||||
rootDir: '..',
|
|
||||||
projects: ['<rootDir>/x-pack/plugins/*/jest.config.js'],
|
|
||||||
};
|
|
Loading…
Add table
Add a link
Reference in a new issue