From d31215e72ca1a3735dfae5224ceff3c3cffc4852 Mon Sep 17 00:00:00 2001 From: sonika-shah <58761340+sonika-shah@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:03:21 +0530 Subject: [PATCH] Fix: Remove unintended inclusion of child aliases after cluster after changes (#17472) * Fix: Remove unintended inclusion of child aliases after cluster alias update * fix the dataAssetWidget and entityDoc playwright failure --------- Co-authored-by: Ashish Gupta --- .../elasticsearch/ElasticSearchClient.java | 4 ---- .../search/opensearch/OpenSearchClient.java | 4 ---- .../e2e/Features/DataAssetsWidget.spec.ts | 18 +++++++----------- .../ui/playwright/e2e/Flow/ApiDocs.spec.ts | 2 +- .../resources/ui/playwright/utils/entity.ts | 2 -- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java index 23fbfd97272..e8ab116157c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java @@ -287,11 +287,7 @@ public class ElasticSearchClient implements SearchClient { try { Set aliases = new HashSet<>(indexMapping.getParentAliases(clusterAlias)); aliases.add(indexMapping.getAlias(clusterAlias)); - // Get the child aliases - List childAliases = indexMapping.getChildAliases(clusterAlias); - // Add the child aliases to the set of aliases - aliases.addAll(childAliases); IndicesAliasesRequest.AliasActions aliasAction = IndicesAliasesRequest.AliasActions.add() .index(indexMapping.getIndexName(clusterAlias)) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java index 1edd6a90ced..5c66464b231 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java @@ -280,11 +280,7 @@ public class OpenSearchClient implements SearchClient { try { Set aliases = new HashSet<>(indexMapping.getParentAliases(clusterAlias)); aliases.add(indexMapping.getAlias(clusterAlias)); - // Get the child aliases - List childAliases = indexMapping.getChildAliases(clusterAlias); - // Add the child aliases to the set of aliases - aliases.addAll(childAliases); IndicesAliasesRequest.AliasActions aliasAction = IndicesAliasesRequest.AliasActions.add() .index(indexMapping.getIndexName(clusterAlias)) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts index 5bb30ed850f..510ba93cfc9 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts @@ -19,14 +19,12 @@ import { PipelineClass } from '../../support/entity/PipelineClass'; import { SearchIndexClass } from '../../support/entity/SearchIndexClass'; import { TableClass } from '../../support/entity/TableClass'; import { TopicClass } from '../../support/entity/TopicClass'; -import { UserClass } from '../../support/user/UserClass'; -import { performAdminLogin } from '../../utils/admin'; import { + createNewPage, getEntityTypeSearchIndexMapping, redirectToHomePage, } from '../../utils/common'; import { checkDataAssetWidget } from '../../utils/entity'; -import { performUserLogin } from '../../utils/user'; const entities = [ TableClass, @@ -48,20 +46,20 @@ const menuLabel = { SearchIndex: 'search Search Indexes', }; +// use the admin user to login +test.use({ storageState: 'playwright/.auth/admin.json' }); + entities.forEach((EntityClass) => { - const user = new UserClass(); const entity = new EntityClass(); test.describe(entity.getType(), () => { test.beforeAll('Setup pre-requests', async ({ browser }) => { - const { apiContext, afterAction } = await performAdminLogin(browser); - await user.create(apiContext); + const { apiContext, afterAction } = await createNewPage(browser); await entity.create(apiContext); await afterAction(); }); - test('Check Data Asset and Service Filtration', async ({ browser }) => { - const { page, afterAction } = await performUserLogin(browser, user); + test('Check Data Asset and Service Filtration', async ({ page }) => { await redirectToHomePage(page); await checkDataAssetWidget( page, @@ -69,12 +67,10 @@ entities.forEach((EntityClass) => { getEntityTypeSearchIndexMapping(entity.type), toLower(entity.service.serviceType) ); - await afterAction(); }); test.afterAll('Cleanup', async ({ browser }) => { - const { apiContext, afterAction } = await performAdminLogin(browser); - await user.delete(apiContext); + const { apiContext, afterAction } = await createNewPage(browser); await entity.delete(apiContext); await afterAction(); }); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiDocs.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiDocs.spec.ts index ae8a898be5e..d17f3a1af9c 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiDocs.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiDocs.spec.ts @@ -27,7 +27,7 @@ test.describe('API docs should work properly', () => { await expect( page.getByRole('link', { - name: 'openmetadata-dev@googlegroups.com', + name: 'openmetadata-dev@googlegroups', }) ).toBeVisible(); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts index 33fa03350e1..9c01069c4c0 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts @@ -1202,8 +1202,6 @@ export const checkDataAssetWidget = async ( index: string, serviceType: string ) => { - await page.click('[data-testid="welcome-screen-close-btn"]'); - const quickFilterResponse = page.waitForResponse( `/api/v1/search/query?q=&index=dataAsset*${serviceType}*` );