Skip to content

Commit

Permalink
[CI] Combines Jest unit tests (elastic#89948)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
# Conflicts:
#	jest.config.oss.js
#	src/dev/code_coverage/shell_scripts/extract_archives.sh
#	test/scripts/jenkins_unit.sh
#	test/scripts/jenkins_xpack.sh
#	vars/kibanaCoverage.groovy
#	x-pack/jest.config.js
  • Loading branch information
Tyler Smalley committed Feb 9, 2021
1 parent 684edff commit 1518945
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 72 deletions.
1 change: 0 additions & 1 deletion .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ kibanaPipeline(timeoutMinutes: 150) {
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
parallel([
'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() }, [
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
Expand Down
1 change: 0 additions & 1 deletion .ci/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

JOB:
- kibana-intake
- x-pack-intake
- kibana-firefoxSmoke
- kibana-ciGroup1
- kibana-ciGroup2
Expand Down
5 changes: 4 additions & 1 deletion jest.config.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ module.exports = {
testPathIgnorePatterns: preset.testPathIgnorePatterns.filter(
(pattern) => !pattern.includes('integration_tests')
),
setupFilesAfterEnv: ['<rootDir>/packages/kbn-test/target/jest/setup/after_env.integration.js'],
reporters: [
'default',
[
'<rootDir>/packages/kbn-test/target/jest/junit_reporter',
{ 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'],
};
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
*/

module.exports = {
preset: '@kbn/test',
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',
],
};
19 changes: 0 additions & 19 deletions jest.config.oss.js

This file was deleted.

4 changes: 3 additions & 1 deletion packages/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ module.exports = {
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],

// 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
moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'],
Expand Down
6 changes: 1 addition & 5 deletions test/scripts/jenkins_unit.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env bash

source test/scripts/jenkins_test_setup.sh

# Lint
./test/scripts/lint/eslint.sh
./test/scripts/lint/stylelint.sh
Expand All @@ -24,4 +20,4 @@ source test/scripts/jenkins_test_setup.sh
./test/scripts/checks/plugins_with_circular_deps.sh
./test/scripts/checks/verify_notice.sh
./test/scripts/checks/test_projects.sh
./test/scripts/checks/test_hardening.sh
./test/scripts/checks/test_hardening.sh
6 changes: 0 additions & 6 deletions test/scripts/jenkins_xpack.sh

This file was deleted.

4 changes: 3 additions & 1 deletion test/scripts/test/jest_unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

source src/dev/ci_setup/setup_env.sh

export NODE_OPTIONS="--max-old-space-size=2048"

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
6 changes: 0 additions & 6 deletions test/scripts/test/xpack_jest_unit.sh

This file was deleted.

22 changes: 9 additions & 13 deletions vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,21 @@ def uploadGcsArtifact(uploadPrefix, pattern) {
def withGcsArtifactUpload(workerName, closure) {
def uploadPrefix = "kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/${workerName}"
def ARTIFACT_PATTERNS = [
'target/junit/**/*',
'target/kibana-*',
'target/test-metrics/*',
'target/kibana-coverage/**/*',
'target/kibana-security-solution/**/*.png',
'target/junit/**/*',
'target/test-metrics/*',
'target/test-suites-ci-plan.json',
'test/**/screenshots/session/*.png',
'test/**/screenshots/failure/*.png',
'test/**/screenshots/diff/*.png',
'test/**/screenshots/failure/*.png',
'test/**/screenshots/session/*.png',
'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/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/failure_debug/html/*.html',
]

withEnv([
Expand Down Expand Up @@ -445,15 +446,10 @@ def allCiTasks() {
}
},
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')()
}
},
xpackJest: {
workers.ci(name: 'xpack-jest', size: 'c2-8', ramDisk: true) {
scriptTask('X-Pack Jest Unit Tests', 'test/scripts/test/xpack_jest_unit.sh')()
}
},
])
}

Expand Down
4 changes: 2 additions & 2 deletions vars/workers.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def label(size) {
return 'docker && tests-xl-highmem'
case 'xxl':
return 'docker && tests-xxl && gobld/machineType:custom-64-270336'
case 'c2-8':
return 'docker && linux && immutable && gobld/machineType:c2-standard-8'
case 'n2-standard-16':
return 'docker && linux && immutable && gobld/machineType:n2-standard-16'
}

error "unknown size '${size}'"
Expand Down
15 changes: 0 additions & 15 deletions x-pack/jest.config.js

This file was deleted.

0 comments on commit 1518945

Please sign in to comment.