File tree Expand file tree Collapse file tree 3 files changed +19
-14
lines changed Expand file tree Collapse file tree 3 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -245,10 +245,11 @@ def flaky_tests():
245
245
246
246
print (f"Query for flaky tests took: { str (datetime .datetime .now () - t )} " )
247
247
248
- target_date = datetime .datetime .now () - datetime .timedelta (days = 14 )
249
- two_weeks = target_date .strftime ("%Y-%m-%d--%H-%M" )
250
- target_date = datetime .datetime .now () - datetime .timedelta (days = 28 )
251
- four_weeks = target_date .strftime ("%Y-%m-%d--%H-%M" )
248
+ weeks_ago = []
249
+ for weeks in range (1 , 5 ):
250
+ target_date = datetime .datetime .now () - datetime .timedelta (weeks = weeks )
251
+ weeks_ago .append (target_date .strftime ("%Y-%m-%d--%H-%M" ))
252
+
252
253
cnt = 0
253
254
res = {}
254
255
for row in rows :
@@ -258,13 +259,14 @@ def flaky_tests():
258
259
res [key ] = res .get (key , 0 ) + 1
259
260
else :
260
261
if key not in res :
261
- res [key ] = [0 , 0 ]
262
- if br_date >= two_weeks :
263
- res [key ][0 ] += 1
264
- elif br_date >= four_weeks :
265
- res [key ][1 ] += 1
262
+ res [key ] = [0 , 0 , 0 , 0 ]
263
+
264
+ for i in range (len (weeks_ago )):
265
+ if br_date >= weeks_ago [i ]:
266
+ res [key ][i ] += 1
267
+ break
266
268
else :
267
- break
269
+ break # stop looking at rows, the records are sorted by date
268
270
cnt += 1
269
271
# JSON needs a simple array, not a dict
270
272
data = []
Original file line number Diff line number Diff line change @@ -59,8 +59,7 @@ <h3>Flakiest tests</h3>
59
59
< th > Remote</ th >
60
60
< th > Executor</ th >
61
61
< th > Test</ th >
62
- < th > Flakes (now - 2w)</ th >
63
- < th > Flakes (2w - 4w)</ th >
62
+ < th colspan ="4 "> Flakes (by week: this, 1, 2, 3 ago)</ th >
64
63
< th > Ignored</ th >
65
64
</ tr >
66
65
</ table >
Original file line number Diff line number Diff line change @@ -1014,6 +1014,8 @@ function flakes_doit(data_raw)
1014
1014
return b [ "count" ] [ 0 ] - a [ "count" ] [ 0 ] ;
1015
1015
if ( a [ "count" ] [ 1 ] != b [ "count" ] [ 1 ] )
1016
1016
return b [ "count" ] [ 1 ] - a [ "count" ] [ 1 ] ;
1017
+ if ( a [ "count" ] [ 2 ] != b [ "count" ] [ 2 ] )
1018
+ return b [ "count" ] [ 2 ] - a [ "count" ] [ 2 ] ;
1017
1019
return 0 ;
1018
1020
} )
1019
1021
@@ -1022,7 +1024,7 @@ function flakes_doit(data_raw)
1022
1024
let reported = nipa_pw_reported ( v , v ) ;
1023
1025
let ignored = "" ;
1024
1026
1025
- if ( v [ "count" ] [ 0 ] < 3 && reported )
1027
+ if ( v [ "count" ] [ 0 ] + v [ "count" ] [ 1 ] + v [ "count" ] [ 2 ] < 4 && reported )
1026
1028
return 1 ;
1027
1029
if ( ! reported )
1028
1030
ignored = "yes" ;
@@ -1032,7 +1034,9 @@ function flakes_doit(data_raw)
1032
1034
row . insertCell ( 2 ) . innerText = v [ "test" ] ;
1033
1035
row . insertCell ( 3 ) . innerText = v [ "count" ] [ 0 ] ;
1034
1036
row . insertCell ( 4 ) . innerText = v [ "count" ] [ 1 ] ;
1035
- row . insertCell ( 5 ) . innerText = ignored ;
1037
+ row . insertCell ( 5 ) . innerText = v [ "count" ] [ 2 ] ;
1038
+ row . insertCell ( 6 ) . innerText = v [ "count" ] [ 3 ] ;
1039
+ row . insertCell ( 7 ) . innerText = ignored ;
1036
1040
} ) ;
1037
1041
}
1038
1042
You can’t perform that action at this time.
0 commit comments