[7.x] [CI] Combines Jest test jobs (#85850) (#89432)

* [CI] Combines Jest test jobs (#85850)

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

* [CI] Decrease number of Jest workers

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tyler Smalley 2021-01-27 16:16:22 -08:00 committed by GitHub
parent aaed92a0a1
commit e36dfcd49f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 53 additions and 101 deletions

View file

@ -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),

View file

@ -2,7 +2,6 @@
JOB:
- kibana-intake
- x-pack-intake
- kibana-firefoxSmoke
- kibana-ciGroup1
- kibana-ciGroup2

View file

@ -1,10 +1,4 @@
#!/bin/bash
set -euo pipefail
source "$(dirname "${0}")/../util.sh"
export JOB=kibana-default-jest
checks-reporter-with-killswitch "Jest Unit Tests" \
node scripts/jest x-pack --ci --verbose --maxWorkers=5
# This file is temporary and can be removed once #85850 has been
# merged and the changes included in open PR's (~3 days after merging)

View file

@ -1,10 +1,13 @@
#!/bin/bash
# This file is temporary and can be removed once #85850 has been
# merged and the changes included in open PR's (~3 days after merging)
set -euo pipefail
source "$(dirname "${0}")/../util.sh"
export JOB=kibana-oss-jest
checks-reporter-with-killswitch "OSS Jest Unit Tests" \
node scripts/jest --config jest.config.oss.js --ci --verbose --maxWorkers=5
checks-reporter-with-killswitch "Jest Unit Tests" \
node scripts/jest --ci --maxWorkers=5 --verbose

10
.ci/teamcity/tests/jest.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
source "$(dirname "${0}")/../util.sh"
export JOB=kibana-jest
checks-reporter-with-killswitch "Jest Unit Tests" \
node scripts/jest --ci --maxWorkers=5 --verbose

View file

@ -20,20 +20,21 @@ fun BuildType.kibanaAgent(size: Int) {
}
val testArtifactRules = """
target/kibana-*
target/test-metrics/*
target/kibana-security-solution/**/*.png
target/junit/**/*
target/kibana-*
target/kibana-coverage/**/*
target/kibana-security-solution/**/*.png
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
""".trimIndent()
fun BuildType.addTestSettings() {

View file

@ -9,5 +9,5 @@ object AllTests : BuildType({
description = "All Non-Functional Tests"
type = Type.COMPOSITE
dependsOn(QuickTests, Jest, XPackJest, JestIntegration, OssApiServerIntegration)
dependsOn(QuickTests, Jest, JestIntegration, OssApiServerIntegration)
})

View file

@ -12,7 +12,7 @@ object Jest : BuildType({
kibanaAgent(8)
steps {
runbld("Jest Unit", "./.ci/teamcity/oss/jest.sh")
runbld("Jest Unit", "./.ci/teamcity/tests/jest.sh")
}
addTestSettings()

View file

@ -1,19 +0,0 @@
package builds.test
import addTestSettings
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import kibanaAgent
import runbld
object XPackJest : BuildType({
name = "X-Pack Jest Unit"
description = "Executes X-Pack Jest Unit Tests"
kibanaAgent(16)
steps {
runbld("X-Pack Jest Unit", "./.ci/teamcity/default/jest.sh")
}
addTestSettings()
})

View file

@ -77,7 +77,6 @@ fun Kibana(config: KibanaConfiguration = KibanaConfiguration()) : Project {
name = "Jest"
buildType(Jest)
buildType(XPackJest)
buildType(JestIntegration)
}

View file

@ -17,6 +17,7 @@ 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',
[
@ -24,5 +25,7 @@ module.exports = {
{ 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'],
};

View file

@ -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',
],
};

View file

@ -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
* and the Server Side Public License, v 1; you may not use this file except in
* compliance with, at your election, the Elastic License or the Server Side
* Public License, v 1.
*/
module.exports = {
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',
],
reporters: ['default', '<rootDir>/packages/kbn-test/target/jest/junit_reporter'],
};

View file

@ -19,7 +19,7 @@ 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.CI ? [['json', { file: 'jest.json' }]] : ['html', 'text'],
// An array of file extensions your modules use
moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'],

View file

@ -1,6 +0,0 @@
#!/usr/bin/env bash
source test/scripts/jenkins_test_setup.sh
echo " -> Running jest tests"
./test/scripts/test/xpack_jest_unit.sh

View file

@ -3,4 +3,4 @@
source src/dev/ci_setup/setup_env.sh
checks-reporter-with-killswitch "Jest Integration Tests" \
node scripts/jest_integration --ci --verbose
node scripts/jest_integration --ci --verbose --coverage

View file

@ -3,4 +3,4 @@
source src/dev/ci_setup/setup_env.sh
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=6 --coverage

View file

@ -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

View file

@ -167,20 +167,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/kibana-*',
'target/test-metrics/*',
'target/kibana-security-solution/**/*.png',
'target/junit/**/*',
'target/kibana-*',
'target/kibana-coverage/**/*',
'target/kibana-security-solution/**/*.png',
'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([

View file

@ -35,7 +35,6 @@ def test() {
kibanaPipeline.scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh'),
kibanaPipeline.scriptTask('API Integration Tests', 'test/scripts/test/api_integration.sh'),
kibanaPipeline.scriptTask('X-Pack Jest Unit Tests', 'test/scripts/test/xpack_jest_unit.sh'),
])
}

View file

@ -1,14 +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;
* you may not use this file except in compliance with the Elastic License.
*/
module.exports = {
rootDir: '..',
projects: ['<rootDir>/x-pack/plugins/*/jest.config.js'],
reporters: [
'default',
['<rootDir>/packages/kbn-test/target/jest/junit_reporter', { reportName: 'X-Pack Jest Tests' }],
],
};