Sha256: b8739644af498cc4f4d6198bd431e5b1c43f65df149a1953f0c7d26218570ede

Contents?: true

Size: 1.26 KB

Versions: 30

Compression:

Stored size: 1.26 KB

Contents

require "spec_helper"

unless defined?(JRUBY_VERSION) && !ENV["FORCE_JRUBY_RUN"]
  describe Bunny::Session do
    # creating thousands of connections means creating
    # twice as many threads and this won't fly with the JVM
    # in CI containers. MK.
    n = if defined?(JRUBY_VERSION)
          250
        else
          2500
        end

    n.times do |i|
      it "can be closed (automatic recovery disabled, take #{i})" do
        c  = Bunny.new(automatically_recover: false)
        c.start
        ch = c.create_channel

        expect(c).to be_connected
        c.stop
        expect(c).to be_closed
      end
    end

    n.times do |i|
      it "can be closed (automatic recovery enabled, take #{i})" do
        c  = Bunny.new(automatically_recover: true)
        c.start
        ch = c.create_channel

        expect(c).to be_connected
        c.stop
        expect(c).to be_closed
      end
    end

    context "in the single threaded mode" do
      n.times do |i|
        it "can be closed (single threaded mode, take #{i})" do
          c  = Bunny.new(automatically_recover: false, threaded: false)
          c.start
          ch = c.create_channel

          expect(c).to be_connected
          c.stop
          expect(c).to be_closed
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
bunny-2.8.1 spec/stress/connection_open_close_spec.rb
bunny-2.9.0 spec/stress/connection_open_close_spec.rb
bunny-2.7.3 spec/stress/connection_open_close_spec.rb
bunny-2.8.0 spec/stress/connection_open_close_spec.rb
bunny-2.7.2 spec/stress/connection_open_close_spec.rb
bunny-2.7.1 spec/stress/connection_open_close_spec.rb
bunny-2.7.0 spec/stress/connection_open_close_spec.rb
bunny-2.6.6 spec/stress/connection_open_close_spec.rb
bunny-2.6.5 spec/stress/connection_open_close_spec.rb
bunny-2.6.4 spec/stress/connection_open_close_spec.rb