Repository navigation
Fixes #34815: Run Java integration tests only in the merge queue, with an impact-mapped local run before review - #34818
Conversation
`make java_affected` maps the branch diff to the unit tests and integration tests it can break, through .github/java-tests/impact-map.json. 45 buckets by architecture area, plus an entity-name convention and references from the test side; every one of the 408 IT classes sits in at least one bucket. Each selected IT runs in the failsafe lane and engine profile CI uses for it, read from the IT pom, and classes whose tests only execute on one backend (OpenSearch-only, Redis-only) run on that backend. `make java_affected_run ARGS="--update-pr"` runs the steps and upserts a results block into the PR body. A step passes only if tests executed, none failed, and every selected class produced a report: a lane run without an engine profile prints BUILD SUCCESS after running nothing. Every command builds with -am instead of resolving openmetadata-service from ~/.m2, which another checkout can overwrite mid-run. Unit steps run `package` because the relocated es.*/os.* search clients only exist once openmetadata-shaded-deps is packaged. A harness check warns when an IT is added that no bucket reaches. Part of #34815. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New java-affected-tests skill: when to run `make java_affected`, how to read the plan (gaps, untested classes, tests not run locally), how to add tests the map cannot know about, and the Maven traps the commands avoid. pr-checklist refuses to open a PR that touches Java, schemas, migrations or a pom without a PASSED (or NOT NEEDED) local-java-test-results block for the current commit, and the PR template carries the block under "Backend integration tests". The IT commands in java.md, test-enforcement and verification ran the class twice or tested a stale jar; they now point at the planner. Part of #34815. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The results block reported per-step totals; the classes only appeared inside the Maven commands. It now has a "Tests run locally" list naming every class each step ran with its passed/failed/skipped counts. A full unit suite is listed in a collapsed block so the PR body stays under GitHub's limit. pr-checklist asks for the same record for everything else run before review (pytest, Jest, Playwright, manual checks) and for the counterpart Collate PR to be linked from both descriptions, since CI on the PR no longer runs the integration tests or Playwright. Part of #34815. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
…ava-test-ci-gating Conflict in skills/pr-checklist/SKILL.md with #34740: kept this branch's Java section, which replaces the old `mvn test -pl openmetadata-integration-tests -Dtest=<NewIT>` block, and took #34740's Ingestion (Python) section as is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A changed IT harness class selects the ITs that reach it through other harness classes and neverRun base classes (AuthBackend -> TokenRefresher -> SdkClients -> every IT). One that no IT reaches is an impact-map gap and runs the smoke set; before, it produced a NOT NEEDED block. That block now names impacted tests that only run nightly. - A module run in full is listed as counts, and class lists past 20,000 characters are cut to counts. openmetadata-service's class list alone is ~55,000 characters, so a full-suite run pushed the PR body past GitHub's 65,536 limit and --update-pr failed. --update-pr now refuses a body over the limit with a message instead of a gh error. - Untracked files the plan reads (outside `ignore`) mark the block "uncommitted changes were present". - The java-impact-map harness check reports the planner's SystemExit on a pom/map mismatch as a warning instead of aborting harness-integrity. Part of #34815.
Review feedback: a TableRepository change selected 11 ITs and missed TestCaseDeleteResilienceIT, and the map listed 178 tests by name. The impact map now holds ownership rules only. 40 areas own code by directory and tests by name or path pattern; the audit rejects an area that names a single test and warns on any IT or production file no area owns. The rest is read from the code: - ITs that name the changed class, or a changed method together with its class, directly or through IT helpers and the SDK. A helper most ITs use (SdkClients, the IT bootstrap) is followed only through its methods that use the change; a file that imports another class of the same simple name is not a reference. - The entity ITs of the production code that calls the change, narrowed to the callers of the changed methods when the diff names them. - The engine a test needs, from its assume calls, and the classes no lane runs: abstract, class-level @disabled, suite-profile excludes, gated on a property no lane sets. It fails toward running more. The smoke set runs for any code change. An unowned file, a pom, the IT bootstrap, the core area, or a selection over 60% of the merge-queue ITs runs the full suite, which can run in CI and be recorded with --ci-run; that accepts only a passed IT workflow run on HEAD whose lane jobs ran. The author or agent adds tests with --add-it/--add-unit/--add-area and a required --reason; nothing removes them. Against the old map, for every file in the repo, the new plan selects every IT the old one did, except tests no CI lane runs, SDK unit-test files, and simple-name collisions. On the 88 commits that touched Java among the last 300 on main: median 78 merge-queue ITs per commit (old map: 30); 43% run the full suite, 30 of them through core. Part of #34815.
Review: --ci-run let any passed run stand in for every lane step on its engine, but the PostgreSQL + Elasticsearch + Redis workflow has no rdf lane, so an rdf step on cache-tests would show as covered by a run that never ran it. Each ciWorkflows entry now names the CI jobs behind each planner lane (laneJobs: isolated is the global-state, multi-node and retry-queue jobs). A run covers a lane only if every one of those jobs ran and passed in it, so a lane the workflow lacks, or one its change detection skipped, still runs locally. A run that covers no lane is rejected. Part of #34815.
Code Review ✅ Approved 5 closed / 5 findings🟡 Medium risk · The new Java impact planner and PR checklist gate could omit a needed integration test, letting a regression reach the merge queue. Restructures Java CI to run integration tests in the merge queue with impact-mapped local runs before PR review. Adds ✅ 5 closed✅ Bug: Unreferenced IT-harness helpers produce a NOT NEEDED block
✅ Bug: SystemExit from planner aborts the harness instead of warning
✅ Edge Case: Results block omits the dirty note when untracked files were tested
✅ Bug: Collapsing a full suite in <details> doesn't shrink the PR body
✅ Edge Case: --ci-run assumes every workflow runs every lane; Redis has no rdf lane
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
…n-metadata#34892) - Integration Tests - MySQL + Elasticsearch / PostgreSQL + OpenSearch: a PR now triggers them only so their required checks report. Every job is skipped on a PR, and a skipped required check passes. The merge queue, main pushes and manual dispatch run them as before. The `safe to test` label gate and the PR-head checkout under pull_request_target are gone. - PostgreSQL + Elasticsearch + Redis: no PR trigger; it is not required. - JavaUIIT (java-playwright-nightly.yml): dispatch only. No PR or merge-queue trigger and no java-ui-it gate, which no ruleset requires any more; openmetadata-nightly runs these suites on a schedule. - Maven Collate Tests: also runs in the merge queue when backend paths change, and builds the Collate branch matching the PR or queue base. The event it passes decides what Collate runs. - Harness integrity: also runs when ITs, the IT pom, the impact map or the planner change, so check 8 (java-impact-map) sees a new IT. Before review, `make java_affected_run` runs the ITs a PR impacts (open-metadata#34818).
Describe your changes:
Fixes #34815
PR CI is moving the Java integration tests (ITs) to the merge queue and JavaUIIT/search-it to openmetadata-nightly, the same way #34746 and #34740 moved Playwright and the Python ITs. That makes the merge queue the first CI run of an IT, and an ejection there costs every PR queued behind it. This PR adds what has to replace the PR run: a local, impact-mapped run of the Java tests a branch can break, wired into the PR checklist as a gate.
make java_affectedmaps the branch diff to the unit tests and ITs it impacts, through.github/java-tests/impact-map.json, and prints the exact Maven command for each failsafe lane and engine.make java_affected_run ARGS="--update-pr"runs those commands and upserts alocal-java-test-resultsblock into the PR body (new markers under "Backend integration tests").java-affected-testsskill.pr-checklistrefuses a PR touching Java, schemas, migrations or a pom without a PASSED (or NOT NEEDED) block for the current commit.java-impact-mapharness check: warns on an IT or production file no area owns, or an area that names a single test.The workflow change follows in a separate PR (prepared and linted). Until it lands, PRs still run the ITs as today:
integration-tests-mysql-elasticsearchand-postgres-opensearch(required checks) skip every job on PRs; GitHub counts a skipped required check as passing. They run in the merge queue, on main pushes and on dispatch. Thepull_request_target/safe to testpath goes, as in ci(playwright): run Postgres E2E suite only in the merge queue #34746.integration-tests-postgres-elasticsearch-redis(not required) drops its PR trigger.java-playwright-nightly.ymlstops running on PRs and in the merge queue. Its embedded jobs move to openmetadata-nightly'sk8s-java-it.yml(open-metadata/openmetadata-nightly#340), which already runs the cluster suites.maven-collate-cialso runs in the merge queue and passes the event along: an OpenMetadata PR gets the Collate build and unit tests, the queue gets the Collate ITs.harness-integrity.ymlalso triggers on IT and impact-map changes.Type of change:
High-level design:
Where each Java suite runs once the workflow PR lands:
tests/search/*IT)maven-collate-ciSelection (
.github/scripts/plan_local_java_tests.py, stdlib only). The map holds ownership rules only; the rest is read from the code. Every signal only adds tests:impact-map.jsonhas 40 areas that own code by directory and tests by name or path pattern (service/search/**→*Search*IT,tests/search/**). No area names a single test; the audit rejects one.XRepository/XResource/XMapper/XIndex,x.json,createX.jsonandx_index_mapping.jsonselect ITs namedX…at a CamelCase boundary.SdkClients, the IT bootstrap) is followed only through its methods that use the change. A file importing another class of the same simple name doesn't count.TestCaseRepositorycallsTableRepository→ theTestCase…ITs), narrowed to callers of the changed methods when the diff names them.It fails toward running more. The full suite (every merge-queue lane IT, default engine) runs for a file no area owns, poms and the IT bootstrap, the
corearea (entity framework and server wiring), a helper most ITs use when the diff names no changed method, and any selection above 60% of the merge-queue ITs. A full-suite plan can run in CI on the branch and be recorded with--ci-run, which accepts only a passed integration-test run onHEADwhose lane jobs ran (a run whose change detection skipped them still says "success").What never runs is read from the code and the pom (abstract classes, class-level
@Disabled, suite-profile<excludes>, classes enabled by a property no lane sets), and the engine a class needs from itsassume…calls.The author's part. The plan is a floor. The skill gives ground rules for adding tests (cascades on delete/rename, fields search documents or alerts read, shared permission checks, methods an IT drives under another name); additions go through
--add-it/--add-unit/--add-areawith a required--reason, listed in the PR block. Nothing removes a test.Maintenance. New code in an owned directory and new ITs that match an area's pattern need no edit. The audit (
--check-map, harness check, pytest) reports an IT or production file no area owns; until someone assigns it, a change there runs the full suite, so a gap costs time, not a missed test.Running them the way CI does. Lane membership is read from the IT pom (
integrationTests.globalStateTests,multiNodeTests,retryQueueTests,rdfTests), so selected classes run in the isolated, rdf or parallel execution, or under-Psearch-it. Engines come from the areas andengineRules: Postgres SQL runs on PostgreSQL+OpenSearch, DAOs run on both databases, cache code also runs under-Pcache-tests.testEnginesroutes classes whose tests assume one backend, matched by theirassume…calls:PatchTableEmbeddingIT(OpenSearch), the Redis cache ITs. Elsewhere they skip, and a skipped run looks green.Traps the commands avoid. Each was hit in this repo before:
-P<engine>runs zero tests and prints BUILD SUCCESS. A step only passes if tests executed and every selected class produced a report; an all-skipped class is flagged.-Dit.testwithout a lane runs the class in both failsafe executions.mvn test -pl openmetadata-integration-teststests theopenmetadata-servicejar in~/.m2, which another checkout can overwrite. Every command builds with-aminstead.mvn test -amcannot compile the service: the relocatedes.*/os.*clients only exist onceopenmetadata-shaded-depsis packaged. Unit steps runpackage.-amruns every upstream unit suite. IT steps pass a-Dtestfilter that matches nothing.Alternatives considered.
TestCaseDeleteResilienceITfor aTableRepositorychange (the link crosses areas), and every new IT needed a JSON edit.service.Entity), and direct imports miss most links because ITs reach repositories over HTTP.Rollout.
openmetadata-service-unit-tests-statusinmerge-rules; run the MCP unit tests in CI (710 tests, all pass on main, never run by any workflow); fix the SDK unit tests (surefire fails JUnit discovery with a platform version mismatch, so they have never run).Tests:
Tests run locally
Everything that ran before review, in each repo. CI on this PR does not run the ITs or Playwright.
python3 -m pytest .github/scripts/test_plan_local_java_tests.pypython3 -m pytest .github/scripts/test_plan_local_java_tests.py@Disabled, property-gated), SDK unit-test files that used to pull in the smoke set, and simple-name collisions the old one took for references (sdk.entities.Chartvs the schemaChartITs import)maincoremake java_affected_runon a sampleKpiRepository.javachange (block below)make java_affected ARGS=--check-mapandpython3 scripts/harness/check_harness.py(java-impact-map)mvn -o help:effective-pom -pl collate-integration-testswith and without-DintegrationTests.skipSequential=trueNot run: the 21 Playwright smoke and canary specs
make playwright_affectedselects for any unmapped file (this PR changes no product code), and Collate's 4 smoke ITs (see #7162).Use cases covered
TableRepositorychange runs the databases area, the ITs that name it (TestCaseDeleteResilienceIT, the review's case), the ITs of the entities whose code calls it (TestCase…,Query…,GlossaryTerm…, …) and the smoke set: 74 ITs, or 47 when the diff only changesentitySpecificCleanup.EntityRepositorychange, a pom, or a file no area owns runs the full suite.-Pcache-tests.K8sPipelineClient, which the IT bootstrap names, no longer selects all 201 ITs that use the bootstrap.Unit tests
.github/scripts/test_plan_local_java_tests.py: 41 tests, all passing (python3 -m pytest .github/scripts/test_plan_local_java_tests.py). They run against this repo and the real map: the ownership audit (single tests, unowned ITs and files, dead patterns), never-run and property-gated classes read from code and pom, references and callers (the review'sTableRepositorycase), method anchoring, helpers most ITs use, every full-suite trigger, author additions with a required reason, changed methods from hunk headers,--ci-run(including a run whose lanes were skipped), lanes and engines, report parsing, the PR block, and untracked files.plan_local_java_tests.py: 68%. The uncovered lines are the Maven andghexecution path, which the end-to-end run below exercises.Backend integration tests
This PR changes no Java, so its own block reads NOT NEEDED:
Local Java test run: NOT NEEDED — no Java unit or integration test is impacted.
b5c574b09a2c(baseorigin/main)The planner itself was run end to end against real Maven and Testcontainers, on this PR's head (
be3caadf4e57), for a sample one-file change:make java_affected_runwith--changed-fileslistingKpiRepository.java, since this PR's own diff selects nothing. It shows the area (data insights), the entity and caller signals (KpiResourceIT), the unit test that references the class, and the smoke set. Its block, without the markers so it doesn't replace this PR's own:Planner validation run: PASSED (sample change:
jdbi3/KpiRepository.java)be3caadf4e57(baseorigin/main)Tests run locally
KpiRepositoryTest(2 passed)BaseEntityIT$ListEntityHistoryByTimestampPaginationTest(310 passed, 27 skipped),ConfigResourceIT(16 passed, 3 skipped),DataInsightAggregationIT(35 passed),DataInsightAliasReconciliationIT(1 passed, 1 skipped),DataInsightChartResourceIT(215 passed, 35 skipped),DataInsightSystemChartResourceIT(55 passed, 7 skipped),DataInsightsEnricherBehaviorIT(5 passed, 1 skipped),DatabaseSmokeIT(29 passed, 9 skipped),EnricherBulkVsHistoryPathEquivalenceIT(78 passed, 6 skipped),GlossaryTermResourceIT(266 passed, 9 skipped),KpiResourceIT(97 passed, 19 skipped),ReportDataResourceIT(14 passed, 5 skipped),SeedDataPresenceIT(5 passed),TableResourceIT(44 passed),UserResourceIT(11 passed, 1 skipped),WebAnalyticEventResourceIT(5 passed)Per-class counts come from failsafe's reports, which can credit a test to the wrong class when classes run concurrently; the step totals above are exact.
Why these tests
area data-insights←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.javacalled from entity Kpi←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.javaentity Kpi←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.javasmoke←code other than a test class changedCommands
Ingestion integration tests
Playwright (UI) tests
Not run.
make playwright_affectedselects its fixed 5-spec smoke set plus the 16 canaries it adds for any unmapped file, docs included. This PR changes CI tooling, skills and docs only, so none of those specs can exercise it.Manual testing performed
make java_affected ARGS=--check-map: every integration test and production file has an owner.python3 scripts/harness/check_harness.py: nojava-impact-mapwarnings.--changed-filesand checked each command's lane, engine profile and test filter.make java_affected_runend to end (table above), then checked the results block upserts into this template under "Backend integration tests".UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code