Skip to content

Commit 0300adf

Browse files
Merge branch 'main' into improve-ftr-retry
2 parents b53270c + b4bdee0 commit 0300adf

File tree

1,751 files changed

+44842
-16950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,751 files changed

+44842
-16950
lines changed

.buildkite/pipeline-utils/ci-stats/pick_test_group_run_order.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export async function pickTestGroupRunOrder() {
338338
: [];
339339

340340
const jestIntegrationConfigs = LIMIT_CONFIG_TYPE.includes('integration')
341-
? globby.sync(getJestConfigGlobs(['**/jest.integration.config.js', '!**/__fixtures__/**']), {
341+
? globby.sync(getJestConfigGlobs(['**/jest.integration.config.*js', '!**/__fixtures__/**']), {
342342
cwd: process.cwd(),
343343
absolute: false,
344344
ignore: DISABLED_JEST_CONFIGS,

.buildkite/scripts/steps/checks/telemetry.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ source .buildkite/scripts/common/util.sh
77
echo --- Check Telemetry Schema
88

99
if is_pr && ! is_auto_commit_disabled; then
10-
node scripts/telemetry_check --baseline "$GITHUB_PR_MERGE_BASE" --fix
10+
node scripts/telemetry_check --baseline "${GITHUB_PR_MERGE_BASE:-}" --fix
1111
check_for_changed_files "node scripts/telemetry_check" true
1212
else
13-
node scripts/telemetry_check --baseline "$GITHUB_PR_MERGE_BASE"
13+
node scripts/telemetry_check --baseline "${GITHUB_PR_MERGE_BASE:-}"
1414
fi

.buildkite/scripts/steps/test/jest_parallel.sh

Lines changed: 36 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,26 @@ results=()
1111
configs=""
1212
failedConfigs=""
1313

14+
# Parallel execution tuning (can be overridden via env)
15+
# JEST_MAX_PARALLEL: number of concurrent Jest config processes
16+
# JEST_MAX_OLD_SPACE_MB: per-process max old space size (MB)
17+
# NOTE: JEST_MAX_PARALLEL default now depends on TEST_TYPE (unit=3, integration=1).
18+
# It can still be overridden by exporting JEST_MAX_PARALLEL.
19+
JEST_MAX_PARALLEL="${JEST_MAX_PARALLEL:-3}"
20+
JEST_MAX_OLD_SPACE_MB="${JEST_MAX_OLD_SPACE_MB:-8192}"
21+
1422
if [[ "$1" == 'jest.config.js' ]]; then
15-
# we used to run jest tests in parallel but started to see a lot of flakiness in libraries like react-dom/test-utils:
16-
# https://github.com/elastic/kibana/issues/141477
17-
# parallelism="-w2"
18-
parallelism="--runInBand"
23+
# unit tests
1924
TEST_TYPE="unit"
25+
JEST_MAX_PARALLEL=3 # unit tests run in parallel by default. When adjusting Buildkite resources, dont forget to update this value.
2026
else
21-
# run integration tests in-band
22-
parallelism="--runInBand"
2327
TEST_TYPE="integration"
28+
JEST_MAX_PARALLEL=1 # integration tests should not run in parallel by default.
2429
fi
2530

2631
export TEST_TYPE
2732

33+
2834
# Added section for tracking and retrying failed configs
2935
FAILED_CONFIGS_KEY="${BUILDKITE_STEP_ID}${TEST_TYPE}${JOB}"
3036

@@ -50,71 +56,43 @@ fi
5056
echo "+++ ⚠️ WARNING ⚠️"
5157
echo "
5258
console.log(), console.warn(), and console.error() output in jest tests causes a massive amount
53-
of noise on CI without any percevable benefit, so they have been disabled. If you want to log
59+
of noise on CI without any perceivable benefit, so they have been disabled. If you want to log
5460
output in your test temporarily, you can modify 'src/platform/packages/shared/kbn-test/src/jest/setup/disable_console_logs.js'
5561
"
5662

57-
while read -r config; do
58-
echo "--- $ node scripts/jest --config $config"
59-
60-
# --trace-warnings to debug
61-
# Node.js process-warning detected:
62-
# Warning: Closing file descriptor 24 on garbage collection
63-
cmd="NODE_OPTIONS=\"--max-old-space-size=12288 --trace-warnings --no-experimental-require-module"
64-
65-
if [ "${KBN_ENABLE_FIPS:-}" == "true" ]; then
66-
cmd=$cmd" --enable-fips --openssl-config=$HOME/nodejs.cnf"
67-
fi
68-
69-
cmd=$cmd"\" NODE_ENV=test node ./scripts/jest --config=\"$config\" $parallelism --coverage=false --passWithNoTests"
63+
# Execute all configs through the combined jest_all runner.
64+
# The new runner will handle iterating through configs and reporting.
7065

71-
echo "actual full command is:"
72-
echo "$cmd"
73-
echo ""
66+
# Flatten configs (newline separated) into comma-separated list for flag usage.
67+
CONFIGS_CSV=$(echo "$configs" | tr '\n' ',' | sed 's/,$//')
7468

75-
start=$(date +%s)
69+
echo "--- Running combined jest_all for configs ($TEST_TYPE)"
70+
echo "$configs"
71+
echo "JEST_MAX_PARALLEL is set to: $JEST_MAX_PARALLEL"
7672

77-
# prevent non-zero exit code from breaking the loop
78-
set +e;
79-
eval "$cmd"
80-
lastCode=$?
81-
set -e;
82-
83-
timeSec=$(($(date +%s)-start))
84-
if [[ $timeSec -gt 60 ]]; then
85-
min=$((timeSec/60))
86-
sec=$((timeSec-(min*60)))
87-
duration="${min}m ${sec}s"
88-
else
89-
duration="${timeSec}s"
90-
fi
73+
node_opts="--max-old-space-size=${JEST_MAX_OLD_SPACE_MB} --trace-warnings --no-experimental-require-module"
74+
if [ "${KBN_ENABLE_FIPS:-}" == "true" ]; then
75+
node_opts="$node_opts --enable-fips --openssl-config=$HOME/nodejs.cnf"
76+
fi
9177

92-
results+=("- $config
93-
duration: ${duration}
94-
result: ${lastCode}")
78+
full_command="NODE_OPTIONS=\"$node_opts\" node ./scripts/jest_all --configs=\"$CONFIGS_CSV\" --coverage=false --passWithNoTests --maxParallel=\"$JEST_MAX_PARALLEL\""
9579

96-
if [ $lastCode -ne 0 ]; then
97-
exitCode=10
98-
echo "Jest exited with code $lastCode"
99-
echo "^^^ +++"
80+
echo "Actual full command is:"
81+
echo "$full_command"
82+
echo ""
10083

101-
if [[ "$failedConfigs" ]]; then
102-
failedConfigs="${failedConfigs}"$'\n'"$config"
103-
else
104-
failedConfigs="$config"
105-
fi
106-
fi
107-
done <<< "$configs"
84+
set +e
85+
eval "$full_command"
86+
code=$?
87+
set -e
10888

109-
if [[ "$failedConfigs" ]]; then
110-
buildkite-agent meta-data set "$FAILED_CONFIGS_KEY" "$failedConfigs"
89+
if [ $code -ne 0 ]; then
90+
exitCode=10
11191
fi
11292

113-
echo "--- Jest configs complete"
114-
printf "%s\n" "${results[@]}"
115-
echo ""
93+
echo "--- Jest configs complete (combined)"
11694

11795
# Scout reporter
11896
source .buildkite/scripts/steps/test/scout_upload_report_events.sh
11997

120-
exit $exitCode
98+
exit $exitCode

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,6 +2286,7 @@ x-pack/platform/test/functional/page_objects/search_profiler_page.ts @elastic/se
22862286
/x-pack/solutions/chat/test/serverless/functional/configs/config.ts @elastic/search-kibana @elastic/appex-qa
22872287
/x-pack/platform/test/onechat_api_integration @elastic/search-kibana @elastic/workchat-eng
22882288
/x-pack/platform/test/onechat_functional @elastic/search-kibana @elastic/workchat-eng
2289+
/x-pack/platform/test/functional/page_objects/onechat_page.ts @elastic/workchat-eng
22892290

22902291
# Management Experience - Deployment Management
22912292
/src/platform/test/functional/fixtures/kbn_archiver/management.json @elastic/kibana-management @elastic/kibana-data-discovery # Assigned per 2 uses: test/functional/apps/management/_import_objects.ts && test/functional/apps/management/data_views/_scripted_fields_filter.ts

.github/workflows/alert-failed-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
ref: main
1818
path: ./kibana-operations
1919
token: ${{secrets.KIBANAMACHINE_TOKEN}}
20+
persist-credentials: false
2021

2122
- name: Label failed test issue
2223
working-directory: ./kibana-operations/triage

.github/workflows/codeql-stats.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
ref: main
1818
path: ./kibana-operations
1919
token: ${{secrets.KIBANAMACHINE_TOKEN}}
20+
persist-credentials: false
2021

2122
- name: CodeQL alert statistics
2223
working-directory: ./kibana-operations/triage

.github/workflows/codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2626
with:
2727
ref: ${{ matrix.branch }}
28+
persist-credentials: false
2829

2930
- name: Initialize CodeQL
3031
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
@@ -76,6 +77,7 @@ jobs:
7677
ref: main
7778
path: ./kibana-operations
7879
token: ${{secrets.KIBANAMACHINE_TOKEN}}
80+
persist-credentials: false
7981

8082
- name: CodeQL alert
8183
working-directory: ./kibana-operations/triage

.github/workflows/evaluate-dependency-health.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
ref: main
2828
path: ./kibana-operations
2929
token: ${{secrets.KIBANAMACHINE_TOKEN}}
30+
persist-credentials: false
3031

3132
- name: Run dependency health score script
3233
working-directory: ./kibana-operations/triage

.github/workflows/label-failed-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
ref: main
1919
path: ./kibana-operations
2020
token: ${{secrets.KIBANAMACHINE_TOKEN}}
21+
persist-credentials: false
2122

2223
- name: Label failed test issue
2324
working-directory: ./kibana-operations/triage

.github/workflows/launchdarkly-code-references.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1515
with:
1616
fetch-depth: 11 # This value must be set if the lookback configuration option is not disabled for find-code-references. Read more: https://github.com/launchdarkly/ld-find-code-refs#searching-for-unused-flags-extinctions
17+
persist-credentials: false
1718
- name: LaunchDarkly Code References
1819
uses: launchdarkly/find-code-references@89a7d362d1d4b3725fe0fe0ccd0dc69e3bdcba58 # v2.14.0
1920
with:

0 commit comments

Comments
 (0)