Sha256: 16eea1f968593889fbbb310c68932db13e98fa7b3d3909cc8620b994664db62e

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents


module Stella
  class CLI
    # Stella::CLI::LocalTest
    #
    # A wrapper that takes the command line input and makes it appropriate for 
    # calling an instance of Stella::LocalTest. Then it calls that instance!
    class LocalTest < Stella::CLI::Base
      
      attr_reader :testdef
      
      def initialize(adapter)
        super(adapter)
        @testdef = Stella::Test::Definition.new
        
        if (adapter == 'ab')
          @adapter = Stella::Adapter::ApacheBench.new
        elsif (adapter == 'siege')
          @adapter = Stella::Adapter::Siege.new
        elsif (adapter == 'httperf')
          @adapter = Stella::Adapter::Httperf.new
        else
          raise UnknownValue.new(adapter)
        end
        
        @driver = Stella::LocalTest.new
      end
      

      def run
        process_stella_options
        
        options = @adapter.process_options(@arguments)
        
        @adapter.options = options
        @adapter.arguments = @arguments
        
        @testdef.vusers = @adapter.vusers
        @testdef.requests = @adapter.requests
        
        @driver.adapter = @adapter
        @driver.testdef = @testdef
        
        @driver.working_directory = @working_directory
        
        @driver.run
        
      end


      
      # process_stella_options
      # 
      # Populates @testdef with values from @stella_options
      def process_stella_options
        @testdef.repetitions = @stella_options.testreps
        @testdef.sleep = @stella_options.sleep
        @testdef.warmup = @stella_options.warmup
        @testdef.rampup = @stella_options.rampup
        @testdef.agents = @stella_options.agents
        @testdef.message = @stella_options.message
        
        
        @driver.quiet = @stella_options.quiet
        @driver.verbose = @stella_options.verbose
        @driver.format = @stella_options.format || 'yaml'
        
      end
      

      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stella-0.5.1 lib/stella/cli/localtest.rb