Sha256: 52685eab9749d9566796d8714b9e7668a56f29936dd83c0146fd71acb683c4fc
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
shared_context 'connection opts' do let(:connection_opts) { { :thread => :per_callback, :timeout => 5 } } let(:connection_host) { "#{ZK.default_host}:#{ZK.test_port}" } let(:connection_args) { [connection_host, connection_opts] } end shared_context 'threaded client connection' do include_context 'connection opts' before do # logger.debug { "threaded client connection - begin before hook" } @connection_string = connection_host @base_path = '/zktests' @zk = ZK::Client::Threaded.new(*connection_args).tap { |z| wait_until { z.connected? } } @threadpool_exception = nil @zk.on_exception { |e| @threadpool_exception = e } @zk.rm_rf(@base_path) # logger.debug { "threaded client connection - end before hook" } end after do # raise @threadpool_exception if @threadpool_exception # logger.debug { "threaded client connection - after hook" } @zk.close! if @zk and not @zk.closed? ZK.open(*connection_args) do |z| z.rm_rf(@base_path) end # logger.debug { "threaded client connection - end after hook" } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zk-1.5.3 | spec/shared/client_contexts.rb |