feat(dq): add testSuiteNames to CreateTestCaseRequest #26973
feat(dq): add testSuiteNames to CreateTestCaseRequest #26973SaaiAravindhRaja wants to merge 128 commits intoopen-metadata:mainfrom
Conversation
…21203) Adds an optional testSuiteNames field (array of FQNs) to CreateTestCaseRequest so users can attach a new test case to logical test suites in a single API call, without needing a separate PUT /logicalTestCases request.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
There was a problem hiding this comment.
Pull request overview
Adds the ability for API callers to attach a newly created/updated TestCase to one or more logical TestSuites in the same request, by introducing a new optional request field and wiring it into the TestCase create/update flows.
Changes:
- Extend
CreateTestCaseRequestschema with optionaltestSuiteNames: string[](logical TestSuite FQNs). - Update
TestCaseResourcecreate and createOrUpdate endpoints to attach the resulting TestCase to the specified logical suites. - Add helper logic in
TestCaseResourceto resolve suite FQNs and perform the attachment viaTestCaseRepository.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| openmetadata-spec/src/main/resources/json/schema/api/tests/createTestCase.json | Adds testSuiteNames optional array to the CreateTestCase request schema. |
| openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java | Hooks new request field into create/createOrUpdate and adds helper to attach the test case to named logical suites. |
| for (String testSuiteName : testSuiteNames) { | ||
| TestSuite testSuite = | ||
| Entity.getEntityByName(Entity.TEST_SUITE, testSuiteName, "domains,owners", ALL); | ||
| if (Boolean.TRUE.equals(testSuite.getBasic())) { | ||
| throw new IllegalArgumentException( |
There was a problem hiding this comment.
addTestCaseToNamedTestSuites fetches the TestSuite and mutates it via repository.addTestCasesToLogicalTestSuite(...), but it does not perform any authorization checks (unlike validateTestSuiteOps, which enforces EDIT_TESTS/EDIT_ALL). This allows callers who can create/update a test case to attach it to logical suites they may not have permission to edit. Consider passing SecurityContext into this helper and calling validateTestSuiteOps(testSuite, securityContext) (or equivalent) before the mutation. Also, using Include.ALL here can resolve soft-deleted suites; Include.NON_DELETED (or null) would be safer/consistent with other add-to-suite flows in this resource.
| new AuthRequest(testCaseOpContext, testCaseResourceContext)); | ||
| authorizer.authorizeRequests(securityContext, requests, AuthorizationLogic.ANY); | ||
| test = addHref(uriInfo, repository.create(uriInfo, test)); | ||
| addTestCaseToNamedTestSuites(test, create.getTestSuiteNames()); |
There was a problem hiding this comment.
This call runs after repository.create(...). If addTestCaseToNamedTestSuites throws (e.g., basic suite passed, suite not found, or future auth checks), the API will return an error even though the test case has already been created, leaving the system in a partial state. Consider validating all testSuiteNames (existence, non-basic, permissions) before creating the test case, and/or making the create+attach operation atomic (single transaction or compensating delete on failure).
| addTestCaseToNamedTestSuites(test, create.getTestSuiteNames()); | |
| try { | |
| addTestCaseToNamedTestSuites(test, create.getTestSuiteNames()); | |
| } catch (Exception ex) { | |
| LOG.error( | |
| "Failed to add test case {} to named test suites {} after creation", | |
| test.getFullyQualifiedName(), | |
| create.getTestSuiteNames(), | |
| ex); | |
| } |
| addTestCaseToNamedTestSuites(response.getEntity(), create.getTestSuiteNames()); | ||
| addHref(uriInfo, response.getEntity()); |
There was a problem hiding this comment.
As with create(...), this call runs after repository.createOrUpdate(...). If addTestCaseToNamedTestSuites fails, the request can return an error despite the test case having been created/updated, which is a surprising partial-success outcome for PUT. Consider pre-validating testSuiteNames (and authorizations) before the write, and/or ensuring the update + attachments are applied atomically or with a clear, consistent error strategy.
| addTestCaseToNamedTestSuites(response.getEntity(), create.getTestSuiteNames()); | |
| addHref(uriInfo, response.getEntity()); | |
| TestCase persistedTestCase = response.getEntity(); | |
| try { | |
| addTestCaseToNamedTestSuites(persistedTestCase, create.getTestSuiteNames()); | |
| } catch (RuntimeException ex) { | |
| log.error( | |
| "Failed to add test case {} to named test suites {} after createOrUpdate completed", | |
| persistedTestCase.getId(), | |
| create.getTestSuiteNames(), | |
| ex); | |
| } | |
| addHref(uriInfo, persistedTestCase); |
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
|
🟡 Playwright Results — all passed (16 flaky)✅ 3455 passed · ❌ 0 failed · 🟡 16 flaky · ⏭️ 223 skipped
🟡 16 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 |
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
|
|
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
…ed tests (open-metadata#26561) * feat: migrate DeleteModal to new component structure and update related tests * fixed typography changes * fixed unit test * fixed lint issue
…en-metadata#27219) Bumps [axios](https://github.com/axios/axios) from 1.13.5 to 1.15.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](axios/axios@v1.13.5...v1.15.0) --- updated-dependencies: - dependency-name: axios dependency-version: 1.15.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…PI (open-metadata#27139) * fix: action buttons visible immediately despite slow pipelineStatus API * fixed the recent run overlapping issue * addressed gitar comment * addressed PR comment * addressed gitar comment * fixed lint checks
* Fix loading effect for ontology scroll * nit * nit * fix translated key
…tion spec (open-metadata#27262) * fix(playwright): Fix flaky ActivityFeed mention notification and reaction tests * remove afterAll
…t timeouts in E2E specs (open-metadata#27291) * fix: refactor user initialization and applyFixture usage in ProfilerConfigurationPage tests * fix: update ESLint rules and refactor test page fixture usage in ProfilerConfigurationPage tests * fix: update test case incident page navigation to ensure API response is validated * fix: refactor user and table initialization in IncidentManager tests and add notification response validation * fix: add slow test condition for AUT Global test case list page in Data Quality redirection test * addressing comments
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 205 out of 810 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java:1
- If
testSuiteNamescontains an invalid/basic/non-permitted suite,addTestCaseToNamedTestSuites(...)throws afterrepository.create(...)already persists the TestCase. That leaves the system in a partial state (client sees a 400, but the TestCase exists). To keep the endpoint behavior consistent, validate/resolve and authorize thetestSuiteNamesbefore creating the TestCase (or execute create + attaches in a single transaction / roll back on failure).
package org.openmetadata.service.resources.dqtests;
openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java:1
- Similar to
create, this can partially apply changes:createOrUpdate(...)may commit the update, thenaddTestCaseToNamedTestSuites(...)can throw and return an error response. Consider resolving/authorizing suites before callingrepository.createOrUpdate(...), or ensure the entire operation is transactional so the response accurately reflects the persisted state.
package org.openmetadata.service.resources.dqtests;
| limit, | ||
| offset, |
There was a problem hiding this comment.
If testSuiteNames includes duplicates, this will validate and attach the same suite multiple times, causing redundant lookups and potentially duplicate relationship writes (depending on repository behavior). Consider de-duplicating input first (while preserving order if needed) and/or de-duplicating validatedSuites before the attach loop.
| "testSuiteNames": { | ||
| "description": "Fully qualified names of the logical test suites to add this test case to upon creation.", | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "../../type/basic.json#/definitions/fullyQualifiedEntityName" | ||
| } | ||
| } |
There was a problem hiding this comment.
Consider adding uniqueItems: true to testSuiteNames to make the API contract explicit and prevent accidental duplicate suite names. This also aligns with the server-side need to avoid duplicate attachments/work.
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Gitar
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
|
closing this as a duplicate of #26960 |



Fixes #21203
Adds an optional
testSuiteNamesfield (array of logical test suite FQNs) toCreateTestCaseRequest. This lets callers attach a new test case to one or more logical test suites in a single API call — no separatePUT /logicalTestCasesneeded.Changes
createTestCase.json: add optionaltestSuiteNamesstring arrayTestCaseResource: calladdTestCaseToNamedTestSuitesafter create and createOrUpdate; throws if a basic test suite is passed