Skip to content

Commit

Permalink
Merge branch 'main' into feature/update-elasticsearch-version
Browse files Browse the repository at this point in the history
  • Loading branch information
kuma0128 authored Oct 15, 2024
2 parents 08d0d81 + c6586d3 commit 9c7b263
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public void setFields(TestSuite entity, EntityUtil.Fields fields) {
public void setInheritedFields(TestSuite testSuite, EntityUtil.Fields fields) {
if (Boolean.TRUE.equals(testSuite.getExecutable())) {
Table table =
Entity.getEntity(TABLE, testSuite.getExecutableEntityReference().getId(), "owners", ALL);
Entity.getEntity(
TABLE, testSuite.getExecutableEntityReference().getId(), "owners,domain", ALL);
inheritOwners(testSuite, fields, table);
inheritDomain(testSuite, fields, table);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ public ResultList<TestSuite> listFromSearch(
@QueryParam("includeEmptyTestSuites")
@DefaultValue("true")
Boolean includeEmptyTestSuites,
@Parameter(description = "Filter a test suite by domain.", schema = @Schema(type = "string"))
@QueryParam("domain")
String domain,
@Parameter(
description = "Filter a test suite by fully qualified name.",
schema = @Schema(type = "string"))
Expand Down Expand Up @@ -283,6 +286,7 @@ public ResultList<TestSuite> listFromSearch(
searchListFilter.addQueryParam("includeEmptyTestSuites", includeEmptyTestSuites);
searchListFilter.addQueryParam("fullyQualifiedName", fullyQualifiedName);
searchListFilter.addQueryParam("excludeFields", SEARCH_FIELDS_EXCLUDE);
searchListFilter.addQueryParam("domain", domain);
if (!nullOrEmpty(owner)) {
EntityInterface entity;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
import static org.openmetadata.service.util.TestUtils.LONG_ENTITY_NAME;
import static org.openmetadata.service.util.TestUtils.assertListNotNull;
Expand Down Expand Up @@ -274,6 +275,38 @@ void test_inheritOwnerFromTable(TestInfo test) throws IOException {
assertOwners(table.getOwners(), testSuite.getOwners());
}

@Test
void test_inheritDomainFromTable(TestInfo test) throws IOException {
TableResourceTest tableResourceTest = new TableResourceTest();
CreateTable tableReq =
tableResourceTest
.createRequest(test)
.withColumns(
List.of(
new Column()
.withName(C1)
.withDisplayName("c1")
.withDataType(ColumnDataType.VARCHAR)
.withDataLength(10)))
.withDomain(DOMAIN1.getFullyQualifiedName());
Table table = tableResourceTest.createEntity(tableReq, ADMIN_AUTH_HEADERS);
table = tableResourceTest.getEntity(table.getId(), "*", ADMIN_AUTH_HEADERS);
CreateTestSuite createExecutableTestSuite = createRequest(table.getFullyQualifiedName());
TestSuite executableTestSuite =
createExecutableTestSuite(createExecutableTestSuite, ADMIN_AUTH_HEADERS);
TestSuite testSuite = getEntity(executableTestSuite.getId(), "domain", ADMIN_AUTH_HEADERS);
assertEquals(DOMAIN1.getId(), testSuite.getDomain().getId());
ResultList<TestSuite> testSuites =
listEntitiesFromSearch(
Map.of("domain", DOMAIN1.getFullyQualifiedName(), "fields", "domain"),
100,
0,
ADMIN_AUTH_HEADERS);
assertTrue(
testSuites.getData().stream()
.allMatch(ts -> ts.getDomain().getId().equals(DOMAIN1.getId())));
}

@Test
void post_createLogicalTestSuiteAndAddTests_200(TestInfo test) throws IOException {
TestCaseResourceTest testCaseResourceTest = new TestCaseResourceTest();
Expand Down

0 comments on commit 9c7b263

Please sign in to comment.