-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelastic.jl
37 lines (31 loc) · 1.37 KB
/
elastic.jl
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
@testset "ElasticManager" begin
TIMEOUT = 10.
em = ElasticManager(; addr=:auto, port=0)
@test em isa ElasticManager
# launch worker
exeflags = ("--code-coverage=user",)
old_cmd = ElasticClusterManager.get_connect_cmd(em; exeflags=exeflags)
new_cmd = `$(old_cmd) --coverage=user`
# run(`sh -c $(new_cmd)`) # comment out this line when you are finished debugging
run(`sh -c $(new_cmd)`; wait=false) # uncomment this line when you are finished debugging
# wait at most TIMEOUT seconds for it to connect
@test :ok == timedwait(TIMEOUT) do
length(em.active) == 1
end
wait(rmprocs(workers()))
@testset "show(io, ::ElasticManager)" begin
str = sprint(show, em)
lines = strip.(split(strip(str), '\n'))
@test lines[1] == "ElasticManager:"
@test lines[2] == "Active workers : []"
@test lines[3] == "Number of workers to be added : 0"
@test lines[4] == "Terminated workers : [ 2]"
end
@testset "Other constructors for ElasticManager()" begin
@test ElasticManager(9001) isa ElasticManager
@test ElasticManager(ip"127.0.0.1", 9002) isa ElasticManager
@test Distributed.HDR_COOKIE_LEN isa Real
@test Distributed.HDR_COOKIE_LEN >= 16
@test ElasticManager(ip"127.0.0.1", 9003, Random.randstring(Distributed.HDR_COOKIE_LEN)) isa ElasticManager
end
end