@@ -761,9 +761,11 @@ class CITGMBuild extends TestBuild {
761
761
}
762
762
763
763
async getResults ( ) {
764
+ const { id } = this ;
765
+
764
766
let headerData ;
765
767
try {
766
- headerData = await this . getBuildData ( 'Header ' ) ;
768
+ headerData = await this . getBuildData ( 'Summary ' ) ;
767
769
} catch ( err ) {
768
770
this . failures = [
769
771
new NCUFailure ( { url : this . apiUrl } , err . message )
@@ -777,43 +779,51 @@ class CITGMBuild extends TestBuild {
777
779
// CITGM jobs store results in a different location than
778
780
// they do summary data, so we need to update the endpoint
779
781
// 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/` ;
781
784
782
785
let resultData ;
783
786
try {
784
- resultData = await this . getBuildData ( 'Report ' ) ;
787
+ resultData = await this . getBuildData ( 'Results ' ) ;
785
788
} catch ( err ) {
786
789
this . failures = [
787
790
new NCUFailure ( { url : this . apiUrl } , err . message )
788
791
] ;
789
792
return this . failures ;
790
793
}
791
794
792
- const { childReports } = resultData ;
795
+ this . results = this . parseResults ( resultData . childReports ) ;
793
796
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 } /` ;
795
799
796
800
return { result } ;
797
801
}
798
802
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
+
799
814
parseResults ( data ) {
800
- const results = { passes : [ ] , failures : [ ] , skips : [ ] , fixes : [ ] } ;
815
+ const results = { all : [ ] , failures : [ ] } ;
816
+
801
817
data . forEach ( platform => {
802
818
const cases = flatten ( platform . result . suites [ 0 ] . cases ) ;
803
819
const nodeName = getNodeName ( platform . child . url ) ;
804
820
805
- const passedModules = cases . filter ( c => c . status === 'PASSED' ) ;
806
- results . passes . push ( { [ nodeName ] : passedModules } ) ;
821
+ results . all . push ( { [ nodeName ] : cases } ) ;
807
822
808
823
const failedModules = cases . filter ( c => c . status === 'FAILED' ) ;
809
824
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 } ) ;
816
825
} ) ;
826
+
817
827
return results ;
818
828
}
819
829
@@ -831,11 +841,6 @@ class CITGMBuild extends TestBuild {
831
841
console . table ( output ) ;
832
842
}
833
843
834
- updateAPIVariables ( ) {
835
- this . tree = CITGM_REPORT_TREE ;
836
- this . path = `job/citgm-smoker/${ this . id } /testReport/` ;
837
- }
838
-
839
844
display ( ) {
840
845
this . displayHeader ( ) ;
841
846
this . displayBuilds ( ) ;
0 commit comments