@@ -28,7 +28,9 @@ use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIter
28
28
// Time handling
29
29
use chrono:: { Local , Utc } ;
30
30
31
- use junit_report:: { DateTime , Report , TestCase , TestSuite } ;
31
+ use junit_report:: {
32
+ DateTime , ReportBuilder , TestCase , TestCaseBuilder , TestSuite , TestSuiteBuilder ,
33
+ } ;
32
34
33
35
// Monitoring;
34
36
use prometheus:: register_gauge_vec;
@@ -159,7 +161,7 @@ fn run_sync_task(v: &[MirrorResult], label: &str, opts: &MirrorOptions) -> TestS
159
161
. with_label_values ( & [ & x. origin , & x. destination , & label] )
160
162
. set ( Utc :: now ( ) . timestamp ( ) as f64 ) ;
161
163
proj_ok. with_label_values ( & [ & label] ) . inc ( ) ;
162
- TestCase :: success ( & name, Utc :: now ( ) - start)
164
+ TestCaseBuilder :: success ( & name, Utc :: now ( ) - start) . build ( )
163
165
}
164
166
Err ( e) => {
165
167
println ! (
@@ -175,12 +177,13 @@ fn run_sync_task(v: &[MirrorResult], label: &str, opts: &MirrorOptions) -> TestS
175
177
. set ( Utc :: now ( ) . timestamp ( ) as f64 ) ;
176
178
proj_fail. with_label_values ( & [ & label] ) . inc ( ) ;
177
179
error ! ( "Unable to sync repo {} ({})" , name, e) ;
178
- TestCase :: error (
180
+ TestCaseBuilder :: error (
179
181
& name,
180
182
Utc :: now ( ) - start,
181
183
"sync error" ,
182
184
& format ! ( "{:?}" , e) ,
183
185
)
186
+ . build ( )
184
187
}
185
188
}
186
189
}
@@ -191,11 +194,12 @@ fn run_sync_task(v: &[MirrorResult], label: &str, opts: &MirrorOptions) -> TestS
191
194
match e {
192
195
MirrorError :: Description ( d, se) => {
193
196
error ! ( "Error parsing YAML: {}, Error: {:?}" , d, se) ;
194
- TestCase :: error ( "" , duration, "parse error" , & format ! ( "{:?}" , e) )
197
+ TestCaseBuilder :: error ( "" , duration, "parse error" , & format ! ( "{:?}" , e) )
198
+ . build ( )
195
199
}
196
200
MirrorError :: Skip ( url) => {
197
201
println ! ( "SKIP {}/{} [{}]: {}" , i, total, Local :: now( ) , url) ;
198
- TestCase :: skipped ( url)
202
+ TestCaseBuilder :: skipped ( url) . build ( )
199
203
}
200
204
}
201
205
}
@@ -204,8 +208,9 @@ fn run_sync_task(v: &[MirrorResult], label: &str, opts: &MirrorOptions) -> TestS
204
208
. collect :: < Vec < TestCase > > ( ) ;
205
209
206
210
let success = results. iter ( ) . filter ( |ref x| x. is_success ( ) ) . count ( ) ;
207
- let ts = TestSuite :: new ( "Sync Job" ) ;
208
- let ts = ts. add_testcases ( results) ;
211
+ let ts = TestSuiteBuilder :: new ( "Sync Job" )
212
+ . add_testcases ( results)
213
+ . build ( ) ;
209
214
println ! ( "DONE [{2}]: {0}/{1}" , success, total, Local :: now( ) ) ;
210
215
ts
211
216
}
@@ -294,7 +299,7 @@ fn write_metrics(f: &Path) {
294
299
}
295
300
296
301
fn write_junit_report ( f : & Path , ts : TestSuite ) {
297
- let report = Report :: default ( ) . add_testsuite ( ts) ;
302
+ let report = ReportBuilder :: default ( ) . add_testsuite ( ts) . build ( ) ;
298
303
let mut file = File :: create ( f) . unwrap ( ) ;
299
304
report. write_xml ( & mut file) . unwrap ( ) ;
300
305
}
0 commit comments