From 8e860a56bf98cf407c4d14faab994941a1f2a75e Mon Sep 17 00:00:00 2001 From: Aniket Katkar Date: Mon, 5 Feb 2024 22:54:29 +0530 Subject: [PATCH] Minor: Fix the wrong test result options on add observability alert page (#15043) * fix test result options * fix observability alert cypress test * Fix Filtering * fix naming order * ignore $ * Fix Alerts --------- Co-authored-by: mohitdeuex --- .../service/events/subscription/AlertUtil.java | 7 +++++++ .../service/events/subscription/AlertsRuleEvaluator.java | 2 +- .../json/data/EntityObservabilityFilterDescriptor.json | 6 +++--- .../ui/cypress/e2e/Flow/ObservabilityAlerts.spec.js | 2 +- .../src/main/resources/ui/src/utils/Alerts/AlertsUtil.tsx | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java index 1f412daca47..33f06644c67 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java @@ -15,6 +15,7 @@ package org.openmetadata.service.events.subscription; import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; +import static org.openmetadata.service.Entity.TEST_SUITE; import static org.openmetadata.service.Entity.THREAD; import static org.openmetadata.service.apps.bundles.changeEvent.AbstractEventConsumer.OFFSET_EXTENSION; import static org.openmetadata.service.security.policyevaluator.CompiledRule.parseExpression; @@ -116,6 +117,12 @@ public final class AlertUtil { return config.getResources().get(0).equalsIgnoreCase(thread.getType().value()); } + // Test Suite + if (config.getResources().get(0).equals(TEST_SUITE)) { + return event.getEntityType().equals(TEST_SUITE) + || event.getEntityType().equals(Entity.TEST_CASE); + } + return config.getResources().contains(event.getEntityType()); // Use Trigger Specific Settings } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertsRuleEvaluator.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertsRuleEvaluator.java index af1ba752704..559ddc23384 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertsRuleEvaluator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertsRuleEvaluator.java @@ -274,7 +274,7 @@ public class AlertsRuleEvaluator { }, paramInputType = READ_FROM_PARAM_CONTEXT) public boolean getTestCaseStatusIfInTestSuite( - List testSuiteList, List testResults) { + List testResults, List testSuiteList) { if (changeEvent == null || changeEvent.getChangeDescription() == null) { return false; } diff --git a/openmetadata-service/src/main/resources/json/data/EntityObservabilityFilterDescriptor.json b/openmetadata-service/src/main/resources/json/data/EntityObservabilityFilterDescriptor.json index 9b80b804c5d..f1e570e5a50 100644 --- a/openmetadata-service/src/main/resources/json/data/EntityObservabilityFilterDescriptor.json +++ b/openmetadata-service/src/main/resources/json/data/EntityObservabilityFilterDescriptor.json @@ -406,10 +406,10 @@ "displayName": "Get Test Case Status Updates belonging to a Test Suite", "description" : "Get Status Updates Test Cases belonging to a Test Suite", "effect" : "include", - "condition": "getTestCaseStatusIfInTestSuite(${testSuiteList}, ${testStatusList})", + "condition": "getTestCaseStatusIfInTestSuite(${testStatusList}, ${testSuiteList})", "arguments": [ - "testSuiteList", - "testStatusList" + "testStatusList", + "testSuiteList" ], "inputType": "runtime" } diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/ObservabilityAlerts.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/ObservabilityAlerts.spec.js index 5b329380a90..0b99babc783 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/ObservabilityAlerts.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/ObservabilityAlerts.spec.js @@ -291,7 +291,7 @@ describe('Observability Alert Flow', () => { // Add actions cy.get('[data-testid="add-actions"]').click(); - addPipelineStatusUpdatesAction(0, 'Success', true); + addPipelineStatusUpdatesAction(0, 'Successful', true); // Add multiple destinations [...Array(2).keys()].forEach(() => { diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/Alerts/AlertsUtil.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/Alerts/AlertsUtil.tsx index 4ed756ed657..cedf838716c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/Alerts/AlertsUtil.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/Alerts/AlertsUtil.tsx @@ -702,7 +702,7 @@ export const getFieldByArgumentType = ( className="w-full" data-testid="test-status-select" mode="multiple" - options={getSelectOptionsFromEnum(StatusType)} + options={getSelectOptionsFromEnum(TestCaseStatus)} placeholder={t('label.select-field', { field: t('label.test-suite-status'), })}