Skip to content

fix(test): keep global mock TableRepository registrations index-policy safe - #32537

Merged
mohityadav766 merged 2 commits into
mainfrom
fix/global-mock-table-repo-index-policy
Sep 3, 2026
Merged

mohityadav766 merged 2 commits into
mainfrom
fix/global-mock-table-repo-index-policy

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

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) and RdfResourceTest (added 2026-08-29 in
#28042) both 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 / isVectorEmbeddable, so every later test in the same surefire JVM that reaches
the gate in ElasticSearchBulkSink.enrichWithEmbedding (:1112) / OpenSearchBulkSink.enrichWithEmbedding
(:1141) returns early:

if (!Entity.isVectorEmbeddable(entity)) { return json; }   // vector service + stats tracker never touched

which is why the 9 enrichWithEmbedding* tests fail with Wanted 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). The
two registrations added since did not carry the stubs over. This PR adds them.

It is intermittent in CI because surefire's default runOrder is filesystem — it only breaks when
the 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:

  • Bug fix

High-level design:

N/A — two-line stub at each registration site.

Tests:

Use cases covered

  • openmetadata-service unit suite is order-independent again: the bulk-sink vector-embedding tests
    pass whether or not LineagePermissionFilterTest / RdfResourceTest ran 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 (alphabetical sorts by FQN, so apps.* runs before lineage.* and hides it):

mvn -pl openmetadata-service test -Dsurefire.runOrder=reversealphabetical \
  -Dtest='RdfResourceTest,LineagePermissionFilterTest,OpenSearchBulkSinkBehaviorTest,ElasticSearchBulkSinkBehaviorTest'

Before (same 6 + 3 failures as CI):

ERROR  OpenSearchBulkSinkBehaviorTest    Tests run: 19, Failures: 6

After:

RdfResourceTest                   Tests run: 14, Failures: 0
LineagePermissionFilterTest       Tests run:  9, Failures: 0
OpenSearchBulkSinkBehaviorTest    Tests run: 19, Failures: 0
ElasticSearchBulkSinkBehaviorTest Tests run: 17, Failures: 0
Tests run: 59, Failures: 0, Errors: 0, Skipped: 0 — BUILD SUCCESS

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Covered by the ordered surefire runs above.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

🤖 Generated with Claude Code

…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]>
Copilot AI lite review requested due to automatic review settings September 3, 2026 08:33
@mohityadav766
mohityadav766 requested a review from a team as a code owner September 3, 2026 08:33
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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-registered TableRepository mock with one that stubs isSearchIndexable(...) and isVectorEmbeddable(...) to true.
  • In LineagePermissionFilterTest, add the same stubs to its globally-registered TableRepository mock.
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.

Copilot AI review requested due to automatic review settings September 3, 2026 08:55
@gitar-bot

gitar-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds missing isSearchIndexable and isVectorEmbeddable stubs to two global mock TableRepository registrations in LineagePermissionFilterTest and RdfResourceTest, preventing test isolation failures in bulk-sink vector-embedding tests when these classes run first in the same JVM. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit a72729af8abbab0a1ef13fabeb6e6760bc099737 in Playwright run 33735981878, attempt 1.

✅ 555 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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:

  • Browser traffic was 217.32 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.82 per UI scenario (1636 boots / 580 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 147 0 0 0 0 0
🟡 Shard chromium-02 129 0 1 0 0 0
🟡 Shard chromium-03 121 0 1 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 2 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › Tier Add, Update and Remove (shard chromium-02, 1 retry)
  • Pages/Entity.spec.ts › Tier Add, Update and Remove (shard chromium-03, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@yan-3005 yan-3005 mentioned this pull request Sep 3, 2026
9 tasks done
@mohityadav766
mohityadav766 merged commit 673aa6c into main Sep 3, 2026
122 of 124 checks passed
@mohityadav766
mohityadav766 deleted the fix/global-mock-table-repo-index-policy branch September 3, 2026 11:35
shrabantipaul-collate pushed a commit to PRADDZY/OpenMetadata that referenced this pull request Sep 3, 2026
…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]>
harshach added a commit that referenced this pull request Sep 3, 2026
…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]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants