Skip to content

Commit

Permalink
Skip flakey "concurrent requests" tests on windows (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner authored Aug 30, 2023
1 parent 246504e commit 8a614d5
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -379,25 +379,31 @@ include("setup.jl")
end

@testset "concurrent requests" begin
mine = Downloader()
for downloader in (nothing, mine)
have_lsof = Sys.which("lsof") !== nothing
count_tcp() = Base.count(x->contains("TCP",x), split(read(`lsof -p $(getpid())`, String), '\n'))
if have_lsof
n_tcp = count_tcp()
end
delay = 2
count = 100
url = "$server/delay/$delay"
t = @elapsed @sync for id = 1:count
@async begin
json = download_json("$url?id=$id", downloader = downloader)
@test get(json["args"], "id", nothing) == ["$id"]
if Sys.iswindows()
# Known issue https://github.com/JuliaLang/Downloads.jl/issues/227
# These test should be fixed on Windows and then reenabled.
@test_skip "concurrent requests flakey on Windows"
else
mine = Downloader()
for downloader in (nothing, mine)
have_lsof = Sys.which("lsof") !== nothing
count_tcp() = Base.count(x->contains("TCP",x), split(read(`lsof -p $(getpid())`, String), '\n'))
if have_lsof
n_tcp = count_tcp()
end
delay = 2
count = 100
url = "$server/delay/$delay"
t = @elapsed @sync for id = 1:count
@async begin
json = download_json("$url?id=$id", downloader = downloader)
@test get(json["args"], "id", nothing) == ["$id"]
end
end
@test t < 0.9*count*delay
if have_lsof
@test n_tcp == count_tcp()
end
end
@test t < 0.9*count*delay
if have_lsof
@test n_tcp == count_tcp()
end
end
end
Expand Down

0 comments on commit 8a614d5

Please sign in to comment.