Repository navigation
MINOR - feat(dq): accept multiple testCaseStatus values on testCases/search/list - #31498
Conversation
…search/list `GET /v1/dataQuality/testCases/search/list` bound `testCaseStatus` to a single String and built a single Elasticsearch `term` clause, so filtering on more than one status was impossible. The parameter is now a `List<String>` that accepts repeated params and/or comma separated values, is validated case-insensitively against the `TestCaseStatus` enum, and is turned into a `terms` clause so the statuses match as an OR. 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 |
Code Review ✅ ApprovedUpdates the testCaseStatus parameter on the data quality test case search endpoint to accept multiple comma-separated or repeated values, enabling case-insensitive OR filtering with edge validation. No issues found. 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.
Pull request overview
This PR updates the Elasticsearch-backed Data Quality test case search endpoint (GET /api/v1/dataQuality/testCases/search/list) to support filtering by multiple testCaseStatus values in a single request, improving client efficiency and making status filtering case-insensitive with proper validation at the resource layer.
Changes:
- Extend
testCaseStatusquery param handling to accept repeated and/or comma-separated values, normalize them case-insensitively to canonicalTestCaseStatusvalues, and reject unknown statuses with a 400. - Update the ES query builder to emit a
termsfilter fortestCaseResult.testCaseStatus(OR semantics) instead of a singleterm. - Add/adjust unit and integration tests to cover multi-status filtering, blank handling, and invalid status behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java | Accept testCaseStatus as a list, validate/normalize values, and pass the normalized status set into the search filter. |
| openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java | Build the test-case status filter using an ES terms clause (OR) while preserving single-status behavior. |
| openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/SearchListFilterTest.java | Update expected query shapes for term → terms and add unit coverage for multi-status and blank status inputs. |
| openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TestCaseResourceIT.java | Add integration coverage for repeated/comma-separated/case-insensitive multi-status filtering and for unknown-status 400 behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
5722dfe
…search/list (#31498) (#31831) `GET /v1/dataQuality/testCases/search/list` bound `testCaseStatus` to a single String and built a single Elasticsearch `term` clause, so filtering on more than one status was impossible. The parameter is now a `List<String>` that accepts repeated params and/or comma separated values, is validated case-insensitively against the `TestCaseStatus` enum, and is turned into a `terms` clause so the statuses match as an OR. (cherry picked from commit 5722dfe) Co-authored-by: Teddy <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Sriharsha Chintalapani <[email protected]>



Describe your changes:
Not applicable — MINOR change, no linked issue.
GET /api/v1/dataQuality/testCases/search/listboundtestCaseStatusto a singleStringand built a single Elasticsearchtermclause, so there was no way to ask for "Failed or Aborted" in one call — callers had to fire one request per status and merge/paginate the results client-side.The parameter now accepts N values, matched as an OR:
?testCaseStatus=Failed&testCaseStatus=Aborted?testCaseStatus=Failed,Aborted?testCaseStatus=failed,ABORTED?testCaseStatus=Failed?testCaseStatus=NotAStatus400—Invalid testCaseStatus 'NotAStatus'. Allowed values are [Success, Failed, Aborted, Queued]Statuses OR each other; the status filter still ANDs with every other filter (
testCaseType,entityLink,tags, …).Type of change:
High-level design:
Small change (2 main classes, 4 files), but it touches an API contract, so briefly:
TestCaseResource.validateTestCaseStatusessplits repeated params on commas, trims, de-duplicates, and resolves each value case-insensitively to aTestCaseStatusconstant before handing a normalized comma-separated string down. Unknown values raiseIllegalArgumentException, whichCatalogGenericExceptionMapperalready maps to a400.SearchListFiltertherefore stays a dumb query builder and the Elasticsearchtermsclause always receives exact keyword values — nocase_insensitiveflag or index-side normalizer required.term→terms.SearchListFilter.getTestCaseStatusConditionemits{"terms": {"testCaseResult.testCaseStatus": [...]}}.termsis an OR by definition and is equivalent totermfor a single value, so single-status callers see no change.testCaseStatus=failedused to be accepted and silently match nothing (the ES keyword field is case-sensitive) and now returns the Failed test cases; an unknown status used to return an empty list and now returns an actionable 400.GET /dataQuality/testCaseslist endpoint still takes a single status (status = :testCaseStatusinListFilter), and the UI still sends one value. Both are straightforward follow-ups if wanted.Tests:
Use cases covered
?testCaseStatus=Failed&testCaseStatus=Aborted)failed,ABORTED)Unit tests
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/SearchListFilterTest.javatestMultipleTestCaseStatusesAreMatchedAsOrandtestBlankTestCaseStatusesAreIgnoredtestComplexGetConditionandtestTestCaseConditionBuildsAllEntitySpecificFiltersfor theterm→termsshapemvn test -pl openmetadata-service -Dtest=SearchListFilterTest→ 29/29 passmvn -Pstatic-code-analysis test -pl openmetadata-service -Dtest=SearchListFilterTest jacoco:report): 96% line coverage onSearchListFilter.java(253/263 lines) from this test class alone.TestCaseResource.javareports 0% here because it is a JAX-RS resource exercised by the integration tests below, not by unit tests.getTestCaseStatusConditioncall makes 4 of the 29 fail — the old code built{"term": {…: "Failed,Aborted"}}, a term that matches nothing.Backend integration tests
openmetadata-integration-tests/for the changed endpoint.openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TestCaseResourceIT.javatest_searchListByMultipleTestCaseStatuses_matchesAnyOfThem— creates three test cases on one table (Failed / Aborted / Success) and asserts the repeated-param, comma-separated, and lowercase forms all return the Failed + Aborted ones and exclude the Success one, and that a single status still narrows to that statustest_searchListByUnknownTestCaseStatus_returnsBadRequest— asserts a 400 (InvalidRequestException) naming the bad valueIngestion integration tests
Playwright (UI) tests
Manual testing performed
Verification was automated against real Postgres + Elasticsearch (the ITs above) rather than a hand-driven stack. To reproduce by hand on a local stack:
The Data Quality page (which still sends a single status) continues to filter correctly.
UI screen recording / screenshots:
Not applicable — backend only.
Checklist:
Fixes <issue-number>: <short explanation>— N/A, MINOR change with no linked issueFixes #<issue-number>above — N/A, MINOR changeTestCaseStatusenum is used as-is.Improvement: