@@ -233,6 +233,51 @@ def get_report(path)
233233 url
234234 end
235235
236+ def retrieve_report ( path )
237+ @s3_client . get_object (
238+ bucket : @report_bucket ,
239+ key : path ,
240+ ) . body . read
241+ end
242+
243+ def get_unit_test_results ( path )
244+ table = AdminUI ::FilterTable . new (
245+ columns : [
246+ AdminUI ::Column . new ( :path , header : 'path' ) ,
247+ AdminUI ::Column . new ( :Result , header : 'Result' ) ,
248+ AdminUI ::Column . new ( :Rows , header : 'Rows' , cssclass : 'int' ) ,
249+ AdminUI ::Column . new ( :Status , header : 'Status Code' , cssclass : 'int' ) ,
250+ AdminUI ::Column . new ( :Size , header : 'Size' , cssclass : 'int' ) ,
251+ AdminUI ::Column . new ( :Time , header : 'Time' , cssclass : 'float' ) ,
252+ AdminUI ::Column . new ( :Title , header : 'Title' ) ,
253+ AdminUI ::Column . new ( :status , header : 'Status' )
254+ ]
255+ )
256+ row = { }
257+ retrieve_report ( path ) . each_line do |line |
258+ if line . start_with? ( '/' )
259+ row [ :status ] = 'FAIL' if row [ :Result ] == 'ERROR' || row . fetch ( :Status , 0 ) >= 400
260+ table . add_row ( AdminUI ::Row . make_row ( table . columns , row ) ) unless row . empty?
261+ row = { path : line . strip , status : 'PASS' }
262+ next
263+ end
264+ line . strip . split ( ';' ) . each do |kv |
265+ k , v = kv . split ( ': ' )
266+ k = k . strip . to_sym
267+ v = v . nil? ? '' : v . strip
268+ case k
269+ when :Rows , :Size , :Status
270+ v = v . to_i
271+ when :Time
272+ v = v . to_f
273+ end
274+ row [ k ] = v
275+ end
276+ end
277+ table . add_row ( AdminUI ::Row . make_row ( table . columns , row ) ) unless row . empty?
278+ table
279+ end
280+
236281 def get_doc_page ( doc )
237282 key = "uc3/mrt/mrt-admin-sinatra/docs/#{ UC3 ::UC3Client . stack_name } /#{ doc } "
238283 @s3_client . get_object (
@@ -277,6 +322,17 @@ def list_reports(path, show_url: false)
277322 created : date_format ( s3obj . last_modified , convert_timezone : true ) ,
278323 size : s3obj . size
279324 }
325+ if path == 'unit-tests/'
326+ row [ :download ] = {
327+ href : "/ops/s3-reports/unit-test-results?report=#{ URI . encode_www_form_component ( s3obj . key ) } " ,
328+ value : 'Review'
329+ }
330+ else
331+ row [ :download ] = {
332+ href : "/ops/s3-reports/retrieve?report=#{ URI . encode_www_form_component ( s3obj . key ) } " ,
333+ value : 'Download'
334+ }
335+ end
280336 if show_url
281337 row [ :url ] = {
282338 href : "/saved-reports/url?report=#{ URI . encode_www_form_component ( s3obj . key ) } " ,
0 commit comments