Skip to content

Commit 8108ffd

Browse files
committed
Miscellaneous cleanup
1 parent b8f8c74 commit 8108ffd

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

bin/ncu-ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class CICommand {
260260
if (this.json.length) {
261261
writeJson(argv.json, this.json);
262262
cli.separator('');
263-
cli.log(`Written JSON to ${argv.json}`);
263+
cli.log(`Wrote JSON to ${argv.json}`);
264264
} else {
265265
cli.error('No JSON generated');
266266
}

lib/ci/ci_result_parser.js

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,11 @@ class CITGMBuild extends TestBuild {
761761
}
762762

763763
async getResults() {
764+
const { id } = this;
765+
764766
let headerData;
765767
try {
766-
headerData = await this.getBuildData('Header');
768+
headerData = await this.getBuildData('Summary');
767769
} catch (err) {
768770
this.failures = [
769771
new NCUFailure({ url: this.apiUrl }, err.message)
@@ -777,43 +779,51 @@ class CITGMBuild extends TestBuild {
777779
// CITGM jobs store results in a different location than
778780
// they do summary data, so we need to update the endpoint
779781
// and issue a second API call in order to fetch result data.
780-
this.updateAPIVariables();
782+
this.tree = CITGM_REPORT_TREE;
783+
this.path = `job/citgm-smoker/${this.id}/testReport/`;
781784

782785
let resultData;
783786
try {
784-
resultData = await this.getBuildData('Report');
787+
resultData = await this.getBuildData('Results');
785788
} catch (err) {
786789
this.failures = [
787790
new NCUFailure({ url: this.apiUrl }, err.message)
788791
];
789792
return this.failures;
790793
}
791794

792-
const { childReports } = resultData;
795+
this.results = this.parseResults(resultData.childReports);
793796

794-
this.results = this.parseResults(childReports);
797+
// Update id again so that it correctly displays in Summary output.
798+
this.path = `job/citgm-smoker/${id}/`;
795799

796800
return { result };
797801
}
798802

803+
formatAsJson() {
804+
const { results } = this;
805+
806+
const result = results.all.map(item => Object.assign({
807+
source: this.sourceURL,
808+
upstream: this.jobUrl
809+
}, item));
810+
811+
return JSON.parse(JSON.stringify(result));
812+
}
813+
799814
parseResults(data) {
800-
const results = { passes: [], failures: [], skips: [], fixes: [] };
815+
const results = { all: [], failures: [] };
816+
801817
data.forEach(platform => {
802818
const cases = flatten(platform.result.suites[0].cases);
803819
const nodeName = getNodeName(platform.child.url);
804820

805-
const passedModules = cases.filter(c => c.status === 'PASSED');
806-
results.passes.push({ [nodeName]: passedModules });
821+
results.all.push({ [nodeName]: cases });
807822

808823
const failedModules = cases.filter(c => c.status === 'FAILED');
809824
results.failures.push({ [nodeName]: failedModules });
810-
811-
const skippedModules = cases.filter(c => c.status === 'SKIPPED');
812-
results.skips.push({ [nodeName]: skippedModules });
813-
814-
const fixedModules = cases.filter(c => c.status === 'FIXED');
815-
results.fixes.push({ [nodeName]: fixedModules });
816825
});
826+
817827
return results;
818828
}
819829

@@ -831,11 +841,6 @@ class CITGMBuild extends TestBuild {
831841
console.table(output);
832842
}
833843

834-
updateAPIVariables() {
835-
this.tree = CITGM_REPORT_TREE;
836-
this.path = `job/citgm-smoker/${this.id}/testReport/`;
837-
}
838-
839844
display() {
840845
this.displayHeader();
841846
this.displayBuilds();

0 commit comments

Comments
 (0)