[JENKINS-53175] avoid 404 by returning an empty BlueTestSummary (#1799)

Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
Olivier Lamy 2018-08-24 12:17:53 +10:00 committed by GitHub
parent 96a2bb2f9d
commit 1a34a1c7bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -235,7 +235,7 @@ public abstract class AbstractRunImpl<T extends Run> extends BlueRun {
@Override
public BlueTestSummary getBlueTestSummary() {
BlueTestSummary blueTestSummary;
BlueTestSummary blueTestSummary = null;
if (getStateObj() == BlueRunState.FINISHED) {
try {
blueTestSummary = TEST_SUMMARY.get(run.getExternalizableId(), () -> {
@ -248,20 +248,16 @@ public abstract class AbstractRunImpl<T extends Run> extends BlueRun {
).orNull();
} catch (ExecutionException e) {
LOGGER.error("Could not load test summary from cache", e);
return null;
}
} else {
blueTestSummary = BlueTestResultFactory.resolve(run, this).summary;
if (blueTestSummary == null) {
// Just use an empty one while we wait
blueTestSummary = new BlueTestSummary(0,0,0,0,0,0,0,this.getLink());
}
}
// .../runs/123/blueTestSummary
if (blueTestSummary == null)
{
return null;
// Just use an empty one while we wait to avoid 404
return new BlueTestSummary(0,0,0,0,0,0,0,this.getLink());
}
Link link = this.getLink().rel("blueTestSummary");
blueTestSummary.setLink( link );