Class: Inferno::Entities::Result
- Includes:
- HasRunnable
- Defined in:
- lib/inferno/entities/result.rb
Overview
A Result
represents the result of running a Test
, TestGroup
,
or TestSuite
Constant Summary collapse
- ATTRIBUTES =
[ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze
- RESULT_OPTIONS =
['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Time
Creation timestamp.
-
#id ⇒ String
Id of the session.
-
#input_json ⇒ String
JSON string of the inputs used for this result.
-
#messages ⇒ Array<Inferno::Entities::Message>
result.
-
#output_json ⇒ String
JSON string of the outputs created by this result.
-
#requests ⇒ Array<Inferno::Entities::Request>
associated with this result.
-
#result ⇒ String
running
,wait
,cancel
). -
#result_message ⇒ String
Summary message for this result.
-
#test ⇒ Test?
The
Test
this result belongs to. -
#test_group ⇒ TestGroup?
The
TestGroup
this result belongs to. -
#test_group_id ⇒ String?
Id of the
TestGroup
this result belongs to. -
#test_id ⇒ String?
Id of the
Test
this result belongs to. -
#test_run_id ⇒ String
The
TestRun
this result belongs to. -
#test_session_id ⇒ String
The
TestSession
this result belongs to. -
#test_suite ⇒ TestSuite?
The
TestSuite
this result belongs to. -
#test_suite_id ⇒ String?
Id of the
TestSuite
this result belongs to. -
#updated_at ⇒ Time
Update timestamp.
Instance Method Summary collapse
-
#handle_large_io(io_type) ⇒ Array<Hash>
Flags large inputs or outputs and replaces their values with a reference message.
-
#initialize(params) ⇒ Result
constructor
A new instance of Result.
-
#inputs ⇒ Object
-
#optional? ⇒ Boolean
-
#outputs ⇒ Object
-
#required? ⇒ Boolean
-
#waiting? ⇒ Boolean
Methods included from HasRunnable
Methods inherited from Entity
Constructor Details
#initialize(params) ⇒ Result
Returns a new instance of Result.
55 56 57 58 59 60 |
# File 'lib/inferno/entities/result.rb', line 55 def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end |
Instance Attribute Details
#created_at ⇒ Time
Returns creation timestamp.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#id ⇒ String
Returns id of the session.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#input_json ⇒ String
Returns JSON string of the inputs used for this result.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#messages ⇒ Array<Inferno::Entities::Message>
result
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#output_json ⇒ String
Returns JSON string of the outputs created by this result.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#requests ⇒ Array<Inferno::Entities::Request>
associated with this result
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#result ⇒ String
running
, wait
, cancel
)
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#result_message ⇒ String
Returns summary message for this result.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test ⇒ Test?
Returns the Test
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_group ⇒ TestGroup?
Returns the TestGroup
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_group_id ⇒ String?
Returns id of the TestGroup
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_id ⇒ String?
Returns id of the Test
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_run_id ⇒ String
Returns the TestRun
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_session_id ⇒ String
Returns the TestSession
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_suite ⇒ TestSuite?
Returns the TestSuite
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#test_suite_id ⇒ String?
Returns id of the TestSuite
this result belongs to.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
#updated_at ⇒ Time
Returns update timestamp.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/result.rb', line 43 class Result < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_id, :test, :test_group_id, :test_group, :test_suite_id, :test_suite, :test_run_id, :test_session_id, :result, :result_message, :messages, :requests, :input_json, :output_json ].freeze RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze include Inferno::Entities::Attributes include Inferno::Entities::HasRunnable def initialize(params) super(params, ATTRIBUTES - [:messages, :requests]) @messages = (params[:messages] || []).map { || Message.new() } @requests = (params[:requests] || []).map { |request| Request.new(request) } end def optional? runnable.nil? || runnable.optional? end def required? !optional? end # @return [Boolean] def waiting? result == 'wait' end def inputs input_json.present? ? JSON.parse(input_json) : [] end def outputs output_json.present? ? JSON.parse(output_json) : [] end # Flags large inputs or outputs and replaces their values with a reference message. # # This method inspects either the `inputs` or `outputs` array and, # for each item whose `value` exceeds the configured size threshold, sets `is_large: true` # and replaces the `value` with a message pointing to the full content endpoint. # # @param io_type [String] Must be either `'inputs'` or `'outputs'`. # @return [Array<Hash>] The mutated list of inputs or outputs. def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end # @private def io_is_large?(io_value) size_in_char = io_value.is_a?(String) ? io_value.length : io_value.to_json.length size_in_char > ENV.fetch('MAX_IO_DISPLAY_CHAR', 10000).to_i end end |
Instance Method Details
#handle_large_io(io_type) ⇒ Array<Hash>
Flags large inputs or outputs and replaces their values with a reference message.
This method inspects either the inputs
or outputs
array and,
for each item whose value
exceeds the configured size threshold, sets is_large: true
and replaces the value
with a message pointing to the full content endpoint.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/inferno/entities/result.rb', line 91 def handle_large_io(io_type) io_array = public_send(io_type) io_array.each do |io| next unless io_is_large?(io['value']) io['is_large'] = true io['value'] = <<~MESSAGE #{io_type.singularize.capitalize} is too large to display, please visit #{Inferno::Application['base_url']}/api/test_sessions/#{test_session_id}/results/#{id}/io/#{io_type}/#{io['name']} for details MESSAGE end io_array end |
#inputs ⇒ Object
75 76 77 |
# File 'lib/inferno/entities/result.rb', line 75 def inputs input_json.present? ? JSON.parse(input_json) : [] end |
#optional? ⇒ Boolean
62 63 64 |
# File 'lib/inferno/entities/result.rb', line 62 def optional? runnable.nil? || runnable.optional? end |
#outputs ⇒ Object
79 80 81 |
# File 'lib/inferno/entities/result.rb', line 79 def outputs output_json.present? ? JSON.parse(output_json) : [] end |
#required? ⇒ Boolean
66 67 68 |
# File 'lib/inferno/entities/result.rb', line 66 def required? !optional? end |
#waiting? ⇒ Boolean
71 72 73 |
# File 'lib/inferno/entities/result.rb', line 71 def waiting? result == 'wait' end |