JuliaIO / JSON.jl

JSON parsing and printing
Other
311 stars 100 forks source link

Use random port during testing #349

Closed maleadt closed 1 year ago

maleadt commented 1 year ago

Currently the async.jl test is hard-coded to use port 7777, which can lead to test failures when doing multiple tests of JSON at the same time (e.g. on PkgEval):

async: Error During Test at /usr/local/share/julia/packages/JSON/NeJ9k/test/runtests.jl:69
  Got exception outside of a @test
  LoadError: IOError: listen: address already in use (EADDRINUSE)
  Stacktrace:
    [1] uv_error
      @ ./libuv.jl:97 [inlined]
    [2] #listen#13
      @ /opt/julia/share/julia/stdlib/v1.8/Sockets/src/Sockets.jl:629 [inlined]
    [3] #listen#10
      @ /opt/julia/share/julia/stdlib/v1.8/Sockets/src/Sockets.jl:622 [inlined]
    [4] #listen#12
      @ /opt/julia/share/julia/stdlib/v1.8/Sockets/src/Sockets.jl:626 [inlined]
    [5] #listen#11
      @ /opt/julia/share/julia/stdlib/v1.8/Sockets/src/Sockets.jl:625 [inlined]
    [6] listen(port::Int64)
      @ Sockets /opt/julia/share/julia/stdlib/v1.8/Sockets/src/Sockets.jl:625
    [7] top-level scope
      @ /usr/local/share/julia/packages/JSON/NeJ9k/test/async.jl:11
    [8] include(fname::String)
      @ Base.MainInclude ./client.jl:476
    [9] macro expansion
      @ /usr/local/share/julia/packages/JSON/NeJ9k/test/runtests.jl:70 [inlined]
   [10] macro expansion
      @ /opt/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [11] macro expansion
      @ /usr/local/share/julia/packages/JSON/NeJ9k/test/runtests.jl:70 [inlined]
   [12] macro expansion
      @ /opt/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [13] top-level scope
      @ /usr/local/share/julia/packages/JSON/NeJ9k/test/runtests.jl:64
   [14] include(fname::String)
      @ Base.MainInclude ./client.jl:476
   [15] top-level scope
      @ none:6
   [16] eval
      @ ./boot.jl:368 [inlined]
   [17] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:276
   [18] _start()
      @ Base ./client.jl:522
  in expression starting at /usr/local/share/julia/packages/JSON/NeJ9k/test/async.jl:11
quinnj commented 1 year ago

PR up: https://github.com/JuliaIO/JSON.jl/pull/350