Skip to content

perf(test): remove real-time waits and per-iteration content types in slow ITs (#36912) - #36913

Merged
wezell merged 4 commits into
mainfrom
issue-36912-slow-it-waits
Aug 7, 2026
Merged

perf(test): remove real-time waits and per-iteration content types in slow ITs (#36912)#36913
wezell merged 4 commits into
mainfrom
issue-36912-slow-it-waits

Conversation

@wezell

@wezell wezell commented Aug 6, 2026

Copy link
Copy Markdown
Member

Proposed Changes

Fixes three of the slowest integration-test hotspots identified from per-class CI timing analysis (run 31054926456). ~4.5 min of aggregate IT time recovered, all behavior-preserving:

Test Before Fix
StartEndScheduledExperimentsJobTest.testJob 124s — Thread.sleep(2 * 60 * 1000) Scheduling windows compressed to 10/20 seconds (validateScheduling allows any date after now-1min); sleep 25s
JobQueueManagerAPIIntegrationTest abandoned-job tests ~100s — jobs inserted 5 min stale but tests wait for the detector's minute-granularity timer tick AbandonedJobDetector.detectAbandonedJobs() made public; tests trigger the scan directly, latch 3min → 30s
TagAPITest.findTopTags… 78s — getWikiLikeContentType() inside a 100-iteration loop creates ~100 content types → ~100 ES update_mapping calls Content type hoisted out of the loop (one instead of ~100)

The TagAPITest fix also stops that test permanently bloating the shared index mapping (ES mappings are append-only), which taxes every update_mapping from tests that run after it in MainSuite2b.

Only production change is a method visibility change (privatepublic) on AbandonedJobDetector.detectAbandonedJobs() — no logic touched; the scheduled executor calls the same method.

Investigated and deferred: ShortyIdApiTest.test404CacheWhenDBDown (76s) — not a simple timeout knob (pool is 60 conns / 3s checkout); needs profiling.

Related: #36910 / #36911 (suite reordering).

Checklist

  • Tests (existing tests exercise all changed paths; timing-only changes)
  • Translations
  • Security Implications Contemplated (no security impact)

🤖 Generated with Claude Code

This PR fixes: #36912

This PR fixes: #36912

… slow ITs (#36912)

- StartEndScheduledExperimentsJobTest: compress scheduling windows from
  minutes to seconds; sleep 25s instead of 120s
- JobQueueManagerAPIIntegrationTest: trigger AbandonedJobDetector directly
  instead of waiting up to 1 minute for its scheduled tick; latch timeout
  3min -> 30s. Makes detectAbandonedJobs() public to allow on-demand scans.
- TagAPITest: create one content type instead of ~100 in the findTopTags
  loop (was ~100 ES update_mapping calls polluting the shared index mapping)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @wezell's task in 3m 32s —— View job


Code Review

  • Read the full diff (origin/main...HEAD)
  • Verified AbandonedJobDetector visibility change and test trigger semantics
  • Verified experiments-job Awaitility rewrite for idempotency
  • Verified TagAPITest content-type hoist

New Issues

No issues found.

Notes (non-blocking)

AbandonedJobDetector.detectAbandonedJobs() privatepublic — Correct and minimal. The method is idempotent (the while loop drains all abandoned jobs each call) and is the same method the scheduled executor invokes, so triggering it directly from a test can't diverge from production behavior. The threshold is set to 2 min in @BeforeAll (line 78) and the job is inserted at now-5min (line 493/606), so the direct scan finds it immediately — the latch reduction 3min → 30s is safe. The watchJobABANDONED state is set synchronously inside the scan, so the latch will fire well within 30s.

StartEndScheduledExperimentsJobTest — The Awaitility.untilAsserted rewrite is actually more robust than the old fixed Thread.sleep(2*60*1000): it re-runs the job (as Quartz would) and completes as soon as both absolute dates (now+10s, now+20s) pass, with the 2-min cap reserved for the failure path. Re-running the job is idempotent — the start experiment has no end date so it stays RUNNING across polls; the end experiment stays ENDED. No new flakiness introduced.

TagAPITest — Hoisting getWikiLikeContentType() out of the 100-iteration loop is behavior-preserving: the loop only ever used contentType.id() and all 100 contentlets can share one type. Cuts ~100 ES update_mapping calls to 1 and stops permanently bloating the shared MainSuite2b index mapping. Good catch on the append-only mapping side effect.

The lone production change (visibility only, no logic) is well-documented in the Javadoc. Approving-quality change.
· issue-36912-slow-it-waits

@wezell
wezell marked this pull request as ready for review August 6, 2026 02:26
@wezell
wezell enabled auto-merge August 6, 2026 02:26
@wezell
wezell added this pull request to the merge queue Aug 6, 2026
@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@wezell
wezell removed this pull request from the merge queue due to a manual request Aug 6, 2026
…ments job test (#36912)

Replace the fixed 25s Thread.sleep with an Awaitility loop that re-runs
StartEndScheduledExperimentsJob (idempotent, same as Quartz re-firing) every
2s until both scheduling transitions land. Completes as soon as the dates
pass (~20s) and tolerates slow fixture creation up to a 40s cap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…test (#36912)

The cap is failure-path only — the poll exits as soon as both transitions
land (~20s) — so size it generously for slow CI runners.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wezell
wezell added this pull request to the merge queue Aug 6, 2026
@wezell
wezell removed this pull request from the merge queue due to a manual request Aug 6, 2026
@wezell
wezell enabled auto-merge August 6, 2026 16:37
@wezell
wezell added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 596f593 Aug 7, 2026
72 of 78 checks passed
@wezell
wezell deleted the issue-36912-slow-it-waits branch August 7, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Slow integration tests: remove real-time waits and per-iteration content-type creation

2 participants