Class Stella::Testrun

  1. lib/stella/testplan.rb
Parent: Storable

Included modules

  1. Gibbler::Complex
  2. Familia
  3. Familia::Stamps
  4. Common::PrivacyMethods

External Aliases

stime -> start_time
etime -> end_time

Attributes

plan [R]
statuses [R]

Public instance methods

checkup? ()
[show source]
# File lib/stella/testplan.rb, line 438
    def checkup?
      @mode == :checkup
    end
cust ()
[show source]
# File lib/stella/testplan.rb, line 462
    def cust
      @cust ||= Customer.from_redis @custid
      @cust || Customer.anonymous
    end
destroy! ()
[show source]
# 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 ()
[show source]
# File lib/stella/testplan.rb, line 398
    def duration
      return 0 unless @stime
      (@etime || Stella.now) - @stime
    end
errors? ()
[show source]
# File lib/stella/testplan.rb, line 402
    def errors?
      @report && @report.errors?
    end
host ()
[show source]
# File lib/stella/testplan.rb, line 466
    def host
      @host ||= plan.host if plan
      @host
    end
hostid ()
[show 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 ()
[show source]
# File lib/stella/testplan.rb, line 393
    def id 
      @id ||= gibbler
      @id
    end
init (plan=nil, mode=nil, options={})
[show 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? ()
[show source]
# File lib/stella/testplan.rb, line 441
    def monitor?
      @mode == :monitor
    end
owner? (obj)
[show source]
# File lib/stella/testplan.rb, line 458
    def owner?(obj)
      obj = Customer === obj ? obj.custid : obj
      cust.username?(obj)
    end
plan ()
[show source]
# File lib/stella/testplan.rb, line 451
    def plan
      if @plan.nil? 
        @plan = Stella::Testplan.from_redis @planid
        #@plan.freeze
      end
      @plan
    end
postprocess ()
[show 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 ()
[show 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={})
[show 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
runid ()

Alias for id