rb: Switch NonblockingServer spec from Queue to sleep
authorKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 01:20:25 +0000 (01:20 +0000)
committerKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 01:20:25 +0000 (01:20 +0000)
Using sleep instead of Queue#pop means the thread is killable under JRuby

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@669043 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/spec/nonblockingserver_spec.rb

index fd0fb64..ae7fe2c 100644 (file)
@@ -142,7 +142,7 @@ class ThriftNonblockingServerSpec < Spec::ExampleGroup
             when :hello
               result << client.greeting(true) # ignore result
             when :sleep
-              client.sleep(0.5)
+              client.sleep(args[0] || 0.5)
               result << :slept
             when :shutdown
               client.shutdown
@@ -227,11 +227,12 @@ class ThriftNonblockingServerSpec < Spec::ExampleGroup
     it "should kill active messages when they don't expire while shutting down" do
       result = Queue.new
       client = setup_client_thread(result)
-      client << :block
+      client << [:sleep, 10]
       sleep 0.1 # start processing the client's message
       @server.shutdown(1)
       @catch_exceptions = true
       @server_thread.join(3).should_not be_nil
+      result.should be_empty
     end
 
     it "should allow shutting down in response to a message" do