Repository navigation
Conversation
taskr run 0182. PUT-create and CSV import now run `TestCaseRepository.prepare` as creates or updates, CSV dry runs match real imports and create no suite, the open-metadata#35629 workaround is removed, and the 11 targeted ITs pass (5 of them were confirmed failing on the original code).
taskr run 0183. Test cases now resolve suites from `entityLink` on PATCH while CSV imports preserve their row-supplied suite.
|
taskr run 0183: Test cases now resolve suites from Verification: green, mvn -q -pl openmetadata-service spotless:check pass, mvn -q -pl openmetadata-service -DskipTests install -nsu pass, mvn -pl openmetadata-service -Dtest=TestCaseRepositoryTest -Dsurefire.failIfNoSp pass, mvn -pl openmetadata-integration-tests verify -Dit.test='TestCaseResourceIT#patc pass Review (terra): fix, 1 finding(s) |
Code Review ✅ Approved 🔴 High risk 2 closed / 2 findingsChanging test-suite relationship persistence and entity-link reassignment could detach test cases from suites or leave their memberships inconsistent. Adds PUT-create and CSV import paths that determine whether each test case is new or existing and run ✅ 2 closed✅ Bug: prepare() no longer resets testSuite on PATCH, so stale/arbitrary suites persist
Closed: Quality: CSV testSuite column now limited to table's basic suite; no record
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Summary
PUT and CSV import now determine whether each test case is new or existing and pass the matching flag through preparation. CSV dry runs apply the same checks and report the same created or updated result as real imports, without creating test suites; the #35629 workaround was removed. Review the preparation and CSV import paths in
TestCaseRepositoryfirst; 11 targeted integration tests pass.Implementer's note: PUT-create and CSV import now run
TestCaseRepository.prepareas creates or updates, CSV dry runs match real imports and create no suite, the #35629 workaround is removed, and the 11 targeted ITs pass (5 of them were confirmed failing on the original code).Plan
TestCaseResource.javacreateOrUpdate(~L951-965,createOrUpdateRequests~L972-978): after the existingrepository.setFullyQualifiedName(test), computeboolean exists = repository.findByNameOrNull(test.getFullyQualifiedName(), Include.ALL) != nullonce. Passexiststo the auth-request builder (changecreateOrUpdateRequeststo take the flag so the lookup is not repeated) and callrepository.prepareInternal(test, exists)instead ofprepareInternal(test, true). Keep each method ≤15 lines.TestCaseRepository.javaprepare(L875-914): split intoTable validateForWrite(TestCase test, boolean update), which holds every check up to and including theif (!update) TestCaseDefinitionConformance.validate(...)block, and a suite step. The suite step becomesif (test.getTestSuite() == null) test.setTestSuite(getOrCreateTestSuite(test, table));, so a suite the caller already resolved (CSV row or bundle) is kept. Suite creation stays after all validation, as today.TestCaseRepository.java: add a package-privatecheckForImport(TestCase test, boolean isUpdate)for the CSV dry run. It runs the same checksprepareInternalruns for a test case (tags, extension, certification on create) and thenvalidateForWrite, but never the suite step, so a dry run creates no basic suite. Verify the visibility ofvalidateTags,validateExtensionandprepareCertificationinEntityRepository; widen them to package-private only if needed, and confirmprepareCertificationdoes no writes.TestCaseRepository.javaTestCaseCsv.createEntity(L2530-2665):a. Keep the manual FQN computation (L2600-2606). Compute
boolean isUpdate = repository.findByNameOrNull(testCaseFqn, Include.ALL) != nullonce and reuse it in theauthorizeRowForAnylambda (L2610-2614) instead of repeating the lookup.b. Delete the
repository.getOrCreateTestSuite(testCase)branch (L2625-2629). A row with notestSuitecolumn leaves the suite unset for prepare.c. Before the dry-run/real branch, run
repository.checkForImport(testCase, isUpdate)in dry run andrepository.prepareInternal(testCase, isUpdate)in the real run (the real run must call it beforecreateOrUpdateForImport). Keep the id/updatedAt/updatedBy defaults (L2631-2641) but drop the stale comment that says prepare is not called.d. Record
importedTestSuiteIdsfromtestCase.getTestSuite()after prepare, in one place for both suite sources. Previously the ids were recorded from thegetOrCreateTestSuiteresult, which is no longer available.e. Dry-run success status (L2658):
isUpdate ? ENTITY_UPDATED : ENTITY_CREATED, matching the real run's CREATED→ENTITY_CREATED and OK→ENTITY_UPDATED. Today a dry run always reports ENTITY_CREATED, so the two runs disagree on updated rows.f. Remove the dry-run
prepareInternal(testCase, true)(L2657), which is the Fixes 35274: Check test parameters against their definitions and fix open-window and boolean-set runs #35629 workaround.TestCaseRepository.java: grep for the "new-row conformance check" the card mentions. None existsVerification
Review (sonnet): approve
importedTestSuiteIdsis now filled only in the real-run branch. The row-suite branch used to fill it in dry runs too, and the entry now comes afterprepareInternalrather than before.id,updatedAtandupdatedByare now set afterprepareInternal, and not at all in the dry-run path that callscheckForImport.csvImport_newRowMissingRequiredParameter_failsRealAndDryRunpassesnullas the failure reason, so any failure of that row satisfies it.Files
Closes #35667
Opened by taskr run 0182.
Summary by Gitar
entityLinkchanges, via ashouldCompareoverride inTestCaseRepositoryHAStoCONTAINSinentitySpecificUpdatetestSuiteis not the target table's basic test suite, in both dry and real runsThis will update automatically on new commits.