Use TestrunMessages instead of Testrun.output when displaying output
This commit is contained in:
@@ -17,4 +17,8 @@ class Testrun < ApplicationRecord
|
||||
|
||||
validates :exit_code, numericality: {only_integer: true, min: 0, max: 255}, allow_nil: true
|
||||
validates :status, presence: true
|
||||
|
||||
def log
|
||||
testrun_messages.output.select(:log).map(&:log).join.presence
|
||||
end
|
||||
end
|
||||
|
@@ -33,6 +33,9 @@ class TestrunMessage < ApplicationRecord
|
||||
validates :log, length: {minimum: 0, allow_nil: false}, if: -> { cmd_write? }
|
||||
validate :either_data_or_log
|
||||
|
||||
default_scope { order(timestamp: :asc) }
|
||||
scope :output, -> { where(cmd: 1, stream: %i[stdout stderr]) }
|
||||
|
||||
def self.create_for(testrun, messages)
|
||||
# We don't want to store anything if the testrun passed
|
||||
return if testrun.passed?
|
||||
|
Reference in New Issue
Block a user