Sha256: 21bc77e235077b8ad47beec452652973a6cbc0d1876751d30b4e2f80f405d7bc

Contents?: true

Size: 1.43 KB

Versions: 15

Compression:

Stored size: 1.43 KB

Contents

shared_context 'locker non-chrooted' do
  include_context 'connection opts'

  let(:zk)  { ZK.new(*connection_args) }
  let(:zk2) { ZK.new(*connection_args) }
  let(:zk3) { ZK.new(*connection_args) }

  let(:connections) { [zk, zk2, zk3] }

  let(:path) { "lock_path" }
  let(:root_lock_path) { "#{ZK::Locker.default_root_lock_node}/#{path}" }

  before do
    wait_until{ connections.all?(&:connected?) }
    zk.rm_rf(ZK::Locker.default_root_lock_node)
  end

  after do
    connections.each { |c| c.close! }
    wait_until { !connections.any?(&:connected?) }
    ZK.open(*connection_args) { |z| z.rm_rf(ZK::Locker.default_root_lock_node) }
  end
end

shared_context 'locker chrooted' do
  include_context 'connection opts'

  let(:chroot_path) { '/_zk_chroot_' }
  let(:path) { "lock_path" }

  let(:zk)  { ZK.new("#{connection_host}#{chroot_path}", connection_opts) }
  let(:zk2) { ZK.new("#{connection_host}#{chroot_path}", connection_opts) }
  let(:zk3) { ZK.new("#{connection_host}#{chroot_path}", connection_opts) }
  let(:connections) { [zk, zk2, zk3] }
  let(:root_lock_path) { "#{ZK::Locker.default_root_lock_node}/#{path}" }

  before do
    ZK.open(*connection_args) do |zk|
      zk.mkdir_p(chroot_path)
    end

    wait_until{ connections.all?(&:connected?) }
  end

  after do
    connections.each { |c| c.close! }
    wait_until { !connections.any?(&:connected?) }

    ZK.open(*connection_args) do |zk|
      zk.rm_rf(chroot_path)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
zk-1.8.0 spec/shared/locker_contexts.rb
zk-1.7.5 spec/shared/locker_contexts.rb
zk-1.7.4 spec/shared/locker_contexts.rb
zk-1.7.3 spec/shared/locker_contexts.rb
zk-1.7.2 spec/shared/locker_contexts.rb
zk-1.7.1 spec/shared/locker_contexts.rb
zk-1.7.0 spec/shared/locker_contexts.rb
zk-1.6.5 spec/shared/locker_contexts.rb
zk-1.6.4 spec/shared/locker_contexts.rb
zk-1.6.3 spec/shared/locker_contexts.rb
zk-1.6.2 spec/shared/locker_contexts.rb
zk-1.6.1 spec/shared/locker_contexts.rb
zk-1.6.0 spec/shared/locker_contexts.rb
zk-1.5.3 spec/shared/locker_contexts.rb
zk-1.5.2 spec/shared/locker_contexts.rb