-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanagers.jl
More file actions
38 lines (31 loc) · 1.63 KB
/
Copy pathmanagers.jl
File metadata and controls
38 lines (31 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# This file is a part of Julia. License is MIT: https://julialang.org/license
using Test
using DistributedNext
using Sockets
using DistributedNext: parse_machine, SSHManager, LocalManager
@testset "Managers" begin
@test parse_machine("127.0.0.1") == ("127.0.0.1", nothing)
@test parse_machine("127.0.0.1:80") == ("127.0.0.1", 80)
@test parse_machine("[2001:db8::1]") == ("2001:db8::1", nothing)
@test parse_machine("[2001:db8::1]:443") == ("2001:db8::1", 443)
@test parse_machine("127.0.0.1:90") == ("127.0.0.1", 90)
@test parse_machine("127.0.0.1:1") == ("127.0.0.1", 1)
@test parse_machine("127.0.0.1:65535") == ("127.0.0.1", 65535)
@test_throws ArgumentError parse_machine("127.0.0.1:-1")
@test_throws ArgumentError parse_machine("127.0.0.1:0")
@test_throws ArgumentError parse_machine("127.0.0.1:65536")
@test_throws ArgumentError parse_machine("[2001:db8::1]:443:888")
@test_throws ArgumentError parse_machine("[2001:db8::1")
@test_throws ArgumentError parse_machine("[2001:db8::1]:aaa")
@test occursin(r"^SSHManager\(machines=.*\)$",
sprint((t,x) -> show(t, "text/plain", x), SSHManager("127.0.0.1")))
@test sprint((t,x) -> show(t, "text/plain", x), LocalManager(1, true)) == "LocalManager()"
end
@testset "is_cluster_manager trait" begin
# Subtypes of ClusterManager opt in automatically
@test DistributedNext.is_cluster_manager(LocalManager(1, true))
# Arbitrary types do not and cause exceptions
struct NotAManager end
@test !DistributedNext.is_cluster_manager(NotAManager())
@test_throws ArgumentError DistributedNext.addprocs(NotAManager())
end