Skip to content

Commit 5db756e

Browse files
committed
review unit test results
1 parent 011020c commit 5db756e

4 files changed

Lines changed: 75 additions & 2 deletions

File tree

app/config/mrt/menu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ items:
658658
confmsg: This will cause all Processing jobs to fail until the failure file is removed from the ingest folder.
659659
route: /ops/show-folders/force-failure/processing
660660
method: post
661-
- title: S3 Folders
662-
route: /ops/show-s3folders/list
661+
# - title: S3 Folders
662+
# route: /ops/show-s3folders/list
663663
- path: db-queue
664664
title: Database Queues
665665
route: /ops/db-queue

app/lib/client/s3/config_objects.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)}",

app/lib/routes/config.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ def self.registered(app)
137137
redirect UC3S3::ConfigObjectsClient.client.get_report(rpt)
138138
end
139139

140+
app.get '/ops/s3-reports/unit-test-results' do
141+
rpt = request.params.fetch('report', '')
142+
redirect '/ops/s3-reports' if rpt.empty?
143+
144+
rpt = URI.decode_www_form_component(rpt)
145+
146+
adminui_show_table(
147+
AdminUI::Context.new(request.path, request.params),
148+
UC3S3::ConfigObjectsClient.client.get_unit_test_results(rpt)
149+
)
150+
end
151+
140152
app.get '/ops/s3-reports/*' do |folder|
141153
adminui_show_table(
142154
AdminUI::Context.new(request.path, request.params),

app/public/admintool.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ td.sha {
6666
width: 250px;
6767
}
6868

69+
th.Title,
70+
td.Title {
71+
width: 250px;
72+
}
73+
6974
td.sha span.val {
7075
overflow-x: clip;
7176
}

0 commit comments

Comments
 (0)