test(import): use unique content-type variables in ImportUtilTest relationship tests (#36501) - #36518
Conversation
…ationship tests (#36501) The relationship / self-related import tests hardcoded shared content-type variables ("parentContentType", "childContentType", "selfRelatedType") and deleted them in a finally block. Content-type deletion disposes the variable asynchronously; under a dual-write migration phase (opensearch.phase=1) that disposal lags, so the next test creating the same fixed variable hits doesTypeWithVariableExist() == true and fails with "IllegalArgumentException: Invalid content type variable: parentContentType" (cascading across ~7 relationship tests in MainSuite1a). Append a per-call timestamp to the variable so each test is isolated regardless of async cleanup timing — mirroring the existing sibling tests that already use "parentContentType" + new Date().getTime(). Test-isolation robustness; no product change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @fabrizzio-dotCMS's task in 53s —— View job Code Review
ReviewThis is a clean, test-only change. All 8 call sites replace the hardcoded content-type variable ( Correctness verified:
The root-cause reasoning holds: content-type disposal is async, and under Minor (non-blocking) observation: The separate i18n message-resolution failures noted in the PR description are correctly scoped out of this change. New IssuesNo issues found. |
|
Tick the box to add this pull request to the merge queue (same as
|
Proposed Changes
Fixes the phase-induced
ImportUtilTestfailures tracked in #36501 (found while running MainSuite1a under an ES→OS migration phase — see #36320).Root cause
The relationship / self-related import tests hardcoded shared content-type variables (
"parentContentType","childContentType","selfRelatedType") and deleted them in afinallyblock. Content-type deletion disposes the variable asynchronously; under a dual-write phase (-Dopensearch.phase=1) that disposal lags, so the next test creating the same fixed variable hitsdoesTypeWithVariableExist() == trueand fails with:cascading across ~7 relationship tests in MainSuite1a. The baseline (phase 0) passes because disposal completes promptly.
Fix
Append a per-call timestamp to the variable so each test is isolated regardless of async cleanup timing — mirroring sibling tests in the same file that already use
"parentContentType" + new Date().getTime(). Test-isolation robustness only; no product change.Verification
Ran under phase 1 locally: the
Invalid content type variable: parentContentTypeerrors are eliminated (0 remaining, was 7).With the cascade removed,
ImportUtilTestnow runs far enough to reveal 11 unrelated failures in the unique-field tests (testingImportWithUniqueFields,importFile_fails_when_twoLinesHaveSameUniqueKeys, …). These are i18n message-resolution failures —LanguageUtil.get(user, "were-created" / "contains-duplicate-values-for-structure-unique-field")returns the raw key instead of the resolved text, even though the keys exist inLanguage.properties. This is phase-agnostic (no ES/OS involvement) and independent of this change; it was previously masked by theparentContentTypesetup errors. Filing/investigating separately under #36501. It may be a local-env artifact (the import message code merged to main through green CI).Refs #36501.
This PR fixes: #36501