|
|
@ -28,7 +28,6 @@ |
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
|
|
|
|
|
|
|
|
require 'grpc' |
|
|
|
require 'grpc' |
|
|
|
require 'port_picker' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include GRPC::Core::StatusCodes |
|
|
|
include GRPC::Core::StatusCodes |
|
|
|
|
|
|
|
|
|
|
@ -71,16 +70,8 @@ describe GRPC::Core::Call do |
|
|
|
before(:each) do |
|
|
|
before(:each) do |
|
|
|
@tag = Object.new |
|
|
|
@tag = Object.new |
|
|
|
@client_queue = GRPC::Core::CompletionQueue.new |
|
|
|
@client_queue = GRPC::Core::CompletionQueue.new |
|
|
|
@server_queue = GRPC::Core::CompletionQueue.new |
|
|
|
fake_host = 'localhost:10101' |
|
|
|
port = find_unused_tcp_port |
|
|
|
@ch = GRPC::Core::Channel.new(fake_host, nil) |
|
|
|
host = "localhost:#{port}" |
|
|
|
|
|
|
|
@server = GRPC::Core::Server.new(@server_queue, nil) |
|
|
|
|
|
|
|
@server.add_http2_port(host) |
|
|
|
|
|
|
|
@ch = GRPC::Core::Channel.new(host, nil) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
after(:each) do |
|
|
|
|
|
|
|
@server.close |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe '#start_read' do |
|
|
|
describe '#start_read' do |
|
|
@ -122,19 +113,6 @@ describe GRPC::Core::Call do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe '#start_write' do |
|
|
|
|
|
|
|
it 'should cause the WRITE_ACCEPTED event' do |
|
|
|
|
|
|
|
call = make_test_call |
|
|
|
|
|
|
|
call.invoke(@client_queue, @tag, @tag) |
|
|
|
|
|
|
|
expect(call.start_write(GRPC::Core::ByteBuffer.new('test_start_write'), |
|
|
|
|
|
|
|
@tag)).to be_nil |
|
|
|
|
|
|
|
ev = @client_queue.next(deadline) |
|
|
|
|
|
|
|
expect(ev.call).to be_a(GRPC::Core::Call) |
|
|
|
|
|
|
|
expect(ev.type).to be(GRPC::Core::CompletionType::WRITE_ACCEPTED) |
|
|
|
|
|
|
|
expect(ev.tag).to be(@tag) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe '#status' do |
|
|
|
describe '#status' do |
|
|
|
it 'can save the status and read it back' do |
|
|
|
it 'can save the status and read it back' do |
|
|
|
call = make_test_call |
|
|
|
call = make_test_call |
|
|
|