Class representing an execution of a single step in scenario
Information about timings, collected automatically
Output of the execution, to be filled by execution step
Information about timings, collected automatically
One of :pending, :running, :success, :fail, :skipped
Step performed as part of the execution
# File lib/foreman_maintain/runner/execution.rb, line 23 def initialize(step, reporter) @step = step @reporter = reporter @status = :pending @output = '' end
# File lib/foreman_maintain/runner/execution.rb, line 38 def fail? @status == :fail end
# File lib/foreman_maintain/runner/execution.rb, line 30 def name @step.description end
# File lib/foreman_maintain/runner/execution.rb, line 46 def run @status = :running @reporter.before_execution_starts(self) with_metadata_calculation do capture_errors do step.__run__(self) end end # change the state only when not modified @status = :success if @status == :running ensure @reporter.after_execution_finishes(self) end
# File lib/foreman_maintain/runner/execution.rb, line 34 def success? @status == :success end
# File lib/foreman_maintain/runner/execution.rb, line 60 def update(line) @reporter.on_execution_update(self, line) end
# File lib/foreman_maintain/runner/execution.rb, line 42 def warning? @status == :warning end
# File lib/foreman_maintain/runner/execution.rb, line 73 def capture_errors yield rescue => e @status = :fail @output << e.message logger.error(e) end
# File lib/foreman_maintain/runner/execution.rb, line 66 def with_metadata_calculation @started_at = Time.now yield ensure @ended_at = Time.now end