Skip to content
Permalink
Browse files
IGNITE-11853: Links fixed for tests failures, trusted suites developm…
…ent, filtering old issues, filtering disabled issues, possible blockers simplified. (#124)
  • Loading branch information
dspavlov committed May 16, 2019
1 parent 343983d commit 472e1dd308130a11948c6b3478b65cf5239d01f8
Showing 36 changed files with 588 additions and 331 deletions.
@@ -30,7 +30,9 @@
{"value":"%env.JDK_OPEN_11%", "label":"JDK11"}
]
}
]
],
/** Build type IDs, which should trigger notifications about any non build problem, and should be blocker in this case. **/
"trustedSuites": []
}
],
/* Set of JIRA servers/projects configured */
@@ -102,7 +104,9 @@
"suiteId": "IgniteTests24Java8_RunAll",
"branchForRest": "\u003cdefault\u003e"
}
]
],
/* Disable notifications for the following issue types. See {@link IssueType#code()}. */
"disableIssueTypes": []
},
{
"id": "master-nightly",
@@ -128,7 +132,9 @@
}
]
}
]
],
/* Disable notifications for the following issue types. See {@link IssueType#code()}. */
"disableIssueTypes": []
},
{
"id": "ignite-2.7.5",
@@ -139,7 +145,9 @@
"branchForRest": "ignite-2.7.5",
"baseBranchForTc": "\u003cdefault\u003e"
}
]
],
/* Disable notifications for the following issue types. See {@link IssueType#code()}. */
"disableIssueTypes": []
},
{
"id": "ignite-2.7.5-nightly",
@@ -152,7 +160,9 @@
"triggerBuild": true,
"triggerBuildQuietPeriod": 30 //triggering quiet period in minutes
}
]
],
/* Disable notifications for the following issue types. See {@link IssueType#code()}. */
"disableIssueTypes": []
}
]
}
@@ -18,6 +18,7 @@
package org.apache.ignite.ci.analysis;

import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrenceFull;
import org.apache.ignite.ci.teamcity.ignited.IRunHistory;

/**
* Multiple test occurrence. For single build context - max 1 failure
@@ -32,4 +33,6 @@ public interface IMultTestOccurrence {
public long getAvgDurationMs();

Iterable<TestOccurrenceFull> getOccurrences();

String getPossibleBlockerComment(IRunHistory baseBranchStat);
}
@@ -22,18 +22,25 @@
*/
public interface ISuiteResults {
/** */
boolean hasCompilationProblem();
public boolean hasCompilationProblem();

/** */
boolean hasMetricProblem();
public boolean hasMetricProblem();

boolean hasTimeoutProblem();
/** */
public boolean hasTimeoutProblem();

/** */
public boolean hasJvmCrashProblem();

boolean hasJvmCrashProblem();
/** */
public boolean hasOomeProblem();

boolean hasOomeProblem();
/** */
public boolean hasExitCodeProblem();

boolean hasExitCodeProblem();
/** */
public boolean hasBuildMessageProblem();

default boolean hasCriticalProblem() {
return hasJvmCrashProblem()
@@ -51,5 +58,5 @@ default boolean hasSuiteIncompleteFailure() {
|| hasMetricProblem();
}

String suiteId();
public String suiteId();
}
@@ -32,9 +32,11 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.tcmodel.result.problems.ProblemOccurrence;
import org.apache.ignite.ci.tcmodel.result.stat.Statistics;
import org.apache.ignite.ci.teamcity.ignited.IRunHistory;
import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
import org.apache.ignite.ci.teamcity.ignited.change.ChangeCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.ProblemCompacted;
@@ -94,6 +96,11 @@ public String suiteId() {
return firstBuildInfo.suiteId();
}

/** {@inheritDoc} */
@Override public boolean hasBuildMessageProblem() {
return getBuildMessageProblemCount() > 0;
}

public String buildTypeId() {
return firstBuildInfo.buildTypeId;
}
@@ -107,8 +114,7 @@ public boolean onlyCancelledBuilds() {
return buildsStream().allMatch(bCtx -> !bCtx.isComposite() && bCtx.isCancelled());
}

@NotNull
private Stream<ProblemCompacted> allProblemsInAllBuilds() {
@NotNull public Stream<ProblemCompacted> allProblemsInAllBuilds() {
return buildsStream().flatMap(SingleBuildRunCtx::getProblemsStream);
}

@@ -126,6 +132,11 @@ public long getMetricProblemCount() {
return buildsStream().filter(ISuiteResults::hasMetricProblem).count();
}

/** */
public long getBuildMessageProblemCount() {
return buildsStream().filter(ISuiteResults::hasBuildMessageProblem).count();
}

/** {@inheritDoc} */
@Override public boolean hasCompilationProblem() {
return getCompilationProblemCount() > 0;
@@ -184,7 +195,7 @@ public int failedTests() {
public String getResult() {
StringBuilder res = new StringBuilder();

long cancelledCnt = buildsStream().filter(bCtx -> !bCtx.isComposite() && bCtx.isCancelled()).count();
long cancelledCnt = getCancelledBuildsCount();

if (cancelledCnt > 0) {
res.append(CANCELLED);
@@ -221,15 +232,21 @@ public String getResult() {
}
}

addKnownProblemCnt(res, ProblemOccurrence.JAVA_LEVEL_DEADLOCK, getJavaLevelDeadlocksCount());

return res.toString();
}

public long getJavaLevelDeadlocksCount() {
List<LogCheckResult> collect = getLogChecksIfFinished().collect(Collectors.toList());

long javaDeadlocks = collect.stream().map(LogCheckResult::getCustomProblems)
return collect.stream().map(LogCheckResult::getCustomProblems)
.filter(set -> set.contains(ProblemOccurrence.JAVA_LEVEL_DEADLOCK))
.count();
}

addKnownProblemCnt(res, ProblemOccurrence.JAVA_LEVEL_DEADLOCK, javaDeadlocks);

return res.toString();
public long getCancelledBuildsCount() {
return buildsStream().filter(bCtx -> !bCtx.isComposite() && bCtx.isCancelled()).count();
}

public void addKnownProblemCnt(StringBuilder res, String nme, long execToCnt) {
@@ -461,4 +478,93 @@ public Stream<LogCheckResult> getLogChecksIfFinished() {
public Set<String> tags() {
return buildsStream().flatMap(b -> b.tags().stream()).collect(Collectors.toSet());
}

/**
* Classify suite if it is blossible blocker or not.
* @param compactor Compactor.
* @param baseBranchHist Base branch history for suite.
* @param tcSrvCfg
*/
@NotNull public String getPossibleBlockerComment(@Nonnull IStringCompactor compactor,
@Nullable IRunHistory baseBranchHist,
@Nonnull ITcServerConfig tcSrvCfg) {
StringBuilder res = new StringBuilder();

long cancelledCnt = getCancelledBuildsCount();

if (cancelledCnt > 0) {
res.append("Suite was cancelled, cancellation is always a blocker ");

if (cancelledCnt > 1)
res.append(" [").append(cancelledCnt).append("] \n");
}

addKnownProblemAsPossibleBlocker(res, "Timeout", getExecutionTimeoutCount(), baseBranchHist, true);
addKnownProblemAsPossibleBlocker(res, "Jvm Crash", getJvmCrashProblemCount(), baseBranchHist, true);
addKnownProblemAsPossibleBlocker(res, "Failure on metric", getMetricProblemCount(), baseBranchHist, true);
addKnownProblemAsPossibleBlocker(res, "Compilation Error", getCompilationProblemCount(), baseBranchHist, true);

addKnownProblemAsPossibleBlocker(res, "Out Of Memory Error", getBuildMessageProblemCount(), baseBranchHist, false);
addKnownProblemAsPossibleBlocker(res, "Out Of Memory Error", getOomeProblemCount(), baseBranchHist, false);
addKnownProblemAsPossibleBlocker(res, "Exit Code", getExitCodeProblemsCount(), baseBranchHist, false);

if(hasAnyBuildProblemExceptTestOrSnapshot() && tcSrvCfg.trustedSuites().contains(suiteId())) {
res.append("Suite is trusted but has build problems");

res.append("[");
res.append(allProblemsInAllBuilds()
.filter(p -> !p.isFailedTests(compactor) && !p.isSnapshotDepProblem(compactor))
.map(p -> p.type(compactor)).distinct().collect(Collectors.joining(", ")));
res.append("] ");

appendFailRate(baseBranchHist, res).append(" \n");
}

long jldl = getJavaLevelDeadlocksCount();
if (jldl > 0) {
res.append("Java Level Deadlock detected, it is unconditional blocker")
.append(" ")
.append(jldl > 1 ? "[" + jldl + "]" : "")
.append(" \n");
}

return res.toString();
}

public void addKnownProblemAsPossibleBlocker(StringBuilder res, String nme, long execToCnt,
@Nullable IRunHistory baseBranchHist, boolean critical) {
if (execToCnt <= 0)
return;

res.append(nme).append(" is a blocker. ");

if (critical)
appendCriticalFailRate(baseBranchHist, res);
else
appendFailRate(baseBranchHist, res);

res.append(execToCnt > 1 ? "[" + execToCnt + "]" : "").append(" \n");
}

public StringBuilder appendFailRate(IRunHistory baseBranchHist, StringBuilder res) {
if (baseBranchHist == null)
return res;

res.append("Base branch fail rate is ");
res.append(baseBranchHist.getFailPercentPrintable());
res.append("% ");

return res;
}

public StringBuilder appendCriticalFailRate(IRunHistory baseBranchHist, StringBuilder res) {
if (baseBranchHist == null)
return res;

res.append("Base branch critical fail rate is ");
res.append(baseBranchHist.getCriticalFailPercentPrintable());
res.append("% ");

return res;
}
}
@@ -119,6 +119,10 @@ Stream<ProblemCompacted> getProblemsStream() {
return compactor.getStringFromId(buildCompacted.buildTypeId());
}

@Override public boolean hasBuildMessageProblem() {
return getProblemsStream().anyMatch(p -> p.isBuildFailureOnMessage(compactor));
}

public void setLogCheckResFut(CompletableFuture<LogCheckResult> logCheckResFut) {
this.logCheckResFut = logCheckResFut;
}
@@ -22,6 +22,7 @@
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrenceFull;
import org.apache.ignite.ci.teamcity.ignited.IRunHistory;
import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.TestCompacted;

@@ -77,6 +78,23 @@ private int getFailedButNotMutedCount() {
.collect(Collectors.toList());
}

@Override public String getPossibleBlockerComment(IRunHistory baseBranchStat) {
if (baseBranchStat == null)
return "History for base branch is absent.";

String flakyComments = baseBranchStat.getFlakyComments();

boolean lowFailureRate = baseBranchStat.getFailRate() * 100.0f < 4.;

if (lowFailureRate && flakyComments == null) {
return "Test has low fail rate in base branch "
+ baseBranchStat.getFailPercentPrintable()
+ "% and is not flaky";
}

return null;
}

public void add(TestCompacted next) {
occurrences.add(next);
}
@@ -33,7 +33,7 @@
@SuppressWarnings("WeakerAccess")
@Persisted
public class Issue {
/** Type. Null of older versions of issue */
/** Type code. Null of older versions of issue */
@Nullable
private String type;

@@ -55,7 +55,10 @@ public class Issue {
@Nullable
public String displayName;

/** Build start timestamp. */
@Nullable public Long buildStartTs;

/** Detected timestamp. */
@Nullable public Long detectedTs;

public Issue(IssueKey issueKey, IssueType type) {
@@ -209,4 +212,8 @@ public String toPlainText(boolean includeChangesInfo) {

return sb.toString();
}

public String type() {
return type;
}
}

0 comments on commit 472e1dd

Please sign in to comment.