You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/08/03 18:08:22 UTC

[ignite-teamcity-bot] branch newtest-detection-fix created (now 826d1e4)

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

dpavlov pushed a change to branch newtest-detection-fix
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git.


      at 826d1e4  Newly contributed test detection fixed: test presence in suite is checked

This branch includes the following new commits:

     new 826d1e4  Newly contributed test detection fixed: test presence in suite is checked

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[ignite-teamcity-bot] 01/01: Newly contributed test detection fixed: test presence in suite is checked

Posted by dp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch newtest-detection-fix
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit 826d1e4aff62b746e48e672ec5c7d90477a7f1ef
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Sat Aug 3 21:08:11 2019 +0300

    Newly contributed test detection fixed: test presence in suite is checked
---
 .../src/main/webapp/js/testfails-2.2.js            |  2 ++
 .../ignite/tcbot/engine/issue/EventTemplate.java   | 11 -------
 .../ignite/tcbot/engine/issue/EventTemplates.java  | 10 +++----
 .../teamcity/ignited/runhist/InvocationData.java   | 22 +++++++++++---
 .../teamcity/ignited/runhist/RunHistCompacted.java | 35 ++++++++++++----------
 .../ignite/tcignited/build/SuiteHistory.java       |  3 +-
 .../ignite/tcignited/history/IEventTemplate.java   |  2 --
 .../apache/ignite/tcignited/history/RunStatus.java |  4 ++-
 8 files changed, 48 insertions(+), 41 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
index 75ba7ac..e744146 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
@@ -1032,6 +1032,8 @@ function drawLatestRunsBlock(state, len) {
         runColor = "grey";
     else if (state === 3)
         runColor = "black";
+    else if (state === 4)
+        runColor = "lightgrey";
 
     return "<span style='background-color: " + runColor + "; width:" + (len * 1) + "px; height:10px; display: inline-block;'></span>";
 }
\ No newline at end of file
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplate.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplate.java
index 9aad878..d6ab25e 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplate.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/EventTemplate.java
@@ -22,7 +22,6 @@ import org.apache.ignite.tcignited.history.IEventTemplate;
 public class EventTemplate implements IEventTemplate {
     private final int[] beforeEvent;
     private final int[] eventAndAfter;
-    private boolean shouldBeFirst;
 
     public EventTemplate(int[] beforeEvent, int[] eventAndAfter) {
         this.beforeEvent = beforeEvent;
@@ -40,14 +39,4 @@ public class EventTemplate implements IEventTemplate {
     public int cntEvents() {
         return beforeEvent.length + eventAndAfter.length;
     }
-
-    public EventTemplate setShouldBeFirst(boolean shouldBeFirst) {
-        this.shouldBeFirst = shouldBeFirst;
-
-        return this;
-    }
-
-    public boolean shouldBeFirst() {
-        return shouldBeFirst;
-    }
 }
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 5bd11b8..dcb5af2 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
@@ -20,14 +20,12 @@ package org.apache.ignite.tcbot.engine.issue;
 import com.google.common.collect.Lists;
 import java.util.ArrayList;
 
-import static org.apache.ignite.tcignited.history.RunStatus.RES_CRITICAL_FAILURE;
-import static org.apache.ignite.tcignited.history.RunStatus.RES_FAILURE;
-import static org.apache.ignite.tcignited.history.RunStatus.RES_OK;
-import static org.apache.ignite.tcignited.history.RunStatus.RES_OK_OR_FAILURE;
+import static org.apache.ignite.tcignited.history.RunStatus.*;
 
 public class EventTemplates {
     private static final int OK = RES_OK.getCode();
     private static final int FAIL = RES_FAILURE.getCode();
+    private static final int MISSING = RES_MISSING.getCode();
 
     public static final EventTemplate newFailure = new EventTemplate(
             new int[]{OK, OK, OK, OK, OK},
@@ -40,9 +38,9 @@ public class EventTemplates {
     );
 
     public static final EventTemplate newContributedTestFailure = new EventTemplate(
-            new int[]{},
+            new int[]{MISSING, MISSING, MISSING, MISSING},
             new int[]{FAIL, FAIL, FAIL, FAIL}
-    ).setShouldBeFirst(true);
+    );
 
     public static final EventTemplate newFailureForFlakyTest = new EventTemplate(
             new int[]{OK, OK, OK, OK, OK},
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java
index 090c39c..5b83203 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java
@@ -18,15 +18,13 @@
 package org.apache.ignite.ci.teamcity.ignited.runhist;
 
 import com.google.common.base.MoreObjects;
+import org.apache.ignite.tcignited.history.RunStatus;
 
+import javax.annotation.Nonnull;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.apache.ignite.tcignited.history.RunStatus;
-
-import javax.annotation.Nonnull;
-
 /**
  *
  */
@@ -39,6 +37,8 @@ public class InvocationData {
     public static final int OK = RunStatus.RES_OK.getCode();
     /** Ok. */
     public static final int CRITICAL_FAILURE = RunStatus.RES_CRITICAL_FAILURE.getCode();
+    /** Test is missing in suite run. */
+    public static final int MISSING = RunStatus.RES_MISSING.getCode();
 
     /** Invocations map from build ID to invocation data. */
     private final List<Invocation> invocationList = new ArrayList<>();
@@ -114,4 +114,18 @@ public class InvocationData {
     public void sort() {
         invocationList.sort(Comparator.comparing(Invocation::buildId));
     }
+
+    Set<Integer> getBuildIds() {
+        return invocations().map(Invocation::buildId).collect(Collectors.toSet());
+    }
+
+    public void registerMissing(Integer testId, Set<Integer> suiteBuildIds) {
+        Set<Integer> idsPresent = getBuildIds();
+        HashSet<Integer> toAdd = new HashSet<>(suiteBuildIds);
+        toAdd.removeAll(idsPresent);
+
+        toAdd.forEach(id -> {
+            add(new Invocation(id).withStatus(MISSING));
+        });
+    }
 }
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java
index 3b86767..d66ed1f 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java
@@ -18,16 +18,18 @@
 package org.apache.ignite.ci.teamcity.ignited.runhist;
 
 import com.google.common.base.MoreObjects;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import javax.annotation.Nullable;
 import org.apache.ignite.tcbot.common.TcBotConst;
 import org.apache.ignite.tcignited.history.ChangesState;
 import org.apache.ignite.tcignited.history.IEventTemplate;
 import org.apache.ignite.tcignited.history.IRunHistory;
 import org.apache.ignite.tcignited.history.RunStatus;
 
+import javax.annotation.Nullable;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
 /**
  *
  */
@@ -124,18 +126,13 @@ public class RunHistCompacted implements  IRunHistory {
             return null;
 
         Integer detectedAt = null;
-        if (t.shouldBeFirst()) {
-            //todo detect somehow test is new (e.g. status absent for test history).
-            detectedAt = checkTemplateAtPos(template, centralEvtBuild, histAsArr, 0);
-        }
-        else {
-            //startIgnite from the end to find most recent
-            for (int idx = histAsArr.size() - template.length; idx >= 0; idx--) {
-                detectedAt = checkTemplateAtPos(template, centralEvtBuild, histAsArr, idx);
 
-                if (detectedAt != null)
-                    break;
-            }
+        //startIgnite from the end to find most recent
+        for (int idx = histAsArr.size() - template.length; idx >= 0; idx--) {
+            detectedAt = checkTemplateAtPos(template, centralEvtBuild, histAsArr, idx);
+
+            if (detectedAt != null)
+                break;
         }
 
         return detectedAt;
@@ -197,4 +194,12 @@ public class RunHistCompacted implements  IRunHistory {
     public void sort() {
         data.sort();
     }
+
+    public Set<Integer> buildIds() {
+        return data.getBuildIds();
+    }
+
+    public void registerMissing(Integer testId, Set<Integer> buildIds) {
+        data.registerMissing(testId, buildIds);
+    }
 }
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/SuiteHistory.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/SuiteHistory.java
index 9d5f0e8..f458cca 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/SuiteHistory.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/SuiteHistory.java
@@ -43,8 +43,7 @@ public class SuiteHistory implements ISuiteRunHistory {
     }
 
     private void finalizeInvocations() {
-        //todo add missing status to tests
-        //  testsHistory.values().registerMissing(suiteHist.buildIds());
+        testsHistory.forEach((k, t)->t.registerMissing(k, suiteHist.buildIds()));
 
         suiteHist.sort();
         testsHistory.values().forEach(RunHistCompacted::sort);
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/IEventTemplate.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/IEventTemplate.java
index 85b5a6f..c762de1 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/IEventTemplate.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/IEventTemplate.java
@@ -23,6 +23,4 @@ public interface IEventTemplate {
     int[] beforeEvent();
 
     int[] eventAndAfter();
-
-    boolean shouldBeFirst();
 }
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/RunStatus.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/RunStatus.java
index f468a9f..7f8171b 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/RunStatus.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/RunStatus.java
@@ -34,7 +34,9 @@ public enum RunStatus {
     /** Result of test execution, muted failure found. */
     RES_MUTED_FAILURE(2),
     /** Result of suite: Critical failure, no results. */
-    RES_CRITICAL_FAILURE(3);
+    RES_CRITICAL_FAILURE(3),
+    /** Test is not present in current run */
+    RES_MISSING(4);
 
     /** Mapping of status int -> object. */
     private static Map<Integer, RunStatus> holder = Stream.of(values()).collect(Collectors.toMap(RunStatus::getCode, i -> i));