Skip to content

Commit cb52a09

Browse files
committed
Fixed Thrift::TypeError exception in specs
An error occurs while running specs, that changes the behavior of the system under test, leading to false positive: NonblockingServer Thrift::NonblockingServer #<Thread:0x0000ffff67b9f138 /code/lib/rb/spec/nonblocking_server_spec.rb:147 run> terminated with exception (report_on_exception is true): /code/lib/rb/lib/thrift/types.rb:69:in 'Thrift.check_type': Expected Types::DOUBLE, received Integer for field seconds (Thrift::TypeError) from /code/lib/rb/lib/thrift/struct.rb:157:in 'block in SpecNamespace::NonblockingService::Sleep_args#field_accessor' from /code/lib/rb/lib/thrift/client.rb:41:in 'block in Thrift::Client#send_message_args' from /code/lib/rb/lib/thrift/client.rb:40:in 'Hash#each' from /code/lib/rb/lib/thrift/client.rb:40:in 'Thrift::Client#send_message_args' from /code/lib/rb/lib/thrift/client.rb:30:in 'Thrift::Client#send_message' from /code/lib/rb/spec/gen-rb/nonblocking_service.rb:75:in 'SpecNamespace::NonblockingService::Client#send_sleep' from /code/lib/rb/spec/gen-rb/nonblocking_service.rb:70:in 'SpecNamespace::NonblockingService::Client#sleep' from /code/lib/rb/spec/nonblocking_server_spec.rb:160:in 'block in RSpec::ExampleGroups::NonblockingServer::ThriftNonblockingServer#setup_client_thread' should kill active messages when they don't expire while shutting down When an integer 10 is sent to "sleep", instead of actually sleeping an error happens, and the method never called, leading to no record of the method execution recorded in the result. Which is the same expectation is if the method call was aborted in the middle.
1 parent 10d5a65 commit cb52a09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rb/spec/nonblocking_server_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def setup_client_thread(result)
245245
it "should kill active messages when they don't expire while shutting down" do
246246
result = Queue.new
247247
client = setup_client_thread(result)
248-
client << [:sleep, 10]
248+
client << [:sleep, 10.0]
249249
sleep 0.1 # start processing the client's message
250250
@server.shutdown(1)
251251
@catch_exceptions = true

0 commit comments

Comments
 (0)