Use TestrunMessages instead of Testrun.output when displaying output
This commit is contained in:
@ -65,9 +65,9 @@ h1
|
||||
td.align-middle
|
||||
-this.testruns.includes(:file).order("files.name").each do |run|
|
||||
- if run.passed
|
||||
.unit-test-result.positive-result title=[run.file&.filepath, run.output].join("\n").strip
|
||||
.unit-test-result.positive-result title=[run.file&.filepath, run.log].join.strip
|
||||
- else
|
||||
.unit-test-result.unknown-result title=[run.file&.filepath, run.output].join("\n").strip
|
||||
.unit-test-result.unknown-result title=[run.file&.filepath, run.log].join.strip
|
||||
td = @working_times_until[index] if index > 0 if policy(@exercise).detailed_statistics?
|
||||
- elsif this.is_a? UserExerciseIntervention
|
||||
td = this.created_at.strftime("%F %T")
|
||||
|
@ -38,20 +38,7 @@
|
||||
.collapsed.testrun-output.text
|
||||
span.fa.fa-chevron-down.collapse-button
|
||||
- output_runs.each do |testrun|
|
||||
- output = testrun.try(:output)
|
||||
- if output
|
||||
- Sentry.set_extras(output: output)
|
||||
- begin
|
||||
- Timeout::timeout(2) do
|
||||
// (?:\\"|.) is required to correctly identify " within the output.
|
||||
// The outer (?: |\d+?) is used to correctly identify integers within the JSON
|
||||
- messages = output.scan(/{(?:(?:"(?:\\"|.)+?":(?:"(?:\\"|.)*?"|-?\d+?|\[.*?\]|null))+?,?)+}/)
|
||||
- messages.map! {|el| JSON.parse(el)}
|
||||
- messages.keep_if {|message| message['cmd'] == 'write'}
|
||||
- messages.map! {|message| message['data']}
|
||||
- output = messages.join ''
|
||||
- rescue Timeout::Error
|
||||
pre= output or t('request_for_comments.no_output')
|
||||
pre= testrun.log or t('request_for_comments.no_output')
|
||||
|
||||
- assess_runs = testruns.select {|run| run.cause == 'assess' }
|
||||
- unless @current_user.admin?
|
||||
@ -64,7 +51,7 @@
|
||||
div class=("result #{testrun.passed ? 'passed' : 'failed'}")
|
||||
.collapsed.testrun-output.text
|
||||
span.fa.fa-chevron-down.collapse-button
|
||||
pre= testrun.output or t('request_for_comments.no_output')
|
||||
pre= testrun.log or t('request_for_comments.no_output')
|
||||
|
||||
- if @current_user.admin? && user.is_a?(ExternalUser)
|
||||
= render('admin_menu')
|
||||
|
Reference in New Issue
Block a user