Skip to content
Permalink
Browse files
New tracked branch test selection option: Show muted/show ignored tes…
…ts (#146)

Show muted and ignored tests mode implementation started, added muted &ignored tests to report
  • Loading branch information
dspavlov committed Aug 6, 2019
1 parent aa2ca9f commit 228526eeedd00419dfb10ea704747e07c85a33f6
Show file tree
Hide file tree
Showing 20 changed files with 219 additions and 110 deletions.
@@ -581,7 +581,7 @@ protected String checkFailuresEx(String brachName) {
null,
DisplayMode.None,
null,
-1);
-1, false, false);

DsSummaryUi failures =
tbProc.getTrackedBranchTestFailures(brachName,
@@ -594,7 +594,7 @@ protected String checkFailuresEx(String brachName) {
null,
DisplayMode.OnlyFailures,
null,
-1);
-1, false, false);

String issRes = registerIssuesAndNotifyLater(failures, backgroundOpsCreds);

@@ -92,7 +92,7 @@ public void showChainOnServersResults(StringBuilder res, Integer buildId, String
status.chainName = ctx.suiteName();

IStringCompactor c = injector.getInstance(IStringCompactor.class);
status.initFromContext(tcIgn, ctx, failRateBranch, c, false, null, null, -1, null);
status.initFromContext(tcIgn, ctx, failRateBranch, c, false, null, null, -1, null, false, false);

res.append(showChainAtServerData(status));

@@ -141,7 +141,7 @@ public DsSummaryUi getBuildTestFailsNoSync(
if (cnt > 0)
runningUpdates.addAndGet(cnt);

chainStatus.initFromContext(tcIgnited, ctx, failRateBranch, injector.getInstance(IStringCompactor.class), false, null, null, -1, null);
chainStatus.initFromContext(tcIgnited, ctx, failRateBranch, injector.getInstance(IStringCompactor.class), false, null, null, -1, null, false, false);

res.addChainOnServer(chainStatus);

@@ -75,10 +75,12 @@ public UpdateInfo getTestFailsUpdates(@Nullable @QueryParam("branch") String bra
@Nullable @QueryParam("displayMode") String displayMode,
@Nullable @QueryParam("sortOption") String sortOption,
@Nullable @QueryParam("count") Integer mergeCnt,
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) {
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan,
@Nullable @QueryParam("muted") Boolean showMuted,
@Nullable @QueryParam("ignored") Boolean showIgnored) {
return new UpdateInfo().copyFrom(
getTestFailsResultsNoSync(branchOrNull, checkAllLogs, trustedTests, tagSelected, tagForHistSelected,
displayMode, sortOption, mergeCnt, showTestLongerThan));
displayMode, sortOption, mergeCnt, showTestLongerThan, showMuted, showIgnored));
}

@GET
@@ -92,9 +94,11 @@ public String getTestFailsText(@Nullable @QueryParam("branch") String branchOrNu
@Nullable @QueryParam("displayMode") String displayMode,
@Nullable @QueryParam("sortOption") String sortOption,
@Nullable @QueryParam("count") Integer mergeCnt,
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) {
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan,
@Nullable @QueryParam("muted") Boolean showMuted,
@Nullable @QueryParam("ignored") Boolean showIgnored) {
return getTestFailsResultsNoSync(branchOrNull, checkAllLogs, trustedTests, tagSelected, tagForHistSelected,
displayMode, sortOption, mergeCnt, showTestLongerThan).toString();
displayMode, sortOption, mergeCnt, showTestLongerThan, showMuted, showIgnored).toString();
}

@GET
@@ -108,9 +112,11 @@ public DsSummaryUi getTestFailsResultsNoSync(
@Nullable @QueryParam("displayMode") String displayMode,
@Nullable @QueryParam("sortOption") String sortOption,
@Nullable @QueryParam("count") Integer mergeCnt,
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) {
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan,
@Nullable @QueryParam("muted") Boolean showMuted,
@Nullable @QueryParam("ignored") Boolean showIgnored) {
return latestBuildResults(branch, checkAllLogs, trustedTests, tagSelected, tagForHistSelected,
SyncMode.NONE, displayMode, sortOption, mergeCnt, showTestLongerThan);
SyncMode.NONE, displayMode, sortOption, mergeCnt, showTestLongerThan, showMuted, showIgnored);
}

@GET
@@ -125,9 +131,11 @@ public DsSummaryUi getTestFailsNoCache(
@Nullable @QueryParam("displayMode") String displayMode,
@Nullable @QueryParam("sortOption") String sortOption,
@Nullable @QueryParam("count") Integer mergeCnt,
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) {
@Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan,
@Nullable @QueryParam("muted") Boolean showMuted,
@Nullable @QueryParam("ignored") Boolean showIgnored) {
return latestBuildResults(branch, checkAllLogs, trustedTests, tagSelected, tagForHistSelected,
SyncMode.RELOAD_QUEUED, displayMode, sortOption, mergeCnt, showTestLongerThan);
SyncMode.RELOAD_QUEUED, displayMode, sortOption, mergeCnt, showTestLongerThan, showMuted, showIgnored);
}

@NotNull private DsSummaryUi latestBuildResults(
@@ -140,7 +148,9 @@ public DsSummaryUi getTestFailsNoCache(
@Nullable String displayMode,
@Nullable String sortOption,
@Nullable Integer mergeCnt,
@Nullable Integer showTestLongerThan) {
@Nullable Integer showTestLongerThan,
@Nullable Boolean showMuted,
@Nullable Boolean showIgnored) {
ITcBotUserCreds creds = ITcBotUserCreds.get(req);

Injector injector = CtxListener.getInjector(ctx);
@@ -150,11 +160,19 @@ public DsSummaryUi getTestFailsNoCache(
int maxDurationSec = (showTestLongerThan == null || showTestLongerThan < 1) ? 0 : showTestLongerThan;

return injector.getInstance(IDetailedStatusForTrackedBranch.class)
.getTrackedBranchTestFailures(branch, checkAllLogs, actualMergeBuilds, creds, mode,
Boolean.TRUE.equals(trustedTests), tagSelected, tagForHistSelected,
.getTrackedBranchTestFailures(branch,
checkAllLogs,
actualMergeBuilds,
creds,
mode,
Boolean.TRUE.equals(trustedTests),
tagSelected,
tagForHistSelected,
DisplayMode.parseStringValue(displayMode),
SortOption.parseStringValue(sortOption),
maxDurationSec);
maxDurationSec,
Boolean.TRUE.equals(showMuted),
Boolean.TRUE.equals(showIgnored));
}

@GET
@@ -193,7 +211,8 @@ public DsSummaryUi getAllTestFailsForMergedBuidls(@Nullable @QueryParam("branch"

return injector.getInstance(TrackedBranchChainsProcessor.class)
.getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit, creds, mode,
false, null, null, DisplayMode.OnlyFailures, null, -1);
false, null, null, DisplayMode.OnlyFailures, null,
-1, false, false);
}

/**
@@ -68,6 +68,8 @@
sortOption: 'FailureRate',
//count of builds to merge
count: 1,
muted: false,
ignored: false,
trustedTests: true,
checkAllLogs: false,
hideFlakyFailures: false,
@@ -115,6 +117,10 @@
gVue.$data.trustedTests = parm === "true";
}


gVue.$data.muted = findGetParameter("muted") === "true";
gVue.$data.ignored = findGetParameter("ignored") === "true";

gVue.$data.checkAllLogs = findGetParameter("checkAllLogs") === "true";
gVue.$data.hideFlakyFailures = findGetParameter("hideFlakyFailures") === "true";

@@ -147,45 +153,60 @@
var branch = findGetParameter("branch");
curReqParms += "?branch=" + (branch != null ? branch : "master");

if (gVue.$data.checkAllLogs != null) {
if (gVue.$data.checkAllLogs === true) {
curReqParms += "&checkAllLogs=" + gVue.$data.checkAllLogs;
}

if (gVue.$data.trustedTests != null) {
if (gVue.$data.trustedTests === false) {
curReqParms += "&trustedTests=" + gVue.$data.trustedTests;
}

if (gVue.$data.muted === true) {
curReqParms += "&muted=" + gVue.$data.muted;
}

if (gVue.$data.ignored === true) {
curReqParms += "&ignored=" + gVue.$data.ignored;
}

var tagSelected = gVue.$data.tagSelected;
if (tagSelected != null) {
if (tagSelected != null && tagSelected !== "") {
curReqParms += "&tagSelected=" + tagSelected;
}

var displayMode = gVue.$data.displayMode;
if (displayMode != null) {
if (displayMode != null && displayMode !== "" && displayMode !== "Failures") {
curReqParms += "&displayMode=" + displayMode;
}

var sortOption = gVue.$data.sortOption;
if (sortOption != null) {
if (sortOption != null && sortOption !== "" && sortOption !== "FailureRate") {
curReqParms += "&sortOption=" + sortOption;
}

if (gVue.$data.count != null)
curReqParms += "&count=" + gVue.$data.count;
let count = gVue.$data.count;
if (count != null && count > 1)
curReqParms += "&count=" + count;

if (gVue.$data.failRateRange[0] != null)
curReqParms += "&minFailRate=" + gVue.$data.failRateRange[0];
let minFailRate = gVue.$data.failRateRange[0];
if (minFailRate != null && minFailRate > 0)
curReqParms += "&minFailRate=" + minFailRate;

if (gVue.$data.failRateRange[1] != null)
curReqParms += "&maxFailRate=" + gVue.$data.failRateRange[1];
let maxFailRate = gVue.$data.failRateRange[1];
if (maxFailRate != null && maxFailRate < 100)
curReqParms += "&maxFailRate=" + maxFailRate;

curReqParms += "&hideFlakyFailures=" + gVue.$data.hideFlakyFailures;
let hideFlakyFailures = gVue.$data.hideFlakyFailures;
if (hideFlakyFailures != null && hideFlakyFailures === true)
curReqParms += "&hideFlakyFailures=" + hideFlakyFailures;

if (gVue.$data.tagForHistSelected != null)
curReqParms += "&tagForHistSelected=" + gVue.$data.tagForHistSelected;
let tagForHistSelected = gVue.$data.tagForHistSelected;
if (tagForHistSelected != null && tagForHistSelected !== "")
curReqParms += "&tagForHistSelected=" + tagForHistSelected;

if (gVue.$data.showTestLongerThan != null)
curReqParms += "&showTestLongerThan=" + gVue.$data.showTestLongerThan;
let runTime = gVue.$data.showTestLongerThan;
if (runTime != null && runTime > 0)
curReqParms += "&showTestLongerThan=" + runTime;

return curReqParms;
}
@@ -346,12 +367,20 @@
&nbsp;&nbsp;&nbsp;<span>Merge Builds: </span>
<input v-model.number="count" type="number" @change="formChanged">

<br><span title="Show trusted tests count">Trusted tests: </span>
<br>
<span title="Show muted tests">Muted: </span>
<input type="checkbox" v-model="muted" @change="formChanged">
&nbsp;&nbsp;&nbsp;
<span title="Show ignored tests">Ignored: </span>
<input type="checkbox" v-model="ignored" @change="formChanged">
&nbsp;&nbsp;&nbsp;

<span title="Show trusted tests count">Trusted tests: </span>
<input type="checkbox" v-model="trustedTests" @change="formChanged">
&nbsp;&nbsp;&nbsp;<span title="Download and parse all logs">Check logs: </span>
<input type="checkbox" v-model="checkAllLogs" @change="formChanged">

&nbsp;&nbsp;&nbsp;<span>Show test longer than, seconds: </span>
&nbsp;&nbsp;&nbsp;<span>Tests longer than, seconds: </span>
<input v-model.number="showTestLongerThan" type="number" @change="formChanged">
</td>

@@ -1024,16 +1024,23 @@ function drawLatestRuns(latestRuns) {
function drawLatestRunsBlock(state, len) {
var runColor = "white";

if (state === 0)
const resOk = 0;
if (state === resOk)
runColor = "green";
else if (state === 1)
runColor = "red";
else if (state === 2)
else if (state === 2) // deprected MUTED
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>";
else if (state === 3) // CRITICAL failure - incomplete suite
runColor = "#000000";
else if (state === 4) // RES_MISSING(4), missing in run
runColor = "#AAAAAA";
else if (state === 5) // RES_OK_MUTED(5),
runColor = "#44AA44";
else if (state === 6) // RES_FAILURE_MUTED(6),
runColor = "#b76a6a";
else if (state === 7) // RES_IGNORED(7);
runColor = "#F09F00";

return "<span style='background-color: " + runColor + "; width:" + (len * 1) + "px; height:10px; display: inline-block;'></span>";
}
@@ -122,7 +122,7 @@ public void testTrackedBranchChainsProcessor() {
1,
mock, SyncMode.RELOAD_QUEUED,
false, null, null, DisplayMode.OnlyFailures, null,
-1);
-1, false, false);

Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(failures));
@@ -86,7 +86,7 @@ public void initBuilds() {
}

@Test
public void testDetector() throws IOException {
public void testDetector() {
String brachName = "masterTest";
String chainId = TeamcityIgnitedImpl.DEFAULT_PROJECT_ID;
BranchTracked branch = new BranchTracked();
@@ -711,8 +711,9 @@ ISuiteRunHistory suiteHist(ITeamcityIgnited tcIgn,
}
}

public boolean hasTestToReport(ITeamcityIgnited tcIgnited, Integer baseBranchId) {
return !getFilteredTests(test -> test.includeIntoReport(tcIgnited, baseBranchId)).isEmpty();
public boolean hasTestToReport(ITeamcityIgnited tcIgnited, Integer baseBranchId, boolean showMuted,
boolean showIgnored) {
return !getFilteredTests(test -> test.includeIntoReport(tcIgnited, baseBranchId, showMuted, showIgnored)).isEmpty();
}

public boolean hasLongRunningTest(int maxSec) {
@@ -17,6 +17,13 @@

package org.apache.ignite.tcbot.engine.chain;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import org.apache.ignite.tcbot.common.TcBotConst;
import org.apache.ignite.tcbot.persistence.IStringCompactor;
import org.apache.ignite.tcignited.ITeamcityIgnited;
@@ -27,14 +34,6 @@
import org.apache.ignite.tcignited.history.ISuiteRunHistory;
import org.apache.ignite.tcservice.model.result.tests.TestOccurrence;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;

/**
* Test occurrence merged from several runs.
*/
@@ -173,14 +172,23 @@ public boolean isMutedOrIgored() {

/**
* Filter to determine if this test execution should be shown in the report of failures.
*
* @param tcIgnited Tc ignited.
* @param tcIgnited Tc ignited.
* @param baseBranchId Base branch id.
* @param showMuted
* @param showIgnored
*/
public boolean includeIntoReport(ITeamcityIgnited tcIgnited, Integer baseBranchId) {
public boolean includeIntoReport(ITeamcityIgnited tcIgnited, Integer baseBranchId,
boolean showMuted,
boolean showIgnored) {
if (isFailedButNotMuted())
return true;

if (showMuted && occurrences.stream().anyMatch(ITest::isMutedTest))
return true;

if (showIgnored && occurrences.stream().anyMatch(ITest::isIgnoredTest))
return true;

boolean longRun = getAvgDurationMs() > TcBotConst.MAX_NEW_TEST_DURATION_FOR_RUNALL_MS;

if (longRun)

0 comments on commit 228526e

Please sign in to comment.