Skip to content

Commit cfd801d

Browse files
authored
[Distributed] add some unit tests for managers.jl (JuliaLang/julia#34963)
It finds a bug.
1 parent cd7678c commit cfd801d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/managers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function parse_machine(machine::AbstractString)
195195
if machine[begin] == '[' # ipv6 bracket notation (RFC 2732)
196196
ipv6_end = findlast(']', machine)
197197
if ipv6_end === nothing
198-
throw(ArgumentError("invalid machine definition format string: invalid port format \"$machine_def\""))
198+
throw(ArgumentError("invalid machine definition format string: invalid port format \"$machine\""))
199199
end
200200
hoststr = machine[begin+1 : prevind(machine,ipv6_end)]
201201
machine_def = split(machine[ipv6_end : end] , ':')

test/managers.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ using Distributed: parse_machine, SSHManager, LocalManager
1313
@test parse_machine("127.0.0.1:90") == ("127.0.0.1", 90)
1414
@test parse_machine("127.0.0.1:1") == ("127.0.0.1", 1)
1515
@test parse_machine("127.0.0.1:65535") == ("127.0.0.1", 65535)
16+
1617
@test_throws ArgumentError parse_machine("127.0.0.1:-1")
1718
@test_throws ArgumentError parse_machine("127.0.0.1:0")
1819
@test_throws ArgumentError parse_machine("127.0.0.1:65536")
20+
@test_throws ArgumentError parse_machine("[2001:db8::1]:443:888")
21+
@test_throws ArgumentError parse_machine("[2001:db8::1")
22+
@test_throws ArgumentError parse_machine("[2001:db8::1]:aaa")
1923

2024
@test occursin(r"^SSHManager\(machines=.*\)$",
2125
sprint((t,x) -> show(t, "text/plain", x), SSHManager("127.0.0.1")))

0 commit comments

Comments
 (0)