Add exit_code and status to Testruns, create model for TestrunMessages

* This is the first step to migrate the `output` column from Testruns to a dedicated table TestrunMessages
This commit is contained in:
Sebastian Serth
2022-04-24 18:09:37 +02:00
parent 5f16792ee9
commit e9efb5bc2b
7 changed files with 146 additions and 25 deletions

View File

@ -4,4 +4,16 @@ class Testrun < ApplicationRecord
belongs_to :file, class_name: 'CodeOcean::File', optional: true
belongs_to :submission
belongs_to :testrun_execution_environment, optional: true, dependent: :destroy
has_many :testrun_messages, dependent: :destroy
enum status: {
ok: 0,
failed: 1,
container_depleted: 2,
timeout: 3,
out_of_memory: 4,
}, _default: :ok, _prefix: true
validates :exit_code, numericality: {only_integer: true, min: 0, max: 255}, allow_nil: true
validates :status, presence: true
end