Sha256: be982211891cd8bedd4922579dffb885e8a53e07cf4dcd353e3981921ff6a81e

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents


class Stella::CLI < Drydock::Command
  attr_accessor :exit_code
  
  def init
    @conf = Stella::Config.refresh
    @exit_code = 0
  end
  
  def verify_valid?
    create_testplan
  end
  
  def verify
    opts = {}
    opts[:hosts] = @hosts
    opts[:benchmark] = true if @option.benchmark
    ret = Stella::Engine::Functional.run @testplan, opts
    @exit_code = (ret ? 0 : 1)
  end
  
  def load_valid?
    create_testplan
  end
  
  def load
    opts = {}
    opts[:hosts] = @hosts
    [:benchmark, :users, :repetitions, :delay, :time].each do |opt|
      opts[opt] = @option.send(opt) unless @option.send(opt).nil?
    end
    ret = Stella::Engine::Load.run @testplan, opts
    @exit_code = (ret ? 0 : 1)
  end

  private
  def create_testplan
    @hosts = @argv.collect { |uri|; URI.parse uri; }
    if @option.testplan
      @testplan = Stella::Testplan.load_file @option.testplan
    else
      opts = {}
      opts[:delay] = @option.delay if @option.delay
      @testplan = Stella::Testplan.new(@argv, opts)
    end
    @testplan.check!  # raise errors, update usecase ratios
    Stella.li3 " File: #{@option.testplan} (#{@testplan.digest})", $/
    true
  end
  
  
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
solutious-stella-0.7.0.004 lib/stella/cli.rb
stella-0.7.0.004 lib/stella/cli.rb