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

dgovorukhin 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 d375c32  IGNITE-9376 Create table with critical failures.
d375c32 is described below

commit d375c327acc08b3bfca21e8f65757d35cccc80da
Author: Dmitrii Ryabov <[email protected]>
AuthorDate: Thu Sep 6 15:44:56 2018 +0300

    IGNITE-9376 Create table with critical failures.
    
    Signed-off-by: Dmitriy Govorukhin <[email protected]>
---
 .../src/main/webapp/css/style-1.5.css              |  8 +++
 .../src/main/webapp/js/testfails-2.0.js            | 83 +++++++++++++++++++++-
 2 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css 
b/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
index a3262b4..04411da 100644
--- a/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
+++ b/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
@@ -24,6 +24,14 @@ table, tr, td {
        border-spacing: 0px;
 }
 
+.table-title
+{
+       border: solid black;
+       border-width: 1px 0;
+       font-size: 20px;
+       padding: 5px;
+}
+
 .logMsg {
        font-family: Arial;
        font-size: 12px;
diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.0.js 
b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.0.js
index 83d0200..e363882 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.0.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.0.js
@@ -143,9 +143,11 @@ function showChainCurrentStatusData(server, settings) {
 
     res += "</td></tr>";
 
+    res += addBlockersData(server, settings);
 
     for (var i = 0; i < server.suites.length; i++) {
         var suite = server.suites[i];
+
         res += showSuiteData(suite, settings);
     }
 
@@ -155,6 +157,65 @@ function showChainCurrentStatusData(server, settings) {
     return res;
 }
 
+/**
+ * Creates table with possible blockers.
+ *
+ * @param server - see ChainAtServerCurrentStatus Java class.
+ * @param settings - see Settings JavaScript class.
+ * @returns {string} Table rows with possible blockers and table headers.
+ * Or empty string if no blockers found.
+ */
+function addBlockersData(server, settings) {
+    if (findGetParameter("action") != "Latest")
+        return "";
+
+    var blockers = "";
+
+    for (var i = 0; i < server.suites.length; i++) {
+        var suite = server.suites[i];
+
+        suite = suiteWithCriticalFailuresOnly(suite);
+
+        if (suite != null)
+            blockers += showSuiteData(suite, settings);
+    }
+
+    if (blockers != "") {
+        blockers = "<tr bgcolor='#F5F5FF'><th colspan='4' 
class='table-title'><b>Possible Blockers</b></th></tr>" +
+            blockers +
+            "<tr bgcolor='#F5F5FF'><th colspan='4' 
class='table-title'><b>Other failures</b></th></tr>";
+    }
+
+    return blockers;
+}
+
+/**
+ * Copy suite and remove flaky tests from the copy.
+ *
+ * @param suite - see SuiteCurrentStatus Java class.
+ * @returns Suite without flaky tests. Or null - if suite have only flaky 
tests.
+ */
+function suiteWithCriticalFailuresOnly(suite) {
+    var suite0 = Object.assign({}, suite);
+    var j = 0;
+
+    suite0.testFailures = suite0.testFailures.slice();
+
+    while (j < suite0.testFailures.length) {
+        var testFailure = suite0.testFailures[j];
+
+        if (isNewFailedTest(testFailure) || testFailure.name.includes("(last 
started)"))
+            j++;
+        else
+            suite0.testFailures.splice(j, 1);
+    }
+
+    if (suite0.testFailures.length > 0 || suite0.result != "")
+        return suite0;
+
+    return null;
+}
+
 function triggerBuild(serverId, suiteId, branchName, top) {
     var queueAtTop = isDefinedAndFilled(top) && top;
     $.ajax({
@@ -235,7 +296,13 @@ function triggerBuilds(serverId, suiteIdList, branchName, 
top) {
     });
 }
 
-//@param suite - see SuiteCurrentStatus
+/**
+ * Create html string with table rows, containing suite data.
+ *
+ * @param suite - see SuiteCurrentStatus Java class.
+ * @param settings - see Settings JavaScript class.
+ * @returns {string} Table rows with suite data.
+ */
 function showSuiteData(suite, settings) {
     var moreInfoTxt = "";
 
@@ -364,7 +431,9 @@ function showSuiteData(suite, settings) {
     res += " </tr>";
 
     for (var i = 0; i < suite.testFailures.length; i++) {
-        res += showTestFailData(suite.testFailures[i], true, settings);
+        var testFailure = suite.testFailures[i];
+
+        res += showTestFailData(testFailure, true, settings);
     }
 
     if (isDefinedAndFilled(suite.webUrlThreadDump)) {
@@ -381,6 +450,16 @@ function showSuiteData(suite, settings) {
     return res;
 }
 
+/**
+ * Check that given test is new.
+ *
+ * @param testFailure - see TestFailure Java class.
+ * @returns {boolean} True - if test is new. False - otherwise.
+ */
+function isNewFailedTest(testFailure) {
+    return Number.parseFloat(testFailure.failureRate) < 4.0 || 
testFailure.flakyComments == null;
+}
+
 function failureRateToColor(failureRate) {
     var redSaturation = 255;
     var greenSaturation = 0;

Reply via email to