Skip to content

Commit

Permalink
Merge 60429-60754 from panoramaweb18.2
Browse files Browse the repository at this point in the history
SVN r60756 |2018-10-22 01:02:02 +0000
  • Loading branch information
labkey-dave committed Oct 22, 2018
1 parent 46b69f4 commit 63d71ac
Show file tree
Hide file tree
Showing 30 changed files with 2,096 additions and 1,206 deletions.
21 changes: 15 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -139,30 +139,39 @@ testresults/resources/schemas/dbscripts/postgresql/testresults-13.30-13.31.sql -
testresults/resources/schemas/dbscripts/postgresql/testresults-13.31-13.32.sql -text
testresults/resources/schemas/dbscripts/postgresql/testresults-13.32-13.33.sql -text
testresults/resources/schemas/dbscripts/postgresql/testresults-13.33-13.34.sql -text
testresults/resources/schemas/dbscripts/postgresql/testresults-13.34-13.35.sql -text
testresults/resources/schemas/dbscripts/sqlserver/testresults-13.20-13.21.sql -text
testresults/resources/schemas/testresults.xml -text
testresults/src/org/labkey/testresults/RunDetail.java -text
testresults/src/org/labkey/testresults/SendTestResultsEmail.java -text
testresults/src/org/labkey/testresults/TRStats.java -text
testresults/src/org/labkey/testresults/TestFailDetail.java -text
testresults/src/org/labkey/testresults/TestLeakDetail.java -text
testresults/src/org/labkey/testresults/TestPassDetail.java -text
testresults/src/org/labkey/testresults/TestResultsContainerListener.java -text
testresults/src/org/labkey/testresults/TestResultsController.java -text
testresults/src/org/labkey/testresults/TestResultsManager.java -text
testresults/src/org/labkey/testresults/TestResultsModule.java -text
testresults/src/org/labkey/testresults/TestResultsSchema.java -text
testresults/src/org/labkey/testresults/TestResultsWebPart.java -text
testresults/src/org/labkey/testresults/TestsDataBean.java -text
testresults/src/org/labkey/testresults/User.java -text
testresults/src/org/labkey/testresults/model/BackgroundColor.java -text
testresults/src/org/labkey/testresults/model/RunDetail.java -text
testresults/src/org/labkey/testresults/model/TestFailDetail.java -text
testresults/src/org/labkey/testresults/model/TestHandleLeakDetail.java -text
testresults/src/org/labkey/testresults/model/TestLeakDetail.java -text
testresults/src/org/labkey/testresults/model/TestMemoryLeakDetail.java -text
testresults/src/org/labkey/testresults/model/TestPassDetail.java -text
testresults/src/org/labkey/testresults/model/User.java -text
testresults/src/org/labkey/testresults/view/LongTermBean.java -text
testresults/src/org/labkey/testresults/view/RunDownBean.java -text
testresults/src/org/labkey/testresults/view/TestsDataBean.java -text
testresults/src/org/labkey/testresults/view/errorFiles.jsp -text
testresults/src/org/labkey/testresults/view/failureDetail.jsp -text
testresults/src/org/labkey/testresults/view/flagged.jsp -text
testresults/src/org/labkey/testresults/view/longTerm.jsp -text
testresults/src/org/labkey/testresults/view/multiFailureDetail.jsp -text
testresults/src/org/labkey/testresults/view/runDetail.jsp -text
testresults/src/org/labkey/testresults/view/rundown.jsp -text
testresults/src/org/labkey/testresults/view/trainingdata.jsp -text
testresults/src/org/labkey/testresults/view/user.jsp -text
testresults/webapp/TestResults/css/style.css -text
testresults/webapp/TestResults/css/tablesorter-default.css -text
testresults/webapp/TestResults/img/asc.gif -text
testresults/webapp/TestResults/img/bg.gif -text
testresults/webapp/TestResults/img/desc.gif -text
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ALTER TABLE testresults.testleaks RENAME TO memoryleaks;
ALTER TABLE testresults.memoryleaks ADD COLUMN type VARCHAR(200);

CREATE TABLE testresults.handleleaks (
id serial,
testrunid INTEGER NOT NULL,
testName VARCHAR(200) NOT NULL,
handles double precision DEFAULT 0.0,
type VARCHAR(200),


CONSTRAINT PK_memoryleaks PRIMARY KEY (id),
CONSTRAINT FK_memoryleaks_testruns FOREIGN KEY (testrunid) REFERENCES testresults.testruns(id)
);

ALTER TABLE testresults.testpasses ADD COLUMN userandgdihandles INTEGER,
ADD COLUMN committedmemory INTEGER,
ADD COLUMN handles INTEGER;
94 changes: 57 additions & 37 deletions testresults/src/org/labkey/testresults/SendTestResultsEmail.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
import org.labkey.api.util.Pair;
import org.labkey.api.util.Path;
import org.labkey.api.view.ActionURL;
import org.labkey.testresults.model.BackgroundColor;
import org.labkey.testresults.model.RunDetail;
import org.labkey.testresults.model.TestFailDetail;
import org.labkey.testresults.model.TestMemoryLeakDetail;
import org.labkey.testresults.model.TestMemoryLeakDetail;
import org.labkey.testresults.model.User;
import org.labkey.testresults.view.RunDownBean;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

Expand Down Expand Up @@ -46,6 +53,10 @@ public SendTestResultsEmail()

}

private String getBackgroundStyle(BackgroundColor color) {
return "background-color:" + color + ";";
}

public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
// Sends email for all runs since 8:01 the previous morning, at 8am every morning
Container parent = ContainerManager.getForPath(new Path(new String[]{"home","development"}));
Expand Down Expand Up @@ -83,9 +94,9 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {

User[] users = TestResultsController.getTrainingDataForContainer(container);

TestsDataBean data = new TestsDataBean(runs, users);
RunDownBean data = new RunDownBean(runs, users);
Map<String, List<TestFailDetail>> todaysFailures = data.getFailedTestsByDate(new Date(), true);
Map<String, List<TestLeakDetail>> todaysLeaks = data.getLeaksByDate(new Date(), true);
Map<String, List<TestMemoryLeakDetail>> todaysLeaks = data.getLeaksByDate(new Date(), true);
User[] missingUsers = data.getMissingUsers(data.getRuns());
List<User> nightsUsers = new ArrayList<>();
// build message as an HTML email message
Expand Down Expand Up @@ -118,37 +129,50 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
totalPasses += run.getPassedtests();
nightsUsers.add(u);
boolean isGoodRun = true;
String style = "background-color:#3EC23E;";
boolean highlightDuration = false, highlightRuns = false, highlightMemory = false;
String style = getBackgroundStyle(BackgroundColor.pass);
// ERROR: duration < 540, failures or leaks count > 0, more then 3 standard deviations away
// WARNING: Between 2 and 3 standard deviations away
// PASS: within 2 standard deviations away as well as not an ERROR or a WARNING
int errorCount = errorRuns;
if (isGoodRun && (u.getMeanmemory() == 0d || u.getMeantestsrun() == 0d))
{ // IF NO TRAINING DATA FOR USER
style = "background-color:#cccccc;";
if (isGoodRun && (u.getMeanmemory() == 0d || u.getMeantestsrun() == 0d || !u.isActive()))
{ // IF NO TRAINING DATA FOR USER or INACTIVE
style = getBackgroundStyle(BackgroundColor.unknown);
isGoodRun = false;
}
if (run.getDuration() < 540 || run.getFailures().length > 0 || run.getLeaks().length > 0)
highlightDuration = run.getDuration() < 539;
if (highlightDuration || run.getFailures().length > 0 || run.getTestmemoryleaks().length > 0)
{
style = "background-color:#F24E4E;";
style = getBackgroundStyle(BackgroundColor.error);
isGoodRun = false;
errorRuns++;
}
if (isGoodRun && (!u.fitsMemoryTrainingData(run.getAverageMemory(), 3) || !u.fitsRunCountTrainingData(run.getPassedtests(), 3)))
if (isGoodRun)
{
style = "background-color:#F24E4E;";
isGoodRun = false;
if (errorCount == errorRuns)
errorRuns++;
highlightMemory = !u.fitsMemoryTrainingData(run.getAverageMemory(), 3);
highlightRuns = !u.fitsRunCountTrainingData(run.getPassedtests(), 3);
if (highlightMemory || highlightRuns)
{
style = getBackgroundStyle(BackgroundColor.error);
isGoodRun = false;
if (errorCount == errorRuns)
errorRuns++;
}
else
{
highlightMemory = !u.fitsMemoryTrainingData(run.getAverageMemory(), 2);
highlightRuns = !u.fitsRunCountTrainingData(run.getPassedtests(), 2);
if (highlightMemory || highlightRuns)
{
style = getBackgroundStyle(BackgroundColor.warn);
isGoodRun = false;
warningRuns++;
}
}
}
if (isGoodRun && (!u.fitsMemoryTrainingData(run.getAverageMemory(), 2) || !u.fitsRunCountTrainingData(run.getPassedtests(), 2)))
if(isGoodRun && run.hasHang())
{
style = "background-color:#F2C94E;";
isGoodRun = false;
warningRuns++;
}
if(isGoodRun && run.hasHang()) {
style = "background-color:#F2C94E;";
style = getBackgroundStyle(BackgroundColor.warn);
isGoodRun = false;
warningRuns++;
}
Expand All @@ -160,13 +184,13 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
message.append("\n<td style=\"" + style + " padding: 6px;\"><a href=\"" +
"http://skyline.ms" + new ActionURL(TestResultsController.ShowRunAction.class, container) + "runId=" + run.getId()
+ "\" target=\"_blank\" style=\"text-decoration:none; font-weight:600; color:black;\">"
+ run.getUsername() + "</a></td>");
message.append("\n<td style='padding: 6px;'>" + data.round(run.getAverageMemory(), 2) + "</td>");
message.append("\n<td style='padding: 6px;'>" + run.getPassedtests() + "</td>");
+ run.getUserName() + "</a></td>");
message.append("\n<td style='padding: 6px; " + (highlightMemory ? style : "") + "'>" + data.round(run.getAverageMemory(), 2) + "</td>");
message.append("\n<td style='padding: 6px; " + (highlightRuns ? style : "") + "'>" + run.getPassedtests() + "</td>");
message.append("\n<td style='padding: 6px;'>" + run.getPostTime() + "</td>");
message.append("\n<td style='padding: 6px;'>" + run.getDuration() + "</td>");
message.append("\n<td style='padding: 6px; " + (run.getFailedtests() > 0 ? "color:red;" : "") + "'>" + run.getFailedtests() + "</td>");
message.append("\n<td style='padding: 6px; " + (run.getLeakedtests() > 0 ? "color:red;" : "") + "'>" + run.getLeakedtests() + "</td>");
message.append("\n<td style='padding: 6px; " + (highlightDuration ? style : "") + "'>" + run.getDuration() + "</td>");
message.append("\n<td style='padding: 6px; " + (run.getFailedtests() > 0 ? getBackgroundStyle(BackgroundColor.error) : "") + "'>" + run.getFailedtests() + "</td>");
message.append("\n<td style='padding: 6px; " + (run.getLeakedtests() > 0 ? getBackgroundStyle(BackgroundColor.error) : "") + "'>" + run.getLeakedtests() + "</td>");
message.append("</tr>");
}
}
Expand All @@ -180,13 +204,9 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
for (User u : missingUsers)
{
message.append("<tr style='border-bottom:1px solid grey;'>");
message.append("\n<td style=\"background-color:#F24E4E; padding: 6px;\">Missing " + u.getUsername() + "</td>");
message.append("\n<td style='background-color:#F24E4E; padding: 6px;'></td>");
message.append("\n<td style='background-color:#F24E4E; padding: 6px;'></td>");
message.append("\n<td style='background-color:#F24E4E; padding: 6px;'></td>");
message.append("\n<td style='background-color:#F24E4E; padding: 6px;'></td>");
message.append("\n<td style='background-color:#F24E4E; padding: 6px;'></td>");
message.append("\n<td style='background-color:#F24E4E; padding: 6px;'></td>");
message.append("\n<td style='" + getBackgroundStyle(BackgroundColor.error) + " padding: 6px;'>Missing " + u.getUsername() + "</td>");
for (int i = 0; i < 6; i++)
message.append("\n<td style='" + getBackgroundStyle(BackgroundColor.error) + " padding: 6px;'></td>");
message.append("</tr>");
}
message.append("<tr style=\"float:right;\"><td></td><td></td><td></td><td></td><td></td><td></td><td>" + goodRuns + "/" + errorRuns + " (Pass/Fail)</td></tr>");
Expand All @@ -211,7 +231,7 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
addUser = true;
}
if (addUser)
message.append("\n<td style='max-width:60px; width:60px; overflow:hidden; text-overflow: ellipsis; padding:3px; border:1px solid #ccc;'>" + run.getUsername() + "</td>");
message.append("\n<td style='max-width:60px; width:60px; overflow:hidden; text-overflow: ellipsis; padding:3px; border:1px solid #ccc;'>" + run.getUserName() + "</td>");
else
noFailLeakRuns.add(run.getId());

Expand Down Expand Up @@ -244,7 +264,7 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
}
message.append("\n</tr>");
}
for (Map.Entry<String, List<TestLeakDetail>> entry : todaysLeaks.entrySet())
for (Map.Entry<String, List<TestMemoryLeakDetail>> entry : todaysLeaks.entrySet())
{
message.append("\n<tr>");
message.append("\n<td style='overflow:hidden; text-overflow: ellipsis; padding:3px; border:1px solid #ccc;'>" + entry.getKey() + "</td>");
Expand All @@ -253,9 +273,9 @@ public Pair<String, String> getHTMLEmail(org.labkey.api.security.User from) {
if (noFailLeakRuns.contains(run.getId()))
continue;
message.append("\n<td style='width:60px; overflow:hidden; padding:3px; border:1px solid #ccc;'>");
TestLeakDetail matchingLeak = null;
TestMemoryLeakDetail matchingLeak = null;

for (TestLeakDetail leak : entry.getValue())
for (TestMemoryLeakDetail leak : entry.getValue())
{
if (leak.getTestRunId() == run.getId())
{
Expand Down
Loading

0 comments on commit 63d71ac

Please sign in to comment.