Skip to content

Commit

Permalink
chore(flaky): save build result (#4819)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov authored Aug 9, 2019
1 parent 608b15f commit 763e390
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions utils/flakiness-dashboard/FlakinessDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand All @@ -115,6 +120,7 @@ class Build {
this._url = url;
this._commit = commit;
this._tests = tests;
this._result = undefined;
}
}

Expand Down

0 comments on commit 763e390

Please sign in to comment.