This is an automated email from the ASF dual-hosted git repository.
dpavlov 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 bd93e25 IGNITE-9542: Refactored recent runs for test: separate recent
runs added, flaky comments applied to base always, History reference made
relevant.
bd93e25 is described below
commit bd93e25788650a32a24382d0de46a27b301ac277
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Tue Sep 11 16:47:48 2018 +0300
IGNITE-9542: Refactored recent runs for test: separate recent runs added,
flaky comments applied to base always,
History reference made relevant.
---
.../org/apache/ignite/ci/analysis/RunStat.java | 5 +-
.../org/apache/ignite/ci/web/model/Version.java | 2 +-
.../ci/web/model/current/SuiteCurrentStatus.java | 26 +++++--
.../ignite/ci/web/model/current/TestFailure.java | 46 +++++++----
.../ignite/ci/web/model/hist/TestHistory.java | 7 +-
.../src/main/webapp/js/testfails-2.1.js | 89 ++++++++++++----------
6 files changed, 106 insertions(+), 69 deletions(-)
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
index e6f0897..cf01028 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
@@ -403,7 +403,7 @@ public class RunStat {
return null;
return "Test seems to be flaky: " +
- "change status [" + statusChange + "/" + latestRuns.size() + "]";
+ "changed its status [" + statusChange + "/" + latestRuns.size() +
"] without code modifications";
}
/**
@@ -421,9 +421,8 @@ public class RunStat {
else
latestRuns.clear();
- for (Map.Entry<TestId, Integer> entry : latestRunResults.entrySet()) {
+ for (Map.Entry<TestId, Integer> entry : latestRunResults.entrySet())
latestRuns.put(entry.getKey(), new
RunInfo(RunStatus.byCode(entry.getValue()), ChangesState.UNKNOWN));
- }
}
/**
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
index fd1c903..2c50539 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
@@ -22,7 +22,7 @@ package org.apache.ignite.ci.web.model;
public static final String DEFAULT_CONTACT = "[email protected]";
/** TC Helper Version. */
- public String version = "20180910";
+ public String version = "20180911";
/** Ignite version. */
public String ignVer;
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
index 707a7cb..b9a561d 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
@@ -64,6 +64,9 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
/** Web Href. to suite runs history */
public String webToHist = "";
+ /** Web Href. to suite runs history in base branch */
+ public String webToHistBaseBranch = "";
+
/** Web Href. to suite particular run */
public String webToBuild = "";
@@ -112,11 +115,11 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
public void initFromContext(@Nonnull final ITeamcity teamcity,
@Nonnull final MultBuildRunCtx suite,
@Nullable final ITcAnalytics tcAnalytics,
- @Nullable final String failRateBranch) {
+ @Nullable final String baseBranch) {
name = suite.suiteName();
- String failRateNormalizedBranch = normalizeBranch(failRateBranch);
+ String failRateNormalizedBranch = normalizeBranch(baseBranch);
String curBranchNormalized = normalizeBranch(suite.branchName());
String suiteId = suite.suiteId();
@@ -133,6 +136,7 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
durationPrintable = getDurationPrintable(suite.getBuildDuration());
contactPerson = suite.getContactPerson();
webToHist = buildWebLink(teamcity, suite);
+ webToHistBaseBranch = buildWebLink(teamcity, suite, baseBranch);
webToBuild = buildWebLinkToBuild(teamcity, suite);
Stream<? extends ITestFailureOccurrences> tests =
suite.getFailedTests();
@@ -151,7 +155,7 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
Stream<TestOccurrenceFull> stream = suite.getFullTests(occurrence);
final TestFailure failure = new TestFailure();
- failure.initFromOccurrence(occurrence, stream, teamcity,
suite.projectId(), suite.branchName());
+ failure.initFromOccurrence(occurrence, stream, teamcity,
suite.projectId(), suite.branchName(), baseBranch);
if (tcAnalytics != null)
failure.initStat(tcAnalytics.getTestRunStatProvider(),
failRateNormalizedBranch, curBranchNormalized);
@@ -159,7 +163,7 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
});
suite.getTopLongRunning().forEach(occurrence -> {
- final TestFailure failure = createOrrucForLongRun(teamcity, suite,
tcAnalytics, occurrence, failRateBranch);
+ final TestFailure failure = createOrrucForLongRun(teamcity, suite,
tcAnalytics, occurrence, baseBranch);
topLongRunning.add(failure);
});
@@ -270,7 +274,7 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
Stream<TestOccurrenceFull> stream = suite.getFullTests(occurrence);
- failure.initFromOccurrence(occurrence, stream, teamcity,
suite.projectId(), suite.branchName());
+ failure.initFromOccurrence(occurrence, stream, teamcity,
suite.projectId(), suite.branchName(), failRateBranch);
if (tcAnalytics != null) {
failure.initStat(tcAnalytics.getTestRunStatProvider(),
@@ -302,7 +306,13 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
}
private static String buildWebLink(ITeamcity teamcity, MultBuildRunCtx
suite) {
- final String branch = branchForLink(suite.branchName());
+ String branchName = suite.branchName();
+
+ return buildWebLink(teamcity, suite, branchName);
+ }
+
+ @NotNull private static String buildWebLink(ITeamcity teamcity,
MultBuildRunCtx suite, String branchName) {
+ final String branch = branchForLink(branchName);
return teamcity.host() + "viewType.html?buildTypeId=" + suite.suiteId()
+ "&branch=" + escape(branch)
+ "&tab=buildTypeStatusDiv";
@@ -323,6 +333,7 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
Objects.equal(result, status.result) &&
Objects.equal(hasCriticalProblem, status.hasCriticalProblem) &&
Objects.equal(webToHist, status.webToHist) &&
+ Objects.equal(webToHistBaseBranch, status.webToHistBaseBranch) &&
Objects.equal(webToBuild, status.webToBuild) &&
Objects.equal(contactPerson, status.contactPerson) &&
Objects.equal(testFailures, status.testFailures) &&
@@ -346,7 +357,8 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
/** {@inheritDoc} */
@Override public int hashCode() {
- return Objects.hashCode(name, result, hasCriticalProblem, webToHist,
webToBuild, contactPerson, testFailures,
+ return Objects.hashCode(name, result, hasCriticalProblem, webToHist,
webToHistBaseBranch, webToBuild,
+ contactPerson, testFailures,
topLongRunning, webUrlThreadDump, runningBuildCount,
queuedBuildCount, serverId,
suiteId, branchName, failures, runs, failureRate,
failsAllHist, criticalFails, userCommits, failedTests,
durationPrintable,
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/TestFailure.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/TestFailure.java
index 69ea5dc..795cc63 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/TestFailure.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/TestFailure.java
@@ -46,7 +46,7 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
/**
* UI model for test failure, probably merged with its history
*/
-@SuppressWarnings("WeakerAccess") public class TestFailure {
+@SuppressWarnings({"WeakerAccess", "PublicField"}) public class TestFailure {
/** Test full Name */
public String name;
@@ -62,10 +62,7 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
*/
public Integer curFailures;
- /** Latest runs, 0,1,2 values for each run. */
- @Nullable public List<Integer> latestRuns;
-
- /** Link to test history */
+ /** Link to test history for current branch. */
@Nullable public String webUrl;
/** Link to mentioned issue (if any) */
@@ -83,6 +80,7 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
@Nullable public ProblemRef problemRef;
+ /** Non null flaky comments means there is flakiness detected in the base
branch. */
@Nullable public String flakyComments;
/** History cur branch. If it is absent, history is to be taken from
histBaseBranch. */
@@ -93,18 +91,24 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
*/
@NotNull public TestHistory histBaseBranch = new TestHistory();
+
+ /** Link to test history for current branch. */
+ @Nullable public String webUrlBaseBranch;
+
/**
* @param failure
* @param testFullOpt all related full test ocurrences
* @param teamcity
* @param projectId
* @param branchName
+ * @param baseBranchName base branch name (e.g. master).
*/
public void initFromOccurrence(@Nonnull final ITestFailureOccurrences
failure,
@Nonnull final Stream<TestOccurrenceFull> testFullOpt,
@Nonnull final ITeamcity teamcity,
@Nullable final String projectId,
- @Nullable final String branchName) {
+ @Nullable final String branchName,
+ @Nullable final String baseBranchName) {
name = failure.getName();
investigated = failure.isInvestigated();
curFailures = failure.failuresCount();
@@ -141,6 +145,10 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
if (webUrl == null)
if (full.test != null && full.test.id != null)
webUrl = buildWebLink(teamcity, full.test.id, projectId,
branchName);
+
+ if (webUrlBaseBranch == null)
+ if (full.test != null && full.test.id != null)
+ webUrlBaseBranch = buildWebLink(teamcity, full.test.id,
projectId, baseBranchName);
});
}
@@ -205,24 +213,28 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
flakyComments = stat.getFlakyComments();
}
- RunStat latestRunsSrcInBranch = null;
+ RunStat statForProblemsDetection = null;
if (!curBranchNormalized.equals(failRateNormalizedBranch)) {
TestInBranch testInBranchS = new TestInBranch(name,
curBranchNormalized);
- latestRunsSrcInBranch = runStatSupplier.apply(testInBranchS);
- } else
- latestRunsSrcInBranch = stat;
+ statForProblemsDetection = runStatSupplier.apply(testInBranchS);
+
+ if(statForProblemsDetection!=null) {
+ histCurBranch = new TestHistory();
- latestRuns = latestRunsSrcInBranch != null ?
latestRunsSrcInBranch.getLatestRunResults() : null;
+ histCurBranch.init(statForProblemsDetection);
+ }
+ } else
+ statForProblemsDetection = stat;
- if (latestRunsSrcInBranch != null) {
- RunStat.TestId testId =
latestRunsSrcInBranch.detectTemplate(EventTemplates.newFailure);
+ if (statForProblemsDetection != null) {
+ RunStat.TestId testId =
statForProblemsDetection.detectTemplate(EventTemplates.newFailure);
if (testId != null)
problemRef = new ProblemRef("New Failure");
- RunStat.TestId recentContributedTestId =
latestRunsSrcInBranch.detectTemplate(EventTemplates.newContributedTestFailure);
+ RunStat.TestId recentContributedTestId =
statForProblemsDetection.detectTemplate(EventTemplates.newContributedTestFailure);
if (recentContributedTestId != null)
problemRef = new ProblemRef("Recently contributed test
failure");
@@ -248,13 +260,15 @@ import static
org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchFo
Objects.equal(durationPrintable, failure.durationPrintable) &&
Objects.equal(warnings, failure.warnings) &&
Objects.equal(histBaseBranch, failure.histBaseBranch) &&
- Objects.equal(histCurBranch, failure.histCurBranch);
+ Objects.equal(histCurBranch, failure.histCurBranch)&&
+ Objects.equal(webUrlBaseBranch, failure.webUrlBaseBranch) ;
}
/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(name, suiteName, testName, curFailures,
- webUrl, webIssueUrl, webIssueText, investigated,
durationPrintable, warnings, histBaseBranch, histCurBranch);
+ webUrl, webIssueUrl, webIssueText, investigated,
durationPrintable, warnings, histBaseBranch, histCurBranch,
+ webUrlBaseBranch);
}
/** {@inheritDoc} */
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/TestHistory.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/TestHistory.java
index c8bc40a..d9fbcc6 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/TestHistory.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/TestHistory.java
@@ -21,6 +21,7 @@ import com.google.common.base.Objects;
import java.util.List;
import javax.annotation.Nullable;
import org.apache.ignite.ci.analysis.RunStat;
+import org.jetbrains.annotations.NotNull;
/**
* Summary of failures - all history and recent runs for suite or for suite.
@@ -35,7 +36,7 @@ public class TestHistory {
/** Latest runs, 0,1,2 values for each run. */
@Nullable public List<Integer> latestRuns;
- public void init(RunStat stat) {
+ public void init(@NotNull RunStat stat) {
recent.failures = stat.getFailuresCount();
recent.runs = stat.getRunsCount();
recent.failureRate = stat.getFailPercentPrintable();
@@ -44,9 +45,10 @@ public class TestHistory {
allTime.runs = stat.getRunsAllHist();
allTime.failureRate = stat.getFailPercentAllHistPrintable();
- latestRuns = stat != null ? stat.getLatestRunResults() : null;
+ latestRuns = stat.getLatestRunResults();
}
+ /** {@inheritDoc} */
@Override public boolean equals(Object o) {
if (this == o)
return true;
@@ -59,6 +61,7 @@ public class TestHistory {
Objects.equal(latestRuns, hist.latestRuns);
}
+ /** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(allTime, recent, latestRuns);
}
diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
index 5652414..cdd09a3 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
@@ -181,9 +181,11 @@ function addBlockersData(server, 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='3'
class='table-title'><b>Possible Blockers</b></th>" +
+ "<th class='table-title'>Base Branch</th></tr>" +
blockers +
- "<tr bgcolor='#F5F5FF'><th colspan='4'
class='table-title'><b>Other failures</b></th></tr>";
+ "<tr bgcolor='#F5F5FF'><th colspan='3'
class='table-title'><b>Other failures</b></th>" +
+ "<th class='table-title'>Base Branch</th></tr>";
}
return blockers;
@@ -334,7 +336,7 @@ function showSuiteData(suite, settings) {
}
if(isDefinedAndFilled(suite.problemRef)) {
- res += "<span title='"+testFail.problemRef.name +"'>🐞</span> "
+ res += "<span title='"+ suite.problemRef.name +"'>🐞</span> "
}
var color = failureRateToColor(suite.failureRate);
@@ -422,7 +424,7 @@ function showSuiteData(suite, settings) {
res += "<td>"; //fail rate
if(isDefinedAndFilled(suite.hasCriticalProblem) && suite.hasCriticalProblem
&& isDefinedAndFilled(suite.criticalFails) &&
isDefinedAndFilled(suite.criticalFails.failures)) {
- res += "<a href='" + suite.webToHist + "'>";
+ res += "<a href='" + suite.webToHistBaseBranch + "'>";
res += "Critical F.R.: "+ suite.criticalFails.failureRate + "% </a> " ;
} else {
res+=" ";
@@ -457,7 +459,14 @@ function showSuiteData(suite, settings) {
* @returns {boolean} True - if test is new. False - otherwise.
*/
function isNewFailedTest(testFailure) {
- return Number.parseFloat(testFailure.failureRate) < 4.0 ||
testFailure.flakyComments == null;
+ if(!isDefinedAndFilled(testFailure.histBaseBranch))
+ return true;
+
+ var hist = testFailure.histBaseBranch;
+ if(!isDefinedAndFilled(hist.recent))
+ return true;
+
+ return Number.parseFloat(hist.recent.failureRate) < 4.0 &&
testFailure.flakyComments == null;
}
function failureRateToColor(failureRate) {
@@ -507,31 +516,20 @@ function showTestFailData(testFail, isFailureShown,
settings) {
res += "<span style='opacity: 0.75'> ";
}
- var bold = false;
- if (isFailureShown && !isDefinedAndFilled(findGetParameter("reportMode")))
{
- var altForWarn = "";
- if (!isDefinedAndFilled(testFail.failureRate) ||
!isDefinedAndFilled(testFail.runs)) {
- altForWarn = "No fail rate info, probably new failure or suite
critical failure";
- // } else if (testFail.failures < 2) {
- // altForWarn = "Test failures count is low < 2, probably new test
introduced";
- } else if (testFail.runs < 10) {
- altForWarn = "Test runs count is low < 10, probably new test
introduced";
- //todo move to server side
- }
+ // has both base and current, draw current latest runs here.
+ var comparePage = isDefinedAndFilled(testFail.histCurBranch) &&
isDefinedAndFilled(testFail.histCurBranch.latestRuns)
+ && isDefinedAndFilled(testFail.histBaseBranch) &&
isDefinedAndFilled(testFail.histBaseBranch.latestRuns);
- if (altForWarn != "") {
- // res += "<img
src='https://image.flaticon.com/icons/svg/159/159469.svg' width=11px
height=11px title='" + altForWarn + "' > ";
- res += "<span title='" + altForWarn + "' >⚠</span>";
-
- bold = true;
- res += "<b>";
- }
- }
+ var baseBranchMarks = "";
if(isFailureShown && isDefinedAndFilled(testFail.flakyComments) &&
testFail.flakyComments) {
- res += "<span
title='"+testFail.flakyComments+"'><b>"+"≈"+"</b></span> "
+ baseBranchMarks += "<span
title='"+testFail.flakyComments+"'><b>"+"≈"+"</b></span> "
}
+ if(!comparePage)
+ res+=baseBranchMarks;
+
+ var bold = false;
if(isFailureShown && isDefinedAndFilled(testFail.problemRef)) {
res += "<span title='"+testFail.problemRef.name +"'>🐞</span>"
if(!bold)
@@ -540,12 +538,19 @@ function showTestFailData(testFail, isFailureShown,
settings) {
bold = true;
}
+ var haveWeb = isDefinedAndFilled(testFail.webUrl);
+ if (haveWeb)
+ res += "<a href='" + testFail.webUrl + "'>";
- if (isDefinedAndFilled(testFail.latestRuns)) {
- res += drawLatestRuns(testFail.latestRuns);
- }
+ if(comparePage)
+ res += drawLatestRuns(testFail.histCurBranch.latestRuns);
+ else if(isDefinedAndFilled(testFail.histBaseBranch) &&
isDefinedAndFilled(testFail.histBaseBranch.latestRuns))
+ res += drawLatestRuns(testFail.histBaseBranch.latestRuns); // has only
base branch
- res+= "</td><td>";
+ if (haveWeb)
+ res += "</a> ";
+
+ res += "</td><td>";
res += "<span style='background-color: " + color + "; width:8px;
height:8px; display: inline-block; border-width: 1px; border-color: black;
border-style: solid; '></span> ";
if (isDefinedAndFilled(testFail.curFailures) && testFail.curFailures > 1)
@@ -563,7 +568,6 @@ function showTestFailData(testFail, isFailureShown,
settings) {
else
res += testFail.name;
- var haveWeb = isDefinedAndFilled(testFail.webUrl);
var histContent = "";
//see class TestHistory
@@ -575,9 +579,13 @@ function showTestFailData(testFail, isFailureShown,
settings) {
hist = null;
if (isFailureShown && hist!=null) {
+ if(comparePage) {
+ histContent += baseBranchMarks + " ";
+ }
+
var testFailTitle = "";
- if(isDefinedAndFilled(hist.recent))
+ if(isDefinedAndFilled(hist.recent) &&
isDefinedAndFilled(hist.recent.failures))
testFailTitle = "recent rate: " + hist.recent.failures + " fails /
" + hist.recent.runs + " runs" ;
if(isDefinedAndFilled(hist.allTime) &&
isDefinedAndFilled(hist.allTime.failures)) {
@@ -592,14 +600,13 @@ function showTestFailData(testFail, isFailureShown,
settings) {
if (isDefinedAndFilled(hist.recent) &&
isDefinedAndFilled(hist.recent.failureRate))
histContent += "(fail rate " + hist.recent.failureRate + "%)";
else
- histContent += "(fails: " + hist.recent.failures + "/" +
hist.recent.runs + ")";
-
- if(isDefinedAndFilled(testFail.histCurBranch)) {
- //todo presence of this indicates that PR is checked, need to draw
latest
- }
-
+ histContent += "(no data)";
+
histContent += "</span>";
+ if(comparePage) {
+ histContent += " " +
drawLatestRuns(testFail.histBaseBranch.latestRuns); // has both base and
current, draw current base runs here.
+ }
} else if (haveWeb) {
histContent += " (test history)";
}
@@ -638,13 +645,15 @@ function showTestFailData(testFail, isFailureShown,
settings) {
res += "<td>";
- if (haveWeb)
- res += "<a href='" + testFail.webUrl + "'>";
+ var haveBaseBranchWeb = isDefinedAndFilled(testFail.webUrlBaseBranch);
+ if (haveBaseBranchWeb)
+ res += "<a href='" + testFail.webUrlBaseBranch + "'>";
res += histContent;
- if (haveWeb)
+ if (haveBaseBranchWeb)
res += "</a>";
+
res += " </td>";
res += "</td></tr>";