Sha256: 2b05f37c08d4c82e3a5b0874c5f1cf9ccc3017a798dc391afee81d5f124a6656

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

module BigBench
  
  # A bot is used for remote testing. It is running in the background of a machine and waits for tests to run. If you want to
  # run a test with a cluster of 20 machines, simply set them all up and start the bot with:
  #
  #    bigbench start bot [REDIS_RUL_WITH_PORT REDIS_PASSWORD]
  #
  # A bot will automatically check for a new test every minute. If a new test is available it runs the test and reports its results
  # back to the redis. After that it goes into listening mode again.
  module Bot
    
    mattr_accessor :id
    
    # Checks if there is a new test waiting on the store.
    # 
    # If yes, it loads this test and executes it. After it has finished
    # it writes its trackings to the stores tracking array.
    def self.check_test!
      return unless BigBench::Store.running?
      
      BigBench::Output.bot_received_test_instructions
      @id = SecureRandom.hex(16) if @id.nil?
      
      BigBench.config.mode = :bot
      BigBench.load_test!(BigBench::Store.test)
      
      BigBench::Store.bot_is_working(@id)
      BigBench.run!
      BigBench.write_trackings_to_store!
      BigBench::Store.bot_stopped_working(@id)
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bigbench-0.0.6 lib/bigbench/bot.rb
bigbench-0.0.5 lib/bigbench/bot.rb
bigbench-0.0.4 lib/bigbench/bot.rb
bigbench-0.0.3 lib/bigbench/bot.rb
bigbench-0.0.2 lib/bigbench/bot.rb
bigbench-0.0.1 lib/bigbench/bot.rb