|
|
|
@ -30,6 +30,10 @@ |
|
|
|
|
require 'grpc' |
|
|
|
|
|
|
|
|
|
describe GRPC::Core::CompletionQueue do |
|
|
|
|
before(:example) do |
|
|
|
|
@cq = GRPC::Core::CompletionQueue.new |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe '#new' do |
|
|
|
|
it 'is constructed successufully' do |
|
|
|
|
expect { GRPC::Core::CompletionQueue.new }.not_to raise_error |
|
|
|
@ -38,39 +42,33 @@ describe GRPC::Core::CompletionQueue do |
|
|
|
|
|
|
|
|
|
describe '#next' do |
|
|
|
|
it 'can be called without failing' do |
|
|
|
|
ch = GRPC::Core::CompletionQueue.new |
|
|
|
|
expect { ch.next(3) }.not_to raise_error |
|
|
|
|
expect { @cq.next(3) }.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'can be called with the time constants' do |
|
|
|
|
ch = GRPC::Core::CompletionQueue.new |
|
|
|
|
# don't use INFINITE_FUTURE, as there we have no events. |
|
|
|
|
non_blocking_consts = [:ZERO, :INFINITE_PAST] |
|
|
|
|
m = GRPC::Core::TimeConsts |
|
|
|
|
non_blocking_consts.each do |c| |
|
|
|
|
a_time = m.const_get(c) |
|
|
|
|
expect { ch.next(a_time) }.not_to raise_error |
|
|
|
|
end |
|
|
|
|
it 'can be called with a time constant' do |
|
|
|
|
# don't use INFINITE_FUTURE, as are no events and this blocks. |
|
|
|
|
# |
|
|
|
|
# don't use INFINITE_PAST, as this fails on docker, and does not need to |
|
|
|
|
# be tested, as its not used anywhere in the ruby implementation |
|
|
|
|
a_time = GRPC::Core::TimeConsts::ZERO |
|
|
|
|
expect { @cq.next(a_time) }.not_to raise_error |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe '#pluck' do |
|
|
|
|
it 'can be called without failing' do |
|
|
|
|
ch = GRPC::Core::CompletionQueue.new |
|
|
|
|
tag = Object.new |
|
|
|
|
expect { ch.pluck(tag, 3) }.not_to raise_error |
|
|
|
|
expect { @cq.pluck(tag, 3) }.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'can be called with the time constants' do |
|
|
|
|
ch = GRPC::Core::CompletionQueue.new |
|
|
|
|
# don't use INFINITE_FUTURE, as there we have no events. |
|
|
|
|
non_blocking_consts = [:ZERO, :INFINITE_PAST] |
|
|
|
|
m = GRPC::Core::TimeConsts |
|
|
|
|
it 'can be called with a time constant' do |
|
|
|
|
# don't use INFINITE_FUTURE, as there no events and this blocks. |
|
|
|
|
# |
|
|
|
|
# don't use INFINITE_PAST, as this fails on docker, and does not need to |
|
|
|
|
# be tested, as its not used anywhere in the ruby implementation |
|
|
|
|
tag = Object.new |
|
|
|
|
non_blocking_consts.each do |c| |
|
|
|
|
a_time = m.const_get(c) |
|
|
|
|
expect { ch.pluck(tag, a_time) }.not_to raise_error |
|
|
|
|
end |
|
|
|
|
a_time = GRPC::Core::TimeConsts::ZERO |
|
|
|
|
expect { @cq.pluck(tag, a_time) }.not_to raise_error |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|