Skip to content

Commit a204ca2

Browse files
committed
Streaming tests now have parity with unary
1 parent d08e2fb commit a204ca2

1 file changed

Lines changed: 46 additions & 11 deletions

File tree

test/runtests.jl

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ include("gen/test/test_pb.jl")
142142
# end
143143

144144
@static if VERSION >= v"1.12"
145-
# @testset "Response Streaming" begin
146-
N = 16
145+
# @testset "Response Streaming" begin
146+
N = 1000
147147

148148
client = TestService_TestServerStreamRPC_Client(_TEST_HOST, _TEST_PORT)
149149

150150
response_c = Channel{TestResponse}(N)
151151

152-
req = grpc_async_request(client, TestRequest(16, zeros(UInt64, 1)), response_c)
152+
req = grpc_async_request(client, TestRequest(N, zeros(UInt64, 1)), response_c)
153153

154-
# We should get back 16 messages that end with their length
155-
for i in 1:N
154+
# We should get back N messages that end with their length
155+
for i in 1:N
156156
response = take!(response_c)
157157
@test length(response.data) == i
158158
@test last(response.data) == i
@@ -161,8 +161,8 @@ include("gen/test/test_pb.jl")
161161
grpc_async_await(req)
162162
# end
163163

164-
# @testset "Request Streaming" begin
165-
N = 16
164+
# @testset "Request Streaming" begin
165+
N = 1000
166166
client = TestService_TestClientStreamRPC_Client(_TEST_HOST, _TEST_PORT)
167167
request_c = Channel{TestRequest}(N)
168168

@@ -174,15 +174,15 @@ include("gen/test/test_pb.jl")
174174

175175
close(request_c)
176176
response = grpc_async_await(client, request)
177-
177+
178178
@test length(response.data) == N
179179
for i in 1:N
180180
@test response.data[i] == i
181181
end
182182
# end
183183

184-
# @testset "Bidirectional Streaming" begin
185-
N = 16
184+
# @testset "Bidirectional Streaming" begin
185+
N = 1000
186186
client = TestService_TestBidirectionalStreamRPC_Client(_TEST_HOST, _TEST_PORT)
187187

188188
request_c = Channel{TestRequest}(N)
@@ -204,6 +204,41 @@ include("gen/test/test_pb.jl")
204204
grpc_async_await(req)
205205
# end
206206

207+
# @testset "Response Streaming - Small Messages" begin
208+
N = 1000
209+
client = TestService_TestServerStreamRPC_Client(_TEST_HOST, _TEST_PORT)
210+
211+
response_c = Channel{TestResponse}(N)
212+
213+
req = grpc_async_request(client, TestRequest(N, zeros(UInt64, 1)), response_c)
214+
215+
# We should get back N small messages
216+
for i in 1:N
217+
response = take!(response_c)
218+
@test length(response.data) >= 1
219+
end
220+
221+
grpc_async_await(req)
222+
# end
223+
224+
# @testset "Request Streaming - Large Payloads" begin
225+
N = 100
226+
client = TestService_TestClientStreamRPC_Client(_TEST_HOST, _TEST_PORT)
227+
request_c = Channel{TestRequest}(N)
228+
229+
request = grpc_async_request(client, request_c)
230+
231+
# Send 100 large payloads (similar to unary big test)
232+
for i in 1:N
233+
put!(request_c, TestRequest(1, zeros(UInt64, 32*28*224)))
234+
end
235+
236+
close(request_c)
237+
response = grpc_async_await(client, request)
238+
239+
@test length(response.data) == N
240+
# end
241+
207242
# @testset "Don't Stick User Tasks"
208243
# This fails on Julia 1.10 but works on Julia 1.12
209244
client = TestService_TestRPC_Client(_TEST_HOST, _TEST_PORT)
@@ -219,4 +254,4 @@ include("gen/test/test_pb.jl")
219254
end
220255

221256
grpc_shutdown()
222-
end
257+
end

0 commit comments

Comments
 (0)