You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sk...@apache.org on 2022/10/10 11:32:41 UTC

[ignite-teamcity-bot] branch master updated: Added test pattern for searching always failed tests. Fixes #191

This is an automated email from the ASF dual-hosted git repository.

sk0x50 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e5279f4 Added test pattern for searching always failed tests. Fixes #191
9e5279f4 is described below

commit 9e5279f47af3246e39cb648e5803a49ec572c7ad
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Mon Oct 10 14:32:20 2022 +0300

    Added test pattern for searching always failed tests. Fixes #191
    
    Signed-off-by: Slava Koptilin <sl...@gmail.com>
---
 .../org/apache/ignite/ci/tcbot/conf/LocalFilesBasedConfig.java |  7 +++++++
 .../java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java   |  7 +++++++
 .../org/apache/ignite/ci/tcbot/chain/MockBasedTcBotModule.java |  5 +++++
 .../java/org/apache/ignite/tcbot/engine/conf/ITcBotConfig.java |  3 +++
 .../org/apache/ignite/tcbot/engine/conf/TcBotJsonConfig.java   | 10 ++++++++++
 .../org/apache/ignite/tcbot/engine/issue/EventTemplates.java   |  7 ++++++-
 .../java/org/apache/ignite/tcbot/engine/issue/IssueType.java   |  7 ++++++-
 .../org/apache/ignite/tcbot/engine/ui/DsTestFailureUi.java     |  4 ++++
 8 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/LocalFilesBasedConfig.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/LocalFilesBasedConfig.java
index 313ce2e0..1f3ac88e 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/LocalFilesBasedConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/LocalFilesBasedConfig.java
@@ -126,6 +126,13 @@ public class LocalFilesBasedConfig implements ITcBotConfig {
         return confidence == null || confidence < 0 || confidence > 1 ? ITcBotConfig.DEFAULT_CONFIDENCE : confidence;
     }
 
+    /** {@inheritDoc} */
+    @Override public Boolean alwaysFailedTestDetection() {
+        Boolean alwaysFailedTestDetection = getConfig().alwaysFailedTestDetection();
+
+        return alwaysFailedTestDetection != null && alwaysFailedTestDetection;
+    }
+
     @Override
     public ITrackedBranchesConfig getTrackedBranches() {
         return getConfig();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java
index c4883315..2c85de87 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java
@@ -528,6 +528,13 @@ public class IssueDetector {
             }
         }
 
+        if (firstFailedBuildId == null && cfg.alwaysFailedTestDetection()) {
+            firstFailedBuildId = runStat.detectTemplate(EventTemplates.alwaysFailure);
+
+            if (firstFailedBuildId != null)
+                type = IssueType.newAlwaysFailure;
+        }
+
         if (firstFailedBuildId == null)
             return false;
 
diff --git a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/MockBasedTcBotModule.java b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/MockBasedTcBotModule.java
index 7f778bb7..91098ebc 100644
--- a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/MockBasedTcBotModule.java
+++ b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/MockBasedTcBotModule.java
@@ -102,6 +102,11 @@ public class MockBasedTcBotModule extends AbstractModule {
                 return DEFAULT_CONFIDENCE;
             }
 
+            /** */
+            @Override public Boolean alwaysFailedTestDetection() {
+                return false;
+            }
+
             @Override  public ITrackedBranchesConfig getTrackedBranches() {
                 return tracked;
             }
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/ITcBotConfig.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/ITcBotConfig.java
index 63e14485..bb97a9c3 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/ITcBotConfig.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/ITcBotConfig.java
@@ -45,6 +45,9 @@ public interface ITcBotConfig extends IDataSourcesConfigSupplier {
     /** */
     public Double confidence();
 
+    /** */
+    public Boolean alwaysFailedTestDetection();
+
     /**
      * @return Tracked branches configuration for TC Bot.
      */
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/TcBotJsonConfig.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/TcBotJsonConfig.java
index be76dbc7..6f078c2e 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/TcBotJsonConfig.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/conf/TcBotJsonConfig.java
@@ -44,6 +44,9 @@ public class TcBotJsonConfig implements ITrackedBranchesConfig {
     /** Сonfidence (used with flaky tests). */
     @Nullable private Double confidence;
 
+    /** Always failed test detection. */
+    @Nullable private Boolean alwaysFailedTestDetection;
+
     /** Additional list Servers to be used for validation of PRs, but not for tracking any branches. */
     private List<TcServerConfig> tcServers = new ArrayList<>();
 
@@ -105,6 +108,13 @@ public class TcBotJsonConfig implements ITrackedBranchesConfig {
         return confidence;
     }
 
+    /**
+     * @return Is always failed test detection enabled.
+     */
+    @Nullable public Boolean alwaysFailedTestDetection() {
+        return alwaysFailedTestDetection;
+    }
+
     public Optional<TcServerConfig> getTcConfig(String code) {
         return tcServers.stream().filter(s -> Objects.equals(code, s.getCode())).findAny();
     }
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplates.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplates.java
index 4a45b2a3..6d1f50bd 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplates.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplates.java
@@ -55,10 +55,15 @@ public class EventTemplates {
                     FAIL, FAIL}
     );
 
+    public static final EventTemplate alwaysFailure = new EventTemplate(
+        new int[]{FAIL, FAIL, FAIL, FAIL, FAIL, FAIL},
+        new int[]{FAIL, FAIL, FAIL, FAIL, FAIL, FAIL}
+    );
+
     public static ArrayList<EventTemplate> templates;
 
     static {
         templates = Lists.newArrayList(newFailure, newCriticalFailure,
-            newContributedTestFailure, newFailureForFlakyTest);
+            newContributedTestFailure, newFailureForFlakyTest, alwaysFailure);
     }
 }
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssueType.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssueType.java
index 7ba27b1d..f80f668f 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssueType.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssueType.java
@@ -37,7 +37,10 @@ public enum IssueType {
     newTrustedSuiteFailure("newTrustedSuiteFailure", "New Trusted Suite failure"),
 
     /** New failure for flaky test. */
-    newTestWithHighFlakyRate("newTestWithHighFlakyRate", "Test with high flaky rate");
+    newTestWithHighFlakyRate("newTestWithHighFlakyRate", "Test with high flaky rate"),
+
+    /** New always failure test. */
+    newAlwaysFailure("newAlwaysFailure", "Always failed test");
 
     /** Code. */
     private final String code;
@@ -58,6 +61,8 @@ public enum IssueType {
                 return newTrustedSuiteFailure;
             case "Test with high flaky rate":
                 return newTestWithHighFlakyRate;
+            case "Always failed test":
+                return newAlwaysFailure;
         }
 
         throw new IllegalArgumentException("Illegal issue type: " + displayName);
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsTestFailureUi.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsTestFailureUi.java
index df3f9486..9f85413e 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsTestFailureUi.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsTestFailureUi.java
@@ -217,6 +217,10 @@ public class DsTestFailureUi extends ShortTestFailureUi {
             if (statForProblemsDetection.detectTemplate(EventTemplates.newContributedTestFailure) != null)
                 problemRef = new DsProblemRef("Recently contributed test failure");
 
+
+            if (statForProblemsDetection.detectTemplate(EventTemplates.alwaysFailure) != null)
+                problemRef = new DsProblemRef("Always failed test");
+
             if (statForProblemsDetection.isFlaky()
                     && statForProblemsDetection.detectTemplate(EventTemplates.newFailureForFlakyTest) != null)
                 problemRef = new DsProblemRef("New failure of flaky test");