class Stella::Testrun
Attributes
statuses[R]
plan[R]
Public Instance Methods
checkup?()
click to toggle source
# File lib/stella/testplan.rb, line 438 def checkup? @mode == :checkup end
cust()
click to toggle source
# File lib/stella/testplan.rb, line 462 def cust @cust ||= Customer.from_redis @custid @cust || Customer.anonymous end
destroy!()
click to toggle source
Calls superclass method
# File lib/stella/testplan.rb, line 444 def destroy! VendorInfo.global.checkups.remove self host.checkups.remove self if host plan.checkups.remove self if plan cust.checkups.remove self if cust super end
duration()
click to toggle source
# File lib/stella/testplan.rb, line 398 def duration return 0 unless @stime (@etime || Stella.now) - @stime end
errors?()
click to toggle source
# File lib/stella/testplan.rb, line 402 def errors? @report && @report.errors? end
host()
click to toggle source
# File lib/stella/testplan.rb, line 466 def host @host ||= plan.host if plan @host end
hostid()
click to toggle source
# File lib/stella/testplan.rb, line 425 def hostid # NOTE: This method is needed only until May 30 or so. # (there was an issue where incidents were not including a hostid) @hostid || (plan.nil? ? nil : plan.hostid) end
id()
click to toggle source
# File lib/stella/testplan.rb, line 393 def id @id ||= gibbler @id end
Also aliased as: runid
init(plan=nil, mode=nil, options={})
click to toggle source
# File lib/stella/testplan.rb, line 386 def init plan=nil, mode=nil, options={} @ctime = Stella.now @plan, @mode = plan, mode @options = { }.merge options preprocess end
monitor?()
click to toggle source
# File lib/stella/testplan.rb, line 441 def monitor? @mode == :monitor end
owner?(obj)
click to toggle source
# File lib/stella/testplan.rb, line 458 def owner?(obj) obj = Customer === obj ? obj.custid : obj cust.username?(obj) end
postprocess()
click to toggle source
# File lib/stella/testplan.rb, line 415 def postprocess @id &&= Gibbler::Digest.new(@id) # Calling plan calls Redis. #@privacy = plan.privacy if Stella::Testplan === plan if Hash === @report @report = Stella::Report.from_hash @report @report.runid = runid end @planid &&= Gibbler::Digest.new(@planid) end
preprocess()
click to toggle source
# File lib/stella/testplan.rb, line 405 def preprocess @salt ||= Stella.now.digest.short @status ||= :new if @plan @planid = @plan.id @hostid = @plan.hostid end @options ||= {} @privacy ||= false end
run(opts={})
click to toggle source
# File lib/stella/testplan.rb, line 430 def run opts={} raise StellaError.new("No mode") unless Stella::Engine.mode?(@mode) engine = Stella::Engine.load(@mode) opts.merge! @options engine.run self, opts save if respond_to? :save self.report end