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/12 17:35:59 UTC
[ignite-teamcity-bot] 01/02: Board changes for displaying defects -
Fixes #151.
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
commit 5f181f54a612704dffaccb41c0cbf0c457775317
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Mon Aug 12 20:35:33 2019 +0300
Board changes for displaying defects - Fixes #151.
Signed-off-by: Dmitriy Pavlov <dp...@apache.org>
---
.../src/main/webapp/board/index.html | 18 +++++---
.../ignite/tcbot/engine/board/BoardService.java | 23 +++++++---
.../tcbot/engine/ui/BoardDefectSummaryUi.java | 50 +++++++++++++++++++++-
3 files changed, 78 insertions(+), 13 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/webapp/board/index.html b/ignite-tc-helper-web/src/main/webapp/board/index.html
index 02e4f3d..5f9c86a 100644
--- a/ignite-tc-helper-web/src/main/webapp/board/index.html
+++ b/ignite-tc-helper-web/src/main/webapp/board/index.html
@@ -50,10 +50,12 @@
headers: [
{text: "Branch", value: 'branch'},
{text: 'Tags', value: 'tags'},
- {text: 'Suites', value: 'suites'},
+ {text: 'Suites', value: 'suitesSummary'},
+ {text: "Commits", value: 'blameCandidateSummary'},
{text: "Issues", value: 'cntissues'},
{text: "Fixed", value: 'fixedissues'},
- {text: "Not Fixed", value: 'notfixedissues'}
+ {text: "Not Fixed", value: 'notfixedissues'},
+ {text: "Unclear", value: 'unclearissues'}
]
},
methods: {
@@ -151,7 +153,7 @@
:items="defects"
itrackedBranchtem-key="id"
class="elevation-1"
- group-by="branch"
+ sort-by="branch"
:expanded.sync="expanded"
show-expand
dense
@@ -187,10 +189,14 @@
{{ item.cntIssues }}
</template>
<template v-slot:item.fixedIssues="{ item }">
- <span class='visaStage' style="background: #12AD5E"> {{ item.fixedIssues }} </span>
+ <span class='visaStage' style="background: #12AD5E" v-if="item.fixedIssues!=null" > {{ item.fixedIssues }} </span>
</template>
- <template v-slot:item.notFixedIssues="{ item }">
- <span class='visaStage' style="background: red"> {{ item.notFixedIssues }} </span>
+ <template v-slot:item.notFixedIssues="{ item }" >
+ <span class='visaStage' style="background: red" v-if="item.notFixedIssues!=null" > {{ item.notFixedIssues }} </span>
+ </template>
+
+ <template v-slot:item.unclearIssues="{ item }" >
+ <span class='visaStage' style="background: grey" v-if="item.unclearIssues!=null" > {{ item.unclearIssues }} </span>
</template>
</v-data-table>
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/board/BoardService.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/board/BoardService.java
index d7ff93e..0d4291d 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/board/BoardService.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/board/BoardService.java
@@ -18,13 +18,13 @@ package org.apache.ignite.tcbot.engine.board;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject;
@@ -117,12 +117,14 @@ public class BoardService {
defectUi.addFixedIssue();
else
defectUi.addNotFixedIssue();
- }
+ } else
+ defectUi.addUnclearIssue();
String testOrBuildName = compactor.getStringFromId(issue.testNameCid());
defectUi.addIssue(testOrBuildName, "");
}
- }
+ } else
+ defectUi.addUnclearIssue();
}
defectUi.branch = next.tcBranch(compactor);
@@ -138,15 +140,18 @@ public class BoardService {
}
@MonitoredTask(name = "Convert issues to defect")
- protected void issuesToDefects() {
+ protected String issuesToDefects() {
Stream<Issue> stream = issuesStorage.allIssues();
- long minIssueTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(3);
+ //todo make property how old issues can be considered as configuration parameter
+ long minIssueTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(5);
//todo not so good to to call init() twice
fatBuildDao.init();
changeDao.init();
+ AtomicInteger cntIssues = new AtomicInteger();
+ AtomicInteger cntDefects = new AtomicInteger();
stream
.filter(issue -> {
long detected = issue.detectedTs == null ? 0 : issue.detectedTs;
@@ -158,6 +163,8 @@ public class BoardService {
return !IssueType.newContributedTestFailure.code().equals(type);
})
.forEach(issue -> {
+ cntIssues.incrementAndGet();
+
IssueKey key = issue.issueKey;
String srvCode = key.getServer();
//just for init call
@@ -177,11 +184,16 @@ public class BoardService {
int tcSrvCodeCid = compactor.getStringId(srvCode);
defectStorage.merge(tcSrvCodeCid, srvId, fatBuild,
(k, defect) -> {
+ cntDefects.incrementAndGet();
+
defect.trackedBranchCidSetIfEmpty(trackedBranchCid);
defect.computeIfAbsent(fatBuild).addIssue(issueTypeCid, testNameCid);
if(defect.blameCandidates().isEmpty()) {
+ //save changes because it can be missed in older DB versions
+ defect.changeMap(changeDao.getAll(srvId, fatBuild.changes()));
+
Map<Integer, ChangeCompacted> map = defect.changeMap();
Collection<ChangeCompacted> values = map.values();
@@ -197,5 +209,6 @@ public class BoardService {
});
+ return cntDefects.get() + " defects processed for " + cntIssues.get() + " issues checked";
}
}
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/BoardDefectSummaryUi.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/BoardDefectSummaryUi.java
index 1d4e0af..5cd1a13 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/BoardDefectSummaryUi.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/BoardDefectSummaryUi.java
@@ -20,7 +20,9 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.function.Function;
import java.util.stream.Collectors;
+import org.apache.ignite.tcbot.engine.defect.BlameCandidate;
import org.apache.ignite.tcbot.engine.defect.DefectCompacted;
import org.apache.ignite.tcbot.persistence.IStringCompactor;
@@ -33,9 +35,10 @@ public class BoardDefectSummaryUi {
public Integer cntIssues;
public Integer fixedIssues;
public Integer notFixedIssues;
+ public Integer unclearIssues;
public List<String> testOrSuitesAffected = new ArrayList<>();
- public Set<String> tags = new HashSet<>();
+ private Set<String> tags = new HashSet<>();
public BoardDefectSummaryUi(DefectCompacted defect, IStringCompactor compactor) {
this.defect = defect;
@@ -43,7 +46,8 @@ public class BoardDefectSummaryUi {
}
public Set<String> getTags() {
- return tags;
+ //todo bad code, make tag filter configurable.
+ return tags.stream().filter(t -> t.length() <= 2).collect(Collectors.toSet());
}
public List<String> getSuites() {
@@ -52,10 +56,45 @@ public class BoardDefectSummaryUi {
).distinct().map(compactor::getStringFromId).collect(Collectors.toList());
}
+ public String getSuitesSummary() {
+ List<String> suites = getSuites();
+
+ return limitedListPrint(suites, t -> t);
+ }
+
+ public <X> String limitedListPrint(List<X> suites, Function<X, String> elemToStr) {
+ StringBuilder res = new StringBuilder();
+ int i = 0;
+ for (X next : suites) {
+ if (i >= 3) {
+ int rest = suites.size() - i;
+
+ res.append(" ... and ").append(rest).append(" more");
+ break;
+ }
+ if (res.length() > 0)
+ res.append(", ");
+
+ res.append(elemToStr.apply(next));
+ i++;
+ }
+
+ return res.toString();
+ }
+
public List<String> getBlameCandidates() {
return defect.blameCandidates().stream().map(c -> c.vcsUsername(compactor)).collect(Collectors.toList());
}
+ public String getBlameCandidateSummary() {
+ List<BlameCandidate> blameCandidates = defect.blameCandidates();
+
+ if (blameCandidates.isEmpty())
+ return "";
+
+ return limitedListPrint(blameCandidates, next -> next.vcsUsername(compactor));
+ }
+
public String getTrackedBranch() {
return compactor.getStringFromId(defect.trackedBranchCid());
}
@@ -91,4 +130,11 @@ public class BoardDefectSummaryUi {
public void addTags(Set<String> parameters) {
this.tags.addAll(parameters);
}
+
+ public void addUnclearIssue() {
+ if (unclearIssues == null)
+ unclearIssues = 0;
+
+ unclearIssues++;
+ }
}