Skip to content

Commit a82ef5e

Browse files
authored
Merge pull request #19 from JuliaComputing/tan/asynctest
add tests to check task safety
2 parents 63c3d65 + 5691c16 commit a82ef5e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

test/runtests_routeguide.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ server_endpoint = isempty(ARGS) ? "http://localhost:10000/" : ARGS[1]
8888
@debug("testing routeclinet...")
8989
test_clients(server_endpoint)
9090

91+
@debug("testing async safety...")
92+
test_task_safety(server_endpoint)
93+
9194
kill(serverproc)
9295
@info("stopped test server")
9396
end

test/test_routeclient.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,22 @@ function test_clients(server_endpoint::String)
171171
test_blocking_client(server_endpoint)
172172
@info("testing async client")
173173
test_async_client(server_endpoint)
174+
end
175+
176+
function test_task_safety(server_endpoint::String)
177+
@testset "async safety" begin
178+
client = RouteGuideBlockingClient(server_endpoint; verbose=false)
179+
@sync begin
180+
for taskid in 1:5
181+
@async begin
182+
test_get_feature(client)
183+
test_list_features(client)
184+
test_record_route(client)
185+
test_route_chat(client)
186+
test_exception()
187+
test_message_length_limit(server_endpoint)
188+
end
189+
end
190+
end
191+
end
174192
end

0 commit comments

Comments
 (0)