File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ server_endpoint = isempty(ARGS) ? "http://localhost:10000/" : ARGS[1]
71
71
@info (" skipping code generation on Windows to avoid needing batch file execution permissions" )
72
72
end
73
73
include (" test_grpcerrors.jl" )
74
+
75
+ @info (" testing connect timeouts" )
76
+ test_connect_timeout ()
77
+
74
78
serverproc = start_server ()
75
79
76
80
@info (" testing grpcerrors..." )
Original file line number Diff line number Diff line change @@ -142,6 +142,27 @@ function test_blocking_client(server_endpoint::String)
142
142
end
143
143
end
144
144
145
+ function test_connect_timeout ()
146
+ timeout_server_endpoint = " http://10.255.255.1/" # a non routable IP
147
+ timeout_secs = 5
148
+ client = GRPCErrorsBlockingClient (timeout_server_endpoint; verbose= false , connect_timeout= timeout_secs)
149
+ @testset " connect timeout" begin
150
+ data = GrpcerrorsClients. Data (; mode= 1 , param= 0 )
151
+ t1 = time ()
152
+ try
153
+ _, status_future = GrpcerrorsClients. SimpleRPC (client, data)
154
+ gRPCCheck (status_future)
155
+ error (" error not caught" )
156
+ catch ex
157
+ t2 = time ()
158
+ @test isa (ex, gRPCServiceCallException)
159
+ @test ex. message == StatusCode. DEADLINE_EXCEEDED. message
160
+ @test ex. grpc_status == StatusCode. DEADLINE_EXCEEDED. code
161
+ @test (timeout_secs - 1 ) <= (t2 - t1) <= (timeout_secs + 1 )
162
+ end
163
+ end
164
+ end
165
+
145
166
function test_clients (server_endpoint:: String )
146
167
@info (" testing blocking client" )
147
168
test_blocking_client (server_endpoint)
You can’t perform that action at this time.
0 commit comments