Repository navigation
fix(test): keep global mock TableRepository registrations index-policy safe - #32537
Conversation
…y safe LineagePermissionFilterTest and RdfResourceTest register a bare Mockito TableRepository into Entity's static ENTITY_REPOSITORY_MAP in @BeforeAll and never tear it down. A bare mock answers false to isSearchIndexable and isVectorEmbeddable, so every later test in the same surefire JVM that reaches the `!Entity.isVectorEmbeddable(entity)` gate in ElasticSearchBulkSink/OpenSearchBulkSink.enrichWithEmbedding bails out early — the 9 enrichWithEmbedding* tests then fail with "zero interactions with this mock". #30593 added that gate and stubbed both policy hooks in the two global registrations that existed then (EntityCsvTest, RuleEvaluatorTest). The two registrations added since did not carry the stubs over. Add them. Intermittent in CI because surefire's default runOrder is filesystem: it only breaks when the polluting class happens to run before the sink tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
There was a problem hiding this comment.
🟡 Changes recommended
The repo’s “Validate PR Metadata” workflow requires a linked issue (or a maintainer-applied bypass label), and the PR description states there is no linked issue.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes a CI-only test isolation issue in openmetadata-service by making sure globally-registered TableRepository Mockito mocks don’t accidentally disable search/vector indexing policies for the rest of the surefire JVM.
Changes:
- In
RdfResourceTest, replace the bare globally-registeredTableRepositorymock with one that stubsisSearchIndexable(...)andisVectorEmbeddable(...)totrue. - In
LineagePermissionFilterTest, add the same stubs to its globally-registeredTableRepositorymock.
File summaries
| File | Description |
|---|---|
| openmetadata-service/src/test/java/org/openmetadata/service/resources/rdf/RdfResourceTest.java | Ensures the globally-registered TableRepository mock preserves default indexing policy behavior (returns true). |
| openmetadata-service/src/test/java/org/openmetadata/service/lineage/LineagePermissionFilterTest.java | Prevents global test pollution by stubbing indexing policy hooks on the registered TableRepository mock. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Review ✅ ApprovedAdds missing OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
There was a problem hiding this comment.
🟡 Changes recommended
CI enforces linking a valid GitHub issue (PR Metadata Validation), and the PR description indicates no linked issue.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
✅ Playwright Results — workflow succeededValidated commit ✅ 555 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 1h 33m 50s ⏱️ Max setup 4m 56s · max shard execution 17m 12s · max shard-job elapsed before upload 20m 39s · reporting 5s 🌐 217.32 requests/attempt · 2.82 app boots/UI scenario · 7.85% common-shard skew Optimization targets still in progress:
🟡 2 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…y safe (open-metadata#32537) LineagePermissionFilterTest and RdfResourceTest register a bare Mockito TableRepository into Entity's static ENTITY_REPOSITORY_MAP in @BeforeAll and never tear it down. A bare mock answers false to isSearchIndexable and isVectorEmbeddable, so every later test in the same surefire JVM that reaches the `!Entity.isVectorEmbeddable(entity)` gate in ElasticSearchBulkSink/OpenSearchBulkSink.enrichWithEmbedding bails out early — the 9 enrichWithEmbedding* tests then fail with "zero interactions with this mock". open-metadata#30593 added that gate and stubbed both policy hooks in the two global registrations that existed then (EntityCsvTest, RuleEvaluatorTest). The two registrations added since did not carry the stubs over. Add them. Intermittent in CI because surefire's default runOrder is filesystem: it only breaks when the polluting class happens to run before the sink tests. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…rdf-reindex-slowdown One conflict, in RdfResourceTest.registerTableRepository: main landed the same index-policy stubs this branch carries (#32537) plus a comment explaining why the never-torn-down global mock has to answer isSearchIndexable/isVectorEmbeddable. Kept main's version — identical code, and the comment is the reason to keep. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Describe your changes:
No linked issue — this is a CI-only test-isolation fix. Failing run:
https://github.com/open-metadata/OpenMetadata/runs/100566583607 (9 failures,
Test Report).LineagePermissionFilterTest(added 2026-09-02 in #32437) andRdfResourceTest(added 2026-08-29 in#28042) both register a bare Mockito
TableRepositoryintoEntity's staticENTITY_REPOSITORY_MAPin@BeforeAll, and never tear it down. A bare mock answersfalsetoisSearchIndexable/isVectorEmbeddable, so every later test in the same surefire JVM that reachesthe gate in
ElasticSearchBulkSink.enrichWithEmbedding(:1112) /OpenSearchBulkSink.enrichWithEmbedding(
:1141) returns early:which is why the 9
enrichWithEmbedding*tests fail withWanted but not invoked … Actually, there were zero interactions with this mock.#30593 introduced that gate and had to stub both policy hooks in the two global registrations that
existed at the time (
EntityCsvTest,RuleEvaluatorTest, each with a comment explaining why). Thetwo registrations added since did not carry the stubs over. This PR adds them.
It is intermittent in CI because surefire's default
runOrderisfilesystem— it only breaks whenthe polluting class happens to be scheduled before the sink tests. First observed on 2026-09-02
18:12 UTC, then 2026-09-03 05:14 and 06:59 UTC; no occurrence in any run between 2026-08-15 and
2026-09-02.
Type of change:
High-level design:
N/A — two-line stub at each registration site.
Tests:
Use cases covered
openmetadata-serviceunit suite is order-independent again: the bulk-sink vector-embedding testspass whether or not
LineagePermissionFilterTest/RdfResourceTestran first in the same JVM.Unit tests
No new tests — this fixes existing ones. Reproduced the failure and verified the fix by forcing the
polluting order (
alphabeticalsorts by FQN, soapps.*runs beforelineage.*and hides it):Before (same 6 + 3 failures as CI):
After:
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Covered by the ordered surefire runs above.
UI screen recording / screenshots:
Not applicable.
Checklist:
🤖 Generated with Claude Code