Skip to content

Commit 1673f94

Browse files
anuj-kumaryclaude
andcommitted
fix(e2e/ontology): add idempotency guard for E2E custom relation type
Mirrors the Cardinality class double-call pattern: a concurrent worker issuing a stale PUT between addRelationTypesWithCardinality and the term patches can silently drop CUSTOM_OWNS_RELATION from the global config. The second (idempotent) call re-asserts the type before term patches run. Also switches from addRelationTypeWithCardinality (singular) to the batch variant addRelationTypesWithCardinality so the retry loop and verification step are the same as Cardinality. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bf881db commit 1673f94

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/support/entity/OntologyExplorerDataClass.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313
import { APIRequestContext } from '@playwright/test';
1414
import {
15-
addRelationTypeWithCardinality,
1615
addRelationTypesWithCardinality,
1716
addTermRelation,
1817
} from '../../utils/ontologyExplorer';
@@ -45,11 +44,18 @@ export class OntologyExplorerE2EData {
4544
this.termBrand.create(apiContext),
4645
]);
4746

48-
await addRelationTypeWithCardinality(apiContext, {
49-
name: this.CUSTOM_OWNS_RELATION,
50-
displayName: 'GP Owns',
51-
cardinality: 'ONE_TO_MANY',
52-
});
47+
// Use the batch variant so the idempotency guard (double-call) is available.
48+
// A concurrent worker that issues a stale PUT between setup and the term
49+
// patches below can silently drop this type; the second call re-asserts it.
50+
const E2E_CUSTOM_TYPE = [
51+
{
52+
name: this.CUSTOM_OWNS_RELATION,
53+
displayName: 'GP Owns',
54+
cardinality: 'ONE_TO_MANY',
55+
},
56+
];
57+
await addRelationTypesWithCardinality(apiContext, E2E_CUSTOM_TYPE);
58+
await addRelationTypesWithCardinality(apiContext, E2E_CUSTOM_TYPE);
5359

5460
// termProduct is patched twice (partOf termCategory, relatedTo termBrand)
5561
// so these must remain sequential to avoid a PATCH race.

0 commit comments

Comments
 (0)