Sha256: 84ef10acef3c6c511f149233bc8ce195dded05f0b01cb26f97d8d4eb8c26fc66

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'coveralls'
Coveralls.wear! do
  add_filter '/test/'
end

require 'minitest/pride'

require 'bundler/setup'
require 'rack/test'

require 'sidekiq'
require 'sidekiq/util'
require 'sidekiq-benchmark'

REDIS = Sidekiq::RedisConnection.create url: "redis://localhost/15", namespace: "testy"

Bundler.require

module Sidekiq
  module Benchmark
    module Test

      class WorkerMock
        include Sidekiq::Worker
        include Sidekiq::Benchmark::Worker

        attr_reader :bm_obj, :metric_names, :assigned_metric

        def initialize
          @assigned_metric = 0.1

          @bm_obj = benchmark do |bm|
            bm.test_metric do
              2.times do |i|
                bm.send("nested_test_metric_#{i}") do
                  100500.times do |i|
                  end
                end
              end
            end

            bm.assigned_metric @assigned_metric
          end

          @metric_names = [:test_metric, :nested_test_metric_1, :job_time]
        end
      end

      def self.flush_db
        Sidekiq.redis = REDIS
        Sidekiq.redis do |conn|
          conn.flushdb
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-benchmark-0.1.2 test/test_helper.rb