mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-11 10:36:54 +00:00
TestCase Result feed fix for activity feed and webhook (#7166)
* [Backend][Settings] Settings through UI [WIP] * [Backend][Settings] Settings through UI - eventFilter [WIP] * [Backend][Settings] Added api to allow see create request format * [Backend][Settings] JAva checkstyle * [Backend][Settings] Added Filters and db changes * [Backend][Settings] Postgres Fix * [Backend][Settings] Add New Filter * [Backend][Settings] Created Common Filters * [Backend][Settings] Fix Webhook Resources Test for failing * [Backend][Settings] Updated models so as to allow consumers to get the schemas properly * [Backend][Settings] Fix merge issues * [Backend][Settings] Fixes for UT * [Backend][Settings] Fixes for UT * [Backend][Settings] Updated to add wildcard filtering * [Backend][Settings] Java style fix * [Backend][Settings] Failing WebhookRes Fix * [Backend][Settings] Fix Style * [Backend][Settings] added softdelete * [Frontend][Settings] Skip test for now AddWebhook * [Backend][Settings] Merge Conflict fix * [Backend][Settings] Simplified Filters, added auto updating filter using scheduled thread * [Backend][Settings] typo * [Backend][Settings] review fix * [Backend][Settings] review fix - review wildcard imports * [Backend][Settings] Java checkstyle * [Backend][Settings] Fixed failing test * [Backend][Settings] Fixed failing test for Pipleine, MlModel * [Backend][Settings] Fixed Feed util test * Updated update time to 5 mins * Fix * checkstyle fix * fixed ui test mock data * fixed ui side changes for webhook filters * fix conflicts * fix corner scenario * added caching * migrate table changes to new sql * fix unused issue * Adding bootstrapped filters * Adding bootstrapped filters * failing ui * removed kafka from webhook, fixed model on ui side * Added basic filters to all entities * fix sonar checks failing * [UI] added enums for entityType and FieldTypes * update as per new api schema * Deleted commented file added test Case result to enabled OOB * Updated TestCase Message Display on Feed Slack and Teams Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
73b04d9363
commit
959d0df537
@ -159,6 +159,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
||||
setFields(testCase, EntityUtil.Fields.EMPTY_FIELDS);
|
||||
}
|
||||
|
||||
setFields(testCase, new EntityUtil.Fields(allowedFields, "testSuite"));
|
||||
ChangeDescription change =
|
||||
addTestCaseChangeDescription(testCase.getVersion(), testCaseResult, storedTestCaseResult);
|
||||
ChangeEvent changeEvent = getChangeEvent(testCase, change, entityType, testCase.getVersion());
|
||||
|
@ -16,6 +16,7 @@ package org.openmetadata.catalog.util;
|
||||
import static org.openmetadata.catalog.Entity.FIELD_DISPLAY_NAME;
|
||||
import static org.openmetadata.catalog.Entity.FIELD_NAME;
|
||||
import static org.openmetadata.catalog.Entity.FIELD_OWNER;
|
||||
import static org.openmetadata.catalog.Entity.TEST_CASE;
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
|
||||
import com.github.difflib.text.DiffRow;
|
||||
@ -42,6 +43,8 @@ import org.openmetadata.catalog.resources.feeds.MessageParser.EntityLink;
|
||||
import org.openmetadata.catalog.slack.SlackAttachment;
|
||||
import org.openmetadata.catalog.slack.SlackMessage;
|
||||
import org.openmetadata.catalog.slack.TeamsMessage;
|
||||
import org.openmetadata.catalog.tests.TestCase;
|
||||
import org.openmetadata.catalog.tests.type.TestCaseResult;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.ChangeEvent;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -243,7 +246,10 @@ public final class ChangeEventParser {
|
||||
String newFieldValue = getFieldValue(field.getNewValue());
|
||||
String oldFieldValue = getFieldValue(field.getOldValue());
|
||||
EntityLink link = getEntityLink(fieldName, entity);
|
||||
if (!fieldName.equals("failureDetails")) {
|
||||
if (link.getEntityType().equals(TEST_CASE) && link.getFieldName().equals("testCaseResult")) {
|
||||
String message = handleTestCaseResult(publishTo, entity, link, field.getOldValue(), field.getNewValue());
|
||||
messages.put(link, message);
|
||||
} else if (!fieldName.equals("failureDetails")) {
|
||||
String message = createMessageForField(publishTo, link, changeType, fieldName, oldFieldValue, newFieldValue);
|
||||
messages.put(link, message);
|
||||
}
|
||||
@ -492,6 +498,31 @@ public final class ChangeEventParser {
|
||||
return getPlainTextUpdateMessage(publishTo, updatedField, oldValue.toString(), newValue.toString());
|
||||
}
|
||||
|
||||
public static String handleTestCaseResult(
|
||||
PUBLISH_TO publishTo, EntityInterface entity, EntityLink link, Object oldValue, Object newValue) {
|
||||
String testCaseName = entity.getName();
|
||||
TestCaseResult result = (TestCaseResult) newValue;
|
||||
TestCase testCaseEntity = (TestCase) entity;
|
||||
if (result != null) {
|
||||
String format =
|
||||
String.format(
|
||||
"Test Case %s is %s in %s/%s",
|
||||
getBold(publishTo),
|
||||
getBold(publishTo),
|
||||
EntityLink.parse(testCaseEntity.getEntityLink()).getEntityFQN(),
|
||||
testCaseEntity.getTestSuite().getName());
|
||||
return String.format(format, testCaseName, result.getTestCaseStatus());
|
||||
} else {
|
||||
String format =
|
||||
String.format(
|
||||
"Test Case %s is updated in %s/%s",
|
||||
getBold(publishTo),
|
||||
EntityLink.parse(testCaseEntity.getEntityLink()).getEntityFQN(),
|
||||
testCaseEntity.getTestSuite().getName());
|
||||
return String.format(format, testCaseName);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getPlaintextDiff(PUBLISH_TO publishTo, String oldValue, String newValue) {
|
||||
// create a configured DiffRowGenerator
|
||||
String addMarker = FEED_ADD_MARKER;
|
||||
|
Loading…
x
Reference in New Issue
Block a user