Class: QaServer::ScenarioRunHistory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- QaServer::ScenarioRunHistory
- Defined in:
- app/models/qa_server/scenario_run_history.rb
Constant Summary collapse
- GOOD_MARKER =
'√'
- BAD_MARKER =
'X'
- UNKNOWN_MARKER =
'?'
Class Method Summary collapse
-
.historical_summary(force: false) ⇒ Object
Get a summary level of historical data.
-
.run_failures(run_id:, force: false) ⇒ Object
Get set of failures for a run, if any.
-
.run_results(run_id:, authority_name: nil, status: nil, url: nil) ⇒ Object
deprecated
Deprecated.
Not used anywhere. Being removed.
-
.run_summary(scenario_run:, force: false) ⇒ Object
Get a summary of passing/failing tests for a run.
-
.save_result(run_id:, scenario_result:) ⇒ Object
Save a scenario result.
Class Method Details
.historical_summary(force: false) ⇒ Object
Get a summary level of historical data
141 142 143 144 145 |
# File 'app/models/qa_server/scenario_run_history.rb', line 141 def historical_summary(force: false) Rails.cache.fetch("QaServer::ScenarioRunHistory/#{__method__}", expires_in: QaServer::MonitorCacheService.cache_expiry, race_condition_ttl: 1.minute, force: force) do end end |
.run_failures(run_id:, force: false) ⇒ Object
Get set of failures for a run, if any.
128 129 130 131 132 133 134 |
# File 'app/models/qa_server/scenario_run_history.rb', line 128 def run_failures(run_id:, force: false) return [] unless run_id Rails.cache.fetch("QaServer::ScenarioRunHistory/#{__method__}", expires_in: QaServer::MonitorCacheService.cache_expiry, race_condition_ttl: 1.minute, force: force) do QaServer.config.monitor_logger.info("(QaServer::ScenarioRunHistory##{__method__}) - finding failures in latest run - cache expired or refresh requested (force: #{force})") QaServer::ScenarioRunHistory.where(scenario_run_registry_id: run_id).where.not(status: :good).to_a end end |
.run_results(run_id:, authority_name: nil, status: nil, url: nil) ⇒ Object
Deprecated.
Not used anywhere. Being removed.
Get set of all scenario results for a run.
94 95 96 97 98 99 100 101 102 |
# File 'app/models/qa_server/scenario_run_history.rb', line 94 def run_results(run_id:, authority_name: nil, status: nil, url: nil) return [] unless run_id where = {} where[:scenario_run_registry_id] = run_id where[:authority_name] = if .present? where[:status] = status if status.present? where[:url] = url if url.present? QaServer::ScenarioRunHistory.where(where).to_a end |
.run_summary(scenario_run:, force: false) ⇒ Object
Get a summary of passing/failing tests for a run.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/models/qa_server/scenario_run_history.rb', line 46 def run_summary(scenario_run:, force: false) Rails.cache.fetch("QaServer::ScenarioRunHistory/#{__method__}", expires_in: QaServer::MonitorCacheService.cache_expiry, race_condition_ttl: 1.minute, force: force) do QaServer.config.monitor_logger.info("(QaServer::ScenarioRunHistory##{__method__}) - creating summary of latest run - cache expired or refresh requested (force: #{force})") status = status_counts_in_run(run_id: scenario_run.id) summary_class.new(run_id: scenario_run.id, run_dt_stamp: scenario_run.dt_stamp, authority_count: (run_id: scenario_run.id).count, failing_authority_count: (run_id: scenario_run.id).count, passing_scenario_count: status['good'], failing_scenario_count: status['bad'] + status['unknown']) end end |
.save_result(run_id:, scenario_result:) ⇒ Object
Save a scenario result
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/qa_server/scenario_run_history.rb', line 22 def save_result(run_id:, scenario_result:) QaServer::ScenarioRunHistory.create(scenario_run_registry_id: run_id, status: scenario_result[:status], authority_name: scenario_result[:authority_name], subauthority_name: scenario_result[:subauthority_name], service: scenario_result[:service], action: scenario_result[:action], url: scenario_result[:url], err_message: scenario_result[:err_message], run_time: scenario_result[:run_time]) end |