spec/zk/client_spec.rb in zk-1.9.0 vs spec/zk/client_spec.rb in zk-1.9.1
- old
+ new
@@ -34,15 +34,39 @@
shutdown_thread.should_not be_nil
shutdown_thread.should be_kind_of(Thread)
shutdown_thread.join(5).should == shutdown_thread
- wait_until(5) { @zk.closed? }.should be_true
+ wait_until(5) { @zk.closed? }.should be_true
end
end
end
+ describe :reopen do
+ include_context 'connection opts'
+
+ before do
+ @zk = ZK::Client::Threaded.new(*connection_args)
+ end
+
+ after do
+ @zk.close! unless @zk.closed?
+ end
+
+ it %[should say the client is connected after reopen] do
+ @zk.connected?.should == true
+
+ @zk.close!
+
+ @zk.connected?.should == false
+
+ @zk.reopen
+
+ @zk.connected?.should == true
+ end
+ end
+
describe :retry do
include_context 'connection opts'
before do
@zk = ZK::Client::Threaded.new(connection_host, :reconect => false, :connect => false)
@@ -52,11 +76,11 @@
@zk.close! unless @zk.closed?
end
it %[should retry a Retryable operation] do
# TODO: this is a terrible test. there is no way to guarantee that this
- # has been retried. the join at the end should not raise an error
-
+ # has been retried. the join at the end should not raise an error
+
@zk.should_not be_connected
th = Thread.new do
@zk.stat('/path/to/blah', :retry_duration => 30)
end