mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	[MINOR] test case listing with prefix (#16382)
* fix: test case listing with prefix * fix: domain filtering * added cypress for domain and data quality filters --------- Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
This commit is contained in:
		
							parent
							
								
									8deed33150
								
							
						
					
					
						commit
						5555c3db88
					
				| @ -90,7 +90,8 @@ public class SearchListFilter extends Filter<SearchListFilter> { | |||||||
|   private String getIncludeCondition() { |   private String getIncludeCondition() { | ||||||
|     String domain = getQueryParam("domain"); |     String domain = getQueryParam("domain"); | ||||||
|     if (!nullOrEmpty(domain)) { |     if (!nullOrEmpty(domain)) { | ||||||
|       return String.format("{\"term\": {\"domain.fullyQualifiedName\": \"%s\"}}", domain); |       return String.format( | ||||||
|  |           "{\"term\": {\"domain.fullyQualifiedName\": \"%s\"}}", escapeDoubleQuotes(domain)); | ||||||
|     } |     } | ||||||
|     return ""; |     return ""; | ||||||
|   } |   } | ||||||
| @ -142,7 +143,10 @@ public class SearchListFilter extends Filter<SearchListFilter> { | |||||||
|       conditions.add( |       conditions.add( | ||||||
|           includeAllTests |           includeAllTests | ||||||
|               ? String.format( |               ? String.format( | ||||||
|                   "{\"prefix\": {\"entityFQN\": \"%s\"}}", escapeDoubleQuotes(entityFQN)) |                   "{\"bool\":{\"should\": [" | ||||||
|  |                       + "{\"prefix\": {\"entityFQN\": \"%s%s\"}}," | ||||||
|  |                       + "{\"term\": {\"entityFQN\": \"%s\"}}]}}", | ||||||
|  |                   escapeDoubleQuotes(entityFQN), Entity.SEPARATOR, escapeDoubleQuotes(entityFQN)) | ||||||
|               : String.format( |               : String.format( | ||||||
|                   "{\"term\": {\"entityFQN\": \"%s\"}}", escapeDoubleQuotes(entityFQN))); |                   "{\"term\": {\"entityFQN\": \"%s\"}}", escapeDoubleQuotes(entityFQN))); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -54,7 +54,6 @@ import org.openmetadata.schema.tests.TestSuite; | |||||||
| import org.openmetadata.schema.type.ChangeDescription; | import org.openmetadata.schema.type.ChangeDescription; | ||||||
| import org.openmetadata.schema.type.EntityReference; | import org.openmetadata.schema.type.EntityReference; | ||||||
| import org.openmetadata.schema.type.FieldChange; | import org.openmetadata.schema.type.FieldChange; | ||||||
| import org.openmetadata.schema.type.Include; |  | ||||||
| import org.openmetadata.schema.type.TagLabel; | import org.openmetadata.schema.type.TagLabel; | ||||||
| import org.openmetadata.schema.type.UsageDetails; | import org.openmetadata.schema.type.UsageDetails; | ||||||
| import org.openmetadata.service.Entity; | import org.openmetadata.service.Entity; | ||||||
| @ -359,10 +358,6 @@ public class SearchRepository { | |||||||
|             || entityType.equalsIgnoreCase(Entity.STORAGE_SERVICE) |             || entityType.equalsIgnoreCase(Entity.STORAGE_SERVICE) | ||||||
|             || entityType.equalsIgnoreCase(Entity.SEARCH_SERVICE)) { |             || entityType.equalsIgnoreCase(Entity.SEARCH_SERVICE)) { | ||||||
|           parentMatch = new ImmutablePair<>("service.id", entityId); |           parentMatch = new ImmutablePair<>("service.id", entityId); | ||||||
|         } else if (entityType.equalsIgnoreCase(Entity.TABLE)) { |  | ||||||
|           EntityInterface entity = |  | ||||||
|               Entity.getEntity(entityType, UUID.fromString(entityId), "", Include.ALL); |  | ||||||
|           parentMatch = new ImmutablePair<>("entityFQN", entity.getFullyQualifiedName()); |  | ||||||
|         } else { |         } else { | ||||||
|           parentMatch = new ImmutablePair<>(entityType + ".id", entityId); |           parentMatch = new ImmutablePair<>(entityType + ".id", entityId); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -710,9 +710,21 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes | |||||||
|     List<TestCase> testCases = new ArrayList<>(); |     List<TestCase> testCases = new ArrayList<>(); | ||||||
| 
 | 
 | ||||||
|     for (int i = 0; i < tablesNum; i++) { |     for (int i = 0; i < tablesNum; i++) { | ||||||
|       CreateTable tableReq = |       CreateTable tableReq; | ||||||
|           tableResourceTest |       // Add entity FQN with same prefix to validate listing | ||||||
|               .createRequest(testInfo, i) |       // with AllTest=true returns all columns and table test for the | ||||||
|  |       // specific entityFQN (and does not include tests from the other entityFQN | ||||||
|  |       // witgh the same prefix | ||||||
|  |       if (i == 0) { | ||||||
|  |         tableReq = tableResourceTest.createRequest("test_getSimplelistFromSearch"); | ||||||
|  |         tableReq.getName(); | ||||||
|  |       } else if (i == 1) { | ||||||
|  |         tableReq = tableResourceTest.createRequest("test_getSimplelistFromSearch_a"); | ||||||
|  |         tableReq.getName(); | ||||||
|  |       } else { | ||||||
|  |         tableReq = tableResourceTest.createRequest(testInfo, i); | ||||||
|  |       } | ||||||
|  |       tableReq | ||||||
|           .withDatabaseSchema(DATABASE_SCHEMA.getFullyQualifiedName()) |           .withDatabaseSchema(DATABASE_SCHEMA.getFullyQualifiedName()) | ||||||
|           .withColumns( |           .withColumns( | ||||||
|               List.of( |               List.of( | ||||||
| @ -764,11 +776,11 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes | |||||||
|     ResultList<TestCase> allEntities = |     ResultList<TestCase> allEntities = | ||||||
|         listEntitiesFromSearch(queryParams, testCasesNum, 0, ADMIN_AUTH_HEADERS); |         listEntitiesFromSearch(queryParams, testCasesNum, 0, ADMIN_AUTH_HEADERS); | ||||||
|     assertEquals(testCasesNum, allEntities.getData().size()); |     assertEquals(testCasesNum, allEntities.getData().size()); | ||||||
|     queryParams.put("q", "test_getSimplelistFromSearcha"); |     queryParams.put("q", "test_getSimplelistFromSearchc"); | ||||||
|     allEntities = listEntitiesFromSearch(queryParams, testCasesNum, 0, ADMIN_AUTH_HEADERS); |     allEntities = listEntitiesFromSearch(queryParams, testCasesNum, 0, ADMIN_AUTH_HEADERS); | ||||||
|     assertEquals(1, allEntities.getData().size()); |     assertEquals(1, allEntities.getData().size()); | ||||||
|     org.assertj.core.api.Assertions.assertThat(allEntities.getData().get(0).getName()) |     org.assertj.core.api.Assertions.assertThat(allEntities.getData().get(0).getName()) | ||||||
|         .contains("test_getSimplelistFromSearcha"); |         .contains("test_getSimplelistFromSearchc"); | ||||||
| 
 | 
 | ||||||
|     queryParams.clear(); |     queryParams.clear(); | ||||||
|     queryParams.put("entityLink", testCaseForEL.getEntityLink()); |     queryParams.put("entityLink", testCaseForEL.getEntityLink()); | ||||||
|  | |||||||
| @ -11,6 +11,7 @@ | |||||||
|  *  limitations under the License. |  *  limitations under the License. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | import { isArray } from 'lodash'; | ||||||
| import { | import { | ||||||
|   DASHBOARD_SERVICE_DETAILS, |   DASHBOARD_SERVICE_DETAILS, | ||||||
|   DATABASE_DETAILS, |   DATABASE_DETAILS, | ||||||
| @ -68,6 +69,8 @@ export const createEntityTable = ({ | |||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   // Create Database Schema
 |   // Create Database Schema
 | ||||||
|  |   const schemaData = isArray(schema) ? schema : [schema]; | ||||||
|  |   schemaData.map((schema) => { | ||||||
|     cy.request({ |     cy.request({ | ||||||
|       method: 'POST', |       method: 'POST', | ||||||
|       url: `/api/v1/databaseSchemas`, |       url: `/api/v1/databaseSchemas`, | ||||||
| @ -78,6 +81,7 @@ export const createEntityTable = ({ | |||||||
| 
 | 
 | ||||||
|       createdEntityIds.databaseSchemaId = response.body.id; |       createdEntityIds.databaseSchemaId = response.body.id; | ||||||
|     }); |     }); | ||||||
|  |   }); | ||||||
| 
 | 
 | ||||||
|   tables.forEach((body) => { |   tables.forEach((body) => { | ||||||
|     cy.request({ |     cy.request({ | ||||||
| @ -144,19 +148,20 @@ export const hardDeleteService = ({ serviceFqn, token, serviceType }) => { | |||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const generateRandomTable = ( | export const generateRandomTable = (data?: { | ||||||
|   tableName?: string, |   tableName?: string; | ||||||
|   columns?: ColumnType[] |   columns?: ColumnType[]; | ||||||
| ) => { |   databaseSchema?: string; | ||||||
|  | }) => { | ||||||
|   const id = uuid(); |   const id = uuid(); | ||||||
|   const name = tableName ?? `cypress-table-${id}`; |   const name = data?.tableName ?? `cypress-table-${id}`; | ||||||
| 
 | 
 | ||||||
|   const table = { |   const table = { | ||||||
|     name, |     name, | ||||||
|     description: `cypress-table-description-${id}`, |     description: `cypress-table-description-${id}`, | ||||||
|     displayName: name, |     displayName: name, | ||||||
|     columns: [ |     columns: [ | ||||||
|       ...(columns ?? []), |       ...(data?.columns ?? []), | ||||||
|       { |       { | ||||||
|         name: `cypress-column-${id}`, |         name: `cypress-column-${id}`, | ||||||
|         description: `cypress-column-description-${id}`, |         description: `cypress-column-description-${id}`, | ||||||
| @ -164,7 +169,9 @@ export const generateRandomTable = ( | |||||||
|         dataTypeDisplay: 'numeric', |         dataTypeDisplay: 'numeric', | ||||||
|       }, |       }, | ||||||
|     ], |     ], | ||||||
|     databaseSchema: `${DATABASE_SERVICE_DETAILS.name}.${DATABASE_DETAILS.name}.${SCHEMA_DETAILS.name}`, |     databaseSchema: | ||||||
|  |       data?.databaseSchema ?? | ||||||
|  |       `${DATABASE_SERVICE_DETAILS.name}.${DATABASE_DETAILS.name}.${SCHEMA_DETAILS.name}`, | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   return table; |   return table; | ||||||
|  | |||||||
| @ -12,10 +12,14 @@ | |||||||
|  */ |  */ | ||||||
| import { uuid } from '../../constants/constants'; | import { uuid } from '../../constants/constants'; | ||||||
| import { EntityType } from '../../constants/Entity.interface'; | import { EntityType } from '../../constants/Entity.interface'; | ||||||
| import { DATABASE_SERVICE } from '../../constants/EntityConstant'; | import { | ||||||
|  |   DATABASE_DETAILS, | ||||||
|  |   DATABASE_SERVICE, | ||||||
|  |   DATABASE_SERVICE_DETAILS, | ||||||
|  | } from '../../constants/EntityConstant'; | ||||||
| import { interceptURL, verifyResponseStatusCode } from '../common'; | import { interceptURL, verifyResponseStatusCode } from '../common'; | ||||||
| import { generateRandomTable } from '../EntityUtils'; | import { generateRandomTable } from '../EntityUtils'; | ||||||
| import { visitEntityDetailsPage } from './Entity'; | import { createEntityViaREST, visitEntityDetailsPage } from './Entity'; | ||||||
| 
 | 
 | ||||||
| const tableFqn = `${DATABASE_SERVICE.entity.databaseSchema}.${DATABASE_SERVICE.entity.name}`; | const tableFqn = `${DATABASE_SERVICE.entity.databaseSchema}.${DATABASE_SERVICE.entity.name}`; | ||||||
| 
 | 
 | ||||||
| @ -40,33 +44,63 @@ const testCase2 = { | |||||||
|   testDefinition: 'columnValuesToBeInSet', |   testDefinition: 'columnValuesToBeInSet', | ||||||
|   testSuite: testSuite.name, |   testSuite: testSuite.name, | ||||||
| }; | }; | ||||||
| const filterTable = generateRandomTable(); | const filterTableName = `cypress-table-${uuid()}`; | ||||||
| const customTable = generateRandomTable(`cypress-table-${uuid()}-COLUMN`, [ | const testSchema = { | ||||||
|  |   name: `cy-database-schema-${uuid()}`, | ||||||
|  |   database: `${DATABASE_SERVICE_DETAILS.name}.${DATABASE_DETAILS.name}`, | ||||||
|  | }; | ||||||
|  | const filterTable = generateRandomTable({ tableName: filterTableName }); | ||||||
|  | const filterTable2 = generateRandomTable({ | ||||||
|  |   tableName: `${filterTableName}-model`, | ||||||
|  | }); | ||||||
|  | const customTable = generateRandomTable({ | ||||||
|  |   tableName: `cypress-table-${uuid()}-COLUMN`, | ||||||
|  |   columns: [ | ||||||
|     { |     { | ||||||
|       name: `user_id`, |       name: `user_id`, | ||||||
|       description: `cypress-column-description`, |       description: `cypress-column-description`, | ||||||
|       dataType: 'STRING', |       dataType: 'STRING', | ||||||
|       dataTypeDisplay: 'string', |       dataTypeDisplay: 'string', | ||||||
|     }, |     }, | ||||||
| ]); |   ], | ||||||
|  | }); | ||||||
| 
 | 
 | ||||||
| const filterTableFqn = `${filterTable.databaseSchema}.${filterTable.name}`; | const filterTableFqn = `${filterTable.databaseSchema}.${filterTable.name}`; | ||||||
| const filterTableTestSuite = { | const filterTableTestSuite = { | ||||||
|   name: `${filterTableFqn}.testSuite`, |   name: `${filterTableFqn}.testSuite`, | ||||||
|   executableEntityReference: filterTableFqn, |   executableEntityReference: filterTableFqn, | ||||||
| }; | }; | ||||||
|  | const filterTableFqn2 = `${filterTable2.databaseSchema}.${filterTable2.name}`; | ||||||
|  | const filterTableTestSuite2 = { | ||||||
|  |   name: `${filterTableFqn2}.testSuite`, | ||||||
|  |   executableEntityReference: filterTableFqn2, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| const testCases = [ | const testCases = [ | ||||||
|   `cy_first_table_column_count_to_be_between_${uuid()}`, |   `cy_first_table_column_count_to_be_between_${uuid()}`, | ||||||
|   `cy_second_table_column_count_to_be_between_${uuid()}`, |   `cy_second_table_column_count_to_be_between_${uuid()}`, | ||||||
|   `cy_third_table_column_count_to_be_between_${uuid()}`, |   `cy_third_table_column_count_to_be_between_${uuid()}`, | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
|  | const smilerNameTestCase = testCases.map((test) => `${test}_version_2`); | ||||||
|  | 
 | ||||||
|  | export const domainDetails1 = { | ||||||
|  |   name: `Cypress%Domain.${uuid()}`, | ||||||
|  |   description: 'Cypress domain description', | ||||||
|  |   domainType: 'Aggregate', | ||||||
|  |   experts: [], | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| export const DATA_QUALITY_TEST_CASE_DATA = { | export const DATA_QUALITY_TEST_CASE_DATA = { | ||||||
|   testCase1, |   testCase1, | ||||||
|   testCase2, |   testCase2, | ||||||
|   filterTable, |   filterTable, | ||||||
|  |   filterTable2, | ||||||
|   customTable, |   customTable, | ||||||
|  |   testSchema, | ||||||
|   filterTableTestCases: testCases, |   filterTableTestCases: testCases, | ||||||
|  |   filterTable2TestCases: smilerNameTestCase, | ||||||
|  |   domainDetail: domainDetails1, | ||||||
| }; | }; | ||||||
| // it will run 6 time with given wait time -> [20000, 10000, 5000, 2500, 1250, 625]
 | // it will run 6 time with given wait time -> [20000, 10000, 5000, 2500, 1250, 625]
 | ||||||
| const verifyPipelineSuccessStatus = (time = 20000) => { | const verifyPipelineSuccessStatus = (time = 20000) => { | ||||||
| @ -146,7 +180,78 @@ export const triggerTestCasePipeline = ({ | |||||||
|   verifyPipelineSuccessStatus(); |   verifyPipelineSuccessStatus(); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | const prepareDataQualityTestCasesViaREST = ({ | ||||||
|  |   testSuite, | ||||||
|  |   token, | ||||||
|  |   testCases, | ||||||
|  |   tableName, | ||||||
|  |   serviceName, | ||||||
|  | }) => { | ||||||
|  |   cy.request({ | ||||||
|  |     method: 'POST', | ||||||
|  |     url: `/api/v1/dataQuality/testSuites/executable`, | ||||||
|  |     headers: { Authorization: `Bearer ${token}` }, | ||||||
|  |     body: testSuite, | ||||||
|  |   }).then((testSuiteResponse) => { | ||||||
|  |     // creating test case
 | ||||||
|  | 
 | ||||||
|  |     testCases.forEach((testCase) => { | ||||||
|  |       cy.request({ | ||||||
|  |         method: 'POST', | ||||||
|  |         url: `/api/v1/dataQuality/testCases`, | ||||||
|  |         headers: { Authorization: `Bearer ${token}` }, | ||||||
|  |         body: { | ||||||
|  |           name: testCase, | ||||||
|  |           entityLink: `<#E::table::${testSuite.executableEntityReference}>`, | ||||||
|  |           parameterValues: [ | ||||||
|  |             { name: 'minColValue', value: 12 }, | ||||||
|  |             { name: 'maxColValue', value: 24 }, | ||||||
|  |           ], | ||||||
|  |           testDefinition: 'tableColumnCountToBeBetween', | ||||||
|  |           testSuite: testSuite.name, | ||||||
|  |         }, | ||||||
|  |       }); | ||||||
|  |     }); | ||||||
|  |     cy.request({ | ||||||
|  |       method: 'POST', | ||||||
|  |       url: `/api/v1/services/ingestionPipelines`, | ||||||
|  |       headers: { Authorization: `Bearer ${token}` }, | ||||||
|  |       body: { | ||||||
|  |         airflowConfig: {}, | ||||||
|  |         name: `${testSuite.executableEntityReference}_test_suite`, | ||||||
|  |         pipelineType: 'TestSuite', | ||||||
|  |         service: { | ||||||
|  |           id: testSuiteResponse.body.id, | ||||||
|  |           type: 'testSuite', | ||||||
|  |         }, | ||||||
|  |         sourceConfig: { | ||||||
|  |           config: { | ||||||
|  |             type: 'TestSuite', | ||||||
|  |             entityFullyQualifiedName: testSuite.executableEntityReference, | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |     }).then((response) => | ||||||
|  |       cy.request({ | ||||||
|  |         method: 'POST', | ||||||
|  |         url: `/api/v1/services/ingestionPipelines/deploy/${response.body.id}`, | ||||||
|  |         headers: { Authorization: `Bearer ${token}` }, | ||||||
|  |       }) | ||||||
|  |     ); | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   triggerTestCasePipeline({ | ||||||
|  |     serviceName: serviceName, | ||||||
|  |     tableName: tableName, | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| export const prepareDataQualityTestCases = (token: string) => { | export const prepareDataQualityTestCases = (token: string) => { | ||||||
|  |   createEntityViaREST({ | ||||||
|  |     body: domainDetails1, | ||||||
|  |     endPoint: EntityType.Domain, | ||||||
|  |     token, | ||||||
|  |   }); | ||||||
|   cy.request({ |   cy.request({ | ||||||
|     method: 'POST', |     method: 'POST', | ||||||
|     url: `/api/v1/dataQuality/testSuites/executable`, |     url: `/api/v1/dataQuality/testSuites/executable`, | ||||||
| @ -194,62 +299,18 @@ export const prepareDataQualityTestCases = (token: string) => { | |||||||
|     ); |     ); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   cy.request({ |   prepareDataQualityTestCasesViaREST({ | ||||||
|     method: 'POST', |     testSuite: filterTableTestSuite, | ||||||
|     url: `/api/v1/dataQuality/testSuites/executable`, |     token, | ||||||
|     headers: { Authorization: `Bearer ${token}` }, |     testCases: testCases, | ||||||
|     body: filterTableTestSuite, |  | ||||||
|   }).then((testSuiteResponse) => { |  | ||||||
|     // creating test case
 |  | ||||||
| 
 |  | ||||||
|     testCases.forEach((testCase) => { |  | ||||||
|       cy.request({ |  | ||||||
|         method: 'POST', |  | ||||||
|         url: `/api/v1/dataQuality/testCases`, |  | ||||||
|         headers: { Authorization: `Bearer ${token}` }, |  | ||||||
|         body: { |  | ||||||
|           name: testCase, |  | ||||||
|           entityLink: `<#E::table::${filterTableTestSuite.executableEntityReference}>`, |  | ||||||
|           parameterValues: [ |  | ||||||
|             { name: 'minColValue', value: 12 }, |  | ||||||
|             { name: 'maxColValue', value: 24 }, |  | ||||||
|           ], |  | ||||||
|           testDefinition: 'tableColumnCountToBeBetween', |  | ||||||
|           testSuite: filterTableTestSuite.name, |  | ||||||
|         }, |  | ||||||
|       }); |  | ||||||
|     }); |  | ||||||
|     cy.request({ |  | ||||||
|       method: 'POST', |  | ||||||
|       url: `/api/v1/services/ingestionPipelines`, |  | ||||||
|       headers: { Authorization: `Bearer ${token}` }, |  | ||||||
|       body: { |  | ||||||
|         airflowConfig: {}, |  | ||||||
|         name: `${filterTableTestSuite.executableEntityReference}_test_suite`, |  | ||||||
|         pipelineType: 'TestSuite', |  | ||||||
|         service: { |  | ||||||
|           id: testSuiteResponse.body.id, |  | ||||||
|           type: 'testSuite', |  | ||||||
|         }, |  | ||||||
|         sourceConfig: { |  | ||||||
|           config: { |  | ||||||
|             type: 'TestSuite', |  | ||||||
|             entityFullyQualifiedName: |  | ||||||
|               filterTableTestSuite.executableEntityReference, |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|       }, |  | ||||||
|     }).then((response) => |  | ||||||
|       cy.request({ |  | ||||||
|         method: 'POST', |  | ||||||
|         url: `/api/v1/services/ingestionPipelines/deploy/${response.body.id}`, |  | ||||||
|         headers: { Authorization: `Bearer ${token}` }, |  | ||||||
|       }) |  | ||||||
|     ); |  | ||||||
|   }); |  | ||||||
| 
 |  | ||||||
|   triggerTestCasePipeline({ |  | ||||||
|     serviceName: DATABASE_SERVICE.service.name, |  | ||||||
|     tableName: filterTable.name, |     tableName: filterTable.name, | ||||||
|  |     serviceName: DATABASE_SERVICE.service.name, | ||||||
|  |   }); | ||||||
|  |   prepareDataQualityTestCasesViaREST({ | ||||||
|  |     testSuite: filterTableTestSuite2, | ||||||
|  |     token, | ||||||
|  |     testCases: smilerNameTestCase, | ||||||
|  |     tableName: filterTable2.name, | ||||||
|  |     serviceName: DATABASE_SERVICE.service.name, | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ import { | |||||||
|   DATA_QUALITY_TEST_CASE_DATA, |   DATA_QUALITY_TEST_CASE_DATA, | ||||||
|   prepareDataQualityTestCases, |   prepareDataQualityTestCases, | ||||||
| } from '../../common/Utils/DataQuality'; | } from '../../common/Utils/DataQuality'; | ||||||
|  | import { addDomainToEntity } from '../../common/Utils/Domain'; | ||||||
| import { visitEntityDetailsPage } from '../../common/Utils/Entity'; | import { visitEntityDetailsPage } from '../../common/Utils/Entity'; | ||||||
| import { | import { | ||||||
|   handleIngestionRetry, |   handleIngestionRetry, | ||||||
| @ -48,8 +49,16 @@ import { GlobalSettingOptions } from '../../constants/settings.constant'; | |||||||
| 
 | 
 | ||||||
| const OWNER1 = 'Aaron Johnson'; | const OWNER1 = 'Aaron Johnson'; | ||||||
| const OWNER2 = 'Cynthia Meyer'; | const OWNER2 = 'Cynthia Meyer'; | ||||||
| const { testCase1, testCase2, filterTable, filterTableTestCases, customTable } = | const { | ||||||
|   DATA_QUALITY_TEST_CASE_DATA; |   testCase1, | ||||||
|  |   testCase2, | ||||||
|  |   filterTable, | ||||||
|  |   filterTable2, | ||||||
|  |   filterTableTestCases, | ||||||
|  |   filterTable2TestCases, | ||||||
|  |   customTable, | ||||||
|  |   domainDetail, | ||||||
|  | } = DATA_QUALITY_TEST_CASE_DATA; | ||||||
| const TEAM_ENTITY = customTable.name; | const TEAM_ENTITY = customTable.name; | ||||||
| const serviceName = DATABASE_SERVICE.service.name; | const serviceName = DATABASE_SERVICE.service.name; | ||||||
| const goToProfilerTab = (data?: { service: string; entityName: string }) => { | const goToProfilerTab = (data?: { service: string; entityName: string }) => { | ||||||
| @ -111,7 +120,12 @@ describe( | |||||||
|         createEntityTable({ |         createEntityTable({ | ||||||
|           token, |           token, | ||||||
|           ...DATABASE_SERVICE, |           ...DATABASE_SERVICE, | ||||||
|           tables: [DATABASE_SERVICE.entity, filterTable, customTable], |           tables: [ | ||||||
|  |             DATABASE_SERVICE.entity, | ||||||
|  |             filterTable, | ||||||
|  |             filterTable2, | ||||||
|  |             customTable, | ||||||
|  |           ], | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         prepareDataQualityTestCases(token); |         prepareDataQualityTestCases(token); | ||||||
| @ -982,11 +996,26 @@ describe( | |||||||
|         `/api/v1/dataQuality/testCases/search/list?*entityLink=*${filterTable.name}*`, |         `/api/v1/dataQuality/testCases/search/list?*entityLink=*${filterTable.name}*`, | ||||||
|         'searchTestCaseByTable' |         'searchTestCaseByTable' | ||||||
|       ); |       ); | ||||||
|  |       interceptURL( | ||||||
|  |         'GET', | ||||||
|  |         `/api/v1/search/query?q=*index=table_search_index*`, | ||||||
|  |         'searchTable' | ||||||
|  |       ); | ||||||
|       cy.get('#tableFqn').scrollIntoView().type(filterTable.name); |       cy.get('#tableFqn').scrollIntoView().type(filterTable.name); | ||||||
|       selectOptionFromDropdown(filterTable.name); |       verifyResponseStatusCode('@searchTable', 200); | ||||||
|  |       cy.get('.ant-select-dropdown') | ||||||
|  |         .not('.ant-select-dropdown-hidden') | ||||||
|  |         .find( | ||||||
|  |           `[data-testid="${filterTable.databaseSchema}.${filterTable.name}"]` | ||||||
|  |         ) | ||||||
|  |         .click({ force: true }); | ||||||
|       verifyResponseStatusCode('@searchTestCaseByTable', 200); |       verifyResponseStatusCode('@searchTestCaseByTable', 200); | ||||||
|       verifyFilterTestCase(); |       verifyFilterTestCase(); | ||||||
| 
 | 
 | ||||||
|  |       filterTable2TestCases.map((testCase) => { | ||||||
|  |         cy.get(`[data-testid="${testCase}"]`).should('not.exist'); | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|       // Test case filter by test type
 |       // Test case filter by test type
 | ||||||
|       interceptURL( |       interceptURL( | ||||||
|         'GET', |         'GET', | ||||||
| @ -1061,6 +1090,49 @@ describe( | |||||||
|       verifyFilterTestCase(); |       verifyFilterTestCase(); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     it('Filter with domain', () => { | ||||||
|  |       visitEntityDetailsPage({ | ||||||
|  |         term: filterTable.name, | ||||||
|  |         serviceName: serviceName, | ||||||
|  |         entity: EntityType.Table, | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|  |       addDomainToEntity(domainDetail.name); | ||||||
|  | 
 | ||||||
|  |       interceptURL( | ||||||
|  |         'GET', | ||||||
|  |         '/api/v1/dataQuality/testCases/search/list?*', | ||||||
|  |         'getTestCase' | ||||||
|  |       ); | ||||||
|  |       cy.get('[data-testid="domain-dropdown"]').click(); | ||||||
|  |       cy.get(`li[data-menu-id*='${domainDetail.name}']`).click(); | ||||||
|  |       cy.sidebarClick(SidebarItem.DATA_QUALITY); | ||||||
|  | 
 | ||||||
|  |       cy.get('[data-testid="by-test-cases"]').click(); | ||||||
|  |       verifyResponseStatusCode('@getTestCase', 200); | ||||||
|  | 
 | ||||||
|  |       cy.get('[data-testid="advanced-filter"]').click({ | ||||||
|  |         waitForAnimations: true, | ||||||
|  |       }); | ||||||
|  |       cy.get('[value="tableFqn"]').click({ waitForAnimations: true }); | ||||||
|  | 
 | ||||||
|  |       // Test case filter by table name
 | ||||||
|  |       interceptURL( | ||||||
|  |         'GET', | ||||||
|  |         `/api/v1/dataQuality/testCases/search/list?*entityLink=*${filterTable.name}*`, | ||||||
|  |         'searchTestCaseByTable' | ||||||
|  |       ); | ||||||
|  |       cy.get('#tableFqn').scrollIntoView().type(filterTable.name); | ||||||
|  |       cy.get('.ant-select-dropdown') | ||||||
|  |         .not('.ant-select-dropdown-hidden') | ||||||
|  |         .find( | ||||||
|  |           `[data-testid="${filterTable.databaseSchema}.${filterTable.name}"]` | ||||||
|  |         ) | ||||||
|  |         .click({ force: true }); | ||||||
|  |       verifyResponseStatusCode('@searchTestCaseByTable', 200); | ||||||
|  |       verifyFilterTestCase(); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it('Update profiler setting modal', () => { |     it('Update profiler setting modal', () => { | ||||||
|       const profilerSetting = { |       const profilerSetting = { | ||||||
|         profileSample: '60', |         profileSample: '60', | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ import { | |||||||
|   Row, |   Row, | ||||||
|   Select, |   Select, | ||||||
|   Space, |   Space, | ||||||
|  |   Typography, | ||||||
| } from 'antd'; | } from 'antd'; | ||||||
| import { useForm } from 'antd/lib/form/Form'; | import { useForm } from 'antd/lib/form/Form'; | ||||||
| import { ItemType } from 'antd/lib/menu/hooks/useItems'; | import { ItemType } from 'antd/lib/menu/hooks/useItems'; | ||||||
| @ -254,10 +255,24 @@ export const TestCases = ({ summaryPanel }: { summaryPanel: ReactNode }) => { | |||||||
|         includeFields: ['name', 'fullyQualifiedName', 'displayName'], |         includeFields: ['name', 'fullyQualifiedName', 'displayName'], | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|       const options = response.hits.hits.map((hit) => ({ |       const options = response.hits.hits.map((hit) => { | ||||||
|         label: getEntityName(hit._source), |         return { | ||||||
|  |           label: ( | ||||||
|  |             <Space | ||||||
|  |               data-testid={hit._source.fullyQualifiedName} | ||||||
|  |               direction="vertical" | ||||||
|  |               size={0}> | ||||||
|  |               <Typography.Text className="text-xs text-grey-muted"> | ||||||
|  |                 {hit._source.fullyQualifiedName} | ||||||
|  |               </Typography.Text> | ||||||
|  |               <Typography.Text className="text-sm"> | ||||||
|  |                 {getEntityName(hit._source)} | ||||||
|  |               </Typography.Text> | ||||||
|  |             </Space> | ||||||
|  |           ), | ||||||
|           value: hit._source.fullyQualifiedName, |           value: hit._source.fullyQualifiedName, | ||||||
|       })); |         }; | ||||||
|  |       }); | ||||||
|       setTableOptions(options); |       setTableOptions(options); | ||||||
|     } catch (error) { |     } catch (error) { | ||||||
|       setTableOptions([]); |       setTableOptions([]); | ||||||
| @ -341,7 +356,7 @@ export const TestCases = ({ summaryPanel }: { summaryPanel: ReactNode }) => { | |||||||
|             </Form.Item> |             </Form.Item> | ||||||
|             {selectedFilter.includes(TEST_CASE_FILTERS.table) && ( |             {selectedFilter.includes(TEST_CASE_FILTERS.table) && ( | ||||||
|               <Form.Item |               <Form.Item | ||||||
|                 className="m-0 w-52" |                 className="m-0 w-80" | ||||||
|                 label={t('label.table')} |                 label={t('label.table')} | ||||||
|                 name="tableFqn"> |                 name="tableFqn"> | ||||||
|                 <Select |                 <Select | ||||||
|  | |||||||
| @ -137,7 +137,9 @@ describe('DataQualityTab test', () => { | |||||||
| 
 | 
 | ||||||
|     expect(testName).toBeInTheDocument(); |     expect(testName).toBeInTheDocument(); | ||||||
|     expect(tableLink).toBeInTheDocument(); |     expect(tableLink).toBeInTheDocument(); | ||||||
|     expect(tableLink.textContent).toEqual('dim_address'); |     expect(tableLink.textContent).toEqual( | ||||||
|  |       'sample_data.ecommerce_db.shopify.dim_address' | ||||||
|  |     ); | ||||||
|     expect(columnName).toBeInTheDocument(); |     expect(columnName).toBeInTheDocument(); | ||||||
|     expect(editButton).toBeInTheDocument(); |     expect(editButton).toBeInTheDocument(); | ||||||
|     expect(deleteButton).toBeInTheDocument(); |     expect(deleteButton).toBeInTheDocument(); | ||||||
|  | |||||||
| @ -179,7 +179,6 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({ | |||||||
|               width: 150, |               width: 150, | ||||||
|               render: (entityLink: string) => { |               render: (entityLink: string) => { | ||||||
|                 const tableFqn = getEntityFQN(entityLink); |                 const tableFqn = getEntityFQN(entityLink); | ||||||
|                 const name = getNameFromFQN(tableFqn); |  | ||||||
| 
 | 
 | ||||||
|                 return ( |                 return ( | ||||||
|                   <Link |                   <Link | ||||||
| @ -195,7 +194,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({ | |||||||
|                       }), |                       }), | ||||||
|                     }} |                     }} | ||||||
|                     onClick={(e) => e.stopPropagation()}> |                     onClick={(e) => e.stopPropagation()}> | ||||||
|                     {name} |                     {tableFqn} | ||||||
|                   </Link> |                   </Link> | ||||||
|                 ); |                 ); | ||||||
|               }, |               }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Teddy
						Teddy