Skip to content

test(metrics): fix MetricGroupResourceTest PATCH test failing on main - #37110

Merged
manerow merged 1 commit into
mainfrom
fix/metric-group-patch-test-stub
Nov 5, 2026
Merged

manerow merged 1 commit into
mainfrom
fix/metric-group-patch-test-stub

Conversation

@sonika-shah

Copy link
Copy Markdown
Collaborator

MetricGroupResourceTest.patchResponseSanitizesMembershipAndStillHidesMembers fails on main and on every PR's openmetadata-service-unit-tests job:

RuntimeException: Failed to convert object to JsonStructure
  at JsonUtils.applyPatch
  at MetricAuthorization.authorizeGroupPatch(MetricAuthorization.java:237)
  at MetricGroupResource.patch(MetricGroupResource.java:455)

Cause: #36955 made MetricGroupResource.patch read the stored group with repository.get(...) and apply the patch to it before authorizing. The test (added in #36764) only stubs getWithMembers, so the mocked get returns null and applyPatch(null, …) throws. Each PR was green on its own.

Fix: stub repository.get(any(), eq(groupId), any()) to return the original, the same way the other PATCH tests in this class do. Test-only change.

Verification: MetricGroupResourceTest fails locally on current main (1 error) and passes with this change; MetricGroupResourceTest + MetricResourceTest 37/37 green; spotless clean.

MetricGroupResource.patch now loads the stored group with repository.get before
authorizing the patch (#36955). The test added in #36764 only stubbed
getWithMembers, so get returned null and applyPatch failed with
"Expected a JSON object or array", failing openmetadata-service unit tests on main.
@sonika-shah
sonika-shah requested a review from a team as a code owner November 5, 2026 07:22
@sonika-shah
sonika-shah requested review from yan-3005 and a balanced review from Copilot November 5, 2026 07:22

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions

github-actions Bot commented Nov 5, 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 Nov 5, 2026
@gitar-bot

gitar-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟢 Low risk · Adds a repository-read stub only in a test; production behavior is unchanged, so the impact is limited to PATCH test setup.

Test-only fix stubs the original group read in the MetricGroupResourceTest PATCH sanitize test, resolving the null-conversion failure on main. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@manerow
manerow merged commit 2bcf930 into main Nov 5, 2026
60 of 62 checks passed
@manerow
manerow deleted the fix/metric-group-patch-test-stub branch November 5, 2026 07:37
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.

3 participants