mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 04:14:34 +00:00
fix: dynamic assertion to create json (#16865)
This commit is contained in:
parent
65ba2d19ac
commit
f766ba872d
@ -79,7 +79,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
||||
private static final String UPDATE_FIELDS =
|
||||
"owner,entityLink,testSuite,testSuites,testDefinition";
|
||||
private static final String PATCH_FIELDS =
|
||||
"owner,entityLink,testSuite,testDefinition,computePassedFailedRowCount";
|
||||
"owner,entityLink,testSuite,testDefinition,computePassedFailedRowCount,useDynamicAssertion";
|
||||
public static final String TESTCASE_RESULT_EXTENSION = "testCase.testCaseResult";
|
||||
public static final String FAILED_ROWS_SAMPLE_EXTENSION = "testCase.failedRowsSample";
|
||||
|
||||
@ -972,6 +972,10 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
||||
"computePassedFailedRowCount",
|
||||
original.getComputePassedFailedRowCount(),
|
||||
updated.getComputePassedFailedRowCount());
|
||||
recordChange(
|
||||
"useDynamicAssertion",
|
||||
original.getUseDynamicAssertion(),
|
||||
updated.getUseDynamicAssertion());
|
||||
recordChange("testCaseResult", original.getTestCaseResult(), updated.getTestCaseResult());
|
||||
}
|
||||
}
|
||||
|
@ -1175,6 +1175,7 @@ public class TestCaseResource extends EntityResource<TestCase, TestCaseRepositor
|
||||
.withParameterValues(create.getParameterValues())
|
||||
.withEntityLink(create.getEntityLink())
|
||||
.withComputePassedFailedRowCount(create.getComputePassedFailedRowCount())
|
||||
.withUseDynamicAssertion(create.getUseDynamicAssertion())
|
||||
.withEntityFQN(entityLink.getFullyQualifiedFieldValue())
|
||||
.withTestSuite(getEntityReference(Entity.TEST_SUITE, create.getTestSuite()))
|
||||
.withTestDefinition(getEntityReference(Entity.TEST_DEFINITION, create.getTestDefinition()));
|
||||
|
@ -2652,6 +2652,18 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
|
||||
() -> createEntity(request3, ADMIN_AUTH_HEADERS), BAD_REQUEST, "name must match");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createUpdate_DynamicAssertionTests(TestInfo testInfo) throws IOException {
|
||||
CreateTestCase create = createRequest(testInfo).withUseDynamicAssertion(true);
|
||||
TestCase testCase = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
||||
testCase = getTestCase(testCase.getFullyQualifiedName(), ADMIN_AUTH_HEADERS);
|
||||
assertTrue(testCase.getUseDynamicAssertion());
|
||||
CreateTestCase update = create.withUseDynamicAssertion(false);
|
||||
updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
||||
testCase = getTestCase(testCase.getFullyQualifiedName(), ADMIN_AUTH_HEADERS);
|
||||
assertFalse(testCase.getUseDynamicAssertion());
|
||||
}
|
||||
|
||||
private void putInspectionQuery(TestCase testCase, String sql, Map<String, String> authHeaders)
|
||||
throws IOException {
|
||||
TestCase putResponse = putInspectionQuery(testCase.getId(), sql, authHeaders);
|
||||
|
@ -44,6 +44,11 @@
|
||||
"description": "Compute the passed and failed row count for the test case.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"useDynamicAssertion": {
|
||||
"description": "If the test definition supports it, use dynamic assertion to evaluate the test case.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"required": ["name", "testDefinition", "entityLink", "testSuite"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user