Sha256: c2c0e676a6897f5dc12005dd25d6485ff1c7a228d49ace382ae212db771ab1e3

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

require 'helper'
require 'sidekiq'
require 'sidekiq/processor'

class TestStats < MiniTest::Unit::TestCase
  describe 'with redis' do
    before do
      @redis = Sidekiq.redis = REDIS
      Sidekiq.redis {|c| c.flushdb }
    end

    class DumbWorker
      include Sidekiq::Worker
      sidekiq_options :queue => 'dumbq'

      def perform(arg)
        raise 'bang' if arg == nil
      end
    end

    describe "info counts" do
      before do
        @redis.with do |conn|
          conn.rpush 'queue:foo', '{}'
          conn.sadd 'queues', 'foo'

          3.times { conn.rpush 'queue:bar', '{}' }
          conn.sadd 'queues', 'bar'

          2.times { conn.rpush 'queue:baz', '{}' }
          conn.sadd 'queues', 'baz'
        end
      end

      describe "size" do
        it "returns size of queues" do
          assert_equal 0, Sidekiq.size("foox")
          assert_equal 1, Sidekiq.size(:foo)
          assert_equal 1, Sidekiq.size("foo")
          assert_equal 4, Sidekiq.size("foo", "bar")
          assert_equal 6, Sidekiq.size
        end
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sidekiq-2.8.0 test/test_stats.rb
sidekiq-2.7.5 test/test_stats.rb
sidekiq-2.7.4 test/test_stats.rb
sidekiq-2.7.3 test/test_stats.rb
sidekiq-2.7.2 test/test_stats.rb
sidekiq-2.7.1 test/test_stats.rb
sidekiq-2.7.0 test/test_stats.rb
sidekiq-2.6.5 test/test_stats.rb
sidekiq-2.6.4 test/test_stats.rb
sidekiq-2.6.3 test/test_stats.rb
sidekiq-2.6.2 test/test_stats.rb
sidekiq-2.6.1 test/test_stats.rb
sidekiq-2.6.0 test/test_stats.rb