chore(flaky): save build result (#4819)

This commit is contained in:
Andrey Lushnikov 2019-08-08 20:53:12 -07:00 committed by GitHub
parent 608b15f20d
commit 763e3901d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -215,7 +215,10 @@ const utils = module.exports = {
result: test.result,
});
});
testRunner.on('finished', () => dashboard.uploadAndCleanup());
testRunner.on('finished', async({result}) => {
dashboard.setBuildResult(result);
await dashboard.uploadAndCleanup();
});
function generateTestIDs(testRunner) {
const testIds = new Map();

View File

@ -48,6 +48,10 @@ class FlakinessDashboard {
this._build._tests.push(test);
}
setBuildResult(result) {
this._build._result = result;
}
async uploadAndCleanup() {
console.log(`\n${YELLOW_COLOR}=== UPLOADING Flakiness Dashboard${RESET_COLOR}`);
const startTimestamp = Date.now();
@ -99,6 +103,7 @@ async function saveBuildToDashboard(dashboardPath, build) {
throw new Error('Unrecognized dashboard format!');
data.builds.push({
version: DASHBOARD_VERSION,
result: build._result,
timestamp: build._timestamp,
url: build._url,
commit: build._commit,
@ -115,6 +120,7 @@ class Build {
this._url = url;
this._commit = commit;
this._tests = tests;
this._result = undefined;
}
}