test(search): integration test for marketplace index alias#28094
test(search): integration test for marketplace index alias#28094pmbrull wants to merge 1 commit into
Conversation
Validates that querying /v1/search/query?index=marketplace returns only Domain and DataProduct entities, scoped via the parentAliases already defined in indexMapping.json. Seeds a domain + data product + control table and confirms the table is excluded from the alias hits. Fixes open-metadata/ai-platform#578 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
| void marketplaceAliasReturnsOnlyDomainsAndDataProducts(TestNamespace ns) throws Exception { | ||
| OpenMetadataClient client = SdkClients.adminClient(); | ||
|
|
||
| String uniqueTag = "mp" + ns.uniqueShortId(); | ||
|
|
||
| Domain domain = createDomain(client, uniqueTag + "_domain"); | ||
| DataProduct dataProduct = createDataProduct(client, uniqueTag + "_dp", domain); | ||
| Table controlTable = createControlTable(client, ns, uniqueTag + "_table"); | ||
|
|
||
| Awaitility.await("marketplace alias returns the seeded domain and data product") | ||
| .atMost(Duration.ofSeconds(60)) | ||
| .pollDelay(Duration.ofMillis(500)) | ||
| .pollInterval(Duration.ofSeconds(1)) | ||
| .ignoreExceptions() | ||
| .untilAsserted( |
There was a problem hiding this comment.
⚠️ Quality: Test does not clean up created entities after execution
The test creates a Domain, DataProduct, DatabaseService, Database, DatabaseSchema, and Table but never deletes them. Other integration tests in this repository (e.g., EventSubscriptionResourceIT) manually call deleteEntity() or the equivalent client delete method after assertions. Without cleanup, repeated test runs or CI executions will accumulate orphan entities in the shared environment.
Suggested approach: add a try/finally block or @AfterEach to delete entities in reverse dependency order (table → schema → database → service → dataProduct → domain).
Wrap entity creation and assertions in try/finally to ensure cleanup:
@Test
void marketplaceAliasReturnsOnlyDomainsAndDataProducts(TestNamespace ns) throws Exception {
OpenMetadataClient client = SdkClients.adminClient();
String uniqueTag = "mp" + ns.uniqueShortId();
Domain domain = createDomain(client, uniqueTag + "_domain");
DataProduct dataProduct = createDataProduct(client, uniqueTag + "_dp", domain);
Table controlTable = createControlTable(client, ns, uniqueTag + "_table");
try {
Awaitility.await("marketplace alias returns the seeded domain and data product")
// ... existing await logic ...
} finally {
client.tables().delete(controlTable.getId());
client.databaseSchemas().delete(/* schema id */);
client.databases().delete(/* db id */);
client.databaseServices().delete(/* svc id */);
client.dataProducts().delete(dataProduct.getId());
client.domains().delete(domain.getId());
}
}
Was this helpful? React with 👍 / 👎
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Gitar
There was a problem hiding this comment.
Pull request overview
Adds backend integration coverage for the marketplace search alias to ensure it routes correctly and returns only marketplace-scoped entity types.
Changes:
- Adds
MarketplaceSearchITwith end-to-end search assertions for Domain and DataProduct results. - Seeds a control Table to verify non-marketplace entities are excluded.
- Adds a routability smoke test for the
marketplacealias.
| assertFalse( | ||
| seenIds.contains(controlTable.getId().toString()), | ||
| "marketplace alias should not include tables"); |
🔴 Playwright Results — 8 failure(s), 19 flaky✅ 4043 passed · ❌ 8 failed · 🟡 19 flaky · ⏭️ 103 skipped
Genuine Failures (failed on all attempts)❌
|
Describe your changes:
Fixes open-metadata/ai-platform#578
The
marketplaceindex alias is already configured inindexMapping.jsonas aparentAliason bothdomainanddataProduct. This PR adds an integration test that pins the behavior end-to-end so the marketplace search UI cannot silently regress.Type of change:
Tests:
Use cases covered
GET /v1/search/query?index=marketplacereturns onlyDomainandDataProductentities and excludes other types (verified with a seeded controlTable).marketplacealias is routable against the live cluster without an error response.Backend integration tests
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/MarketplaceSearchIT.javawith two tests (marketplaceAliasReturnsOnlyDomainsAndDataProducts,marketplaceAliasIsRoutableWithoutSeededData).Manual testing performed
mvn test -pl openmetadata-integration-tests -Dtest="MarketplaceSearchIT"→Tests run: 2, Failures: 0, Errors: 0, Skipped: 0.mvn -pl openmetadata-integration-tests spotless:check→ clean.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixesabove.