Skip to content

Commit 2d23be1

Browse files
authored
Use different socket names for distinct tests
1 parent 47d4e1c commit 2d23be1

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/test_typed.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
@testset "Message dispatcher" begin
22

33
if Sys.iswindows()
4-
global_socket_name = "\\\\.\\pipe\\jsonrpc-testrun"
4+
global_socket_name1 = "\\\\.\\pipe\\jsonrpc-testrun1"
55
elseif Sys.isunix()
6-
global_socket_name = joinpath(tempdir(), "jsonrpc-testrun")
6+
global_socket_name1 = joinpath(tempdir(), "jsonrpc-testrun1")
77
else
88
error("Unknown operating system.")
99
end
@@ -17,7 +17,7 @@
1717
server_is_up = Base.Condition()
1818

1919
server_task = @async try
20-
server = listen(global_socket_name)
20+
server = listen(global_socket_name1)
2121
notify(server_is_up)
2222
sock = accept(server)
2323
global conn = JSONRPC.JSONRPCEndpoint(sock, sock)
@@ -41,7 +41,7 @@
4141

4242
wait(server_is_up)
4343

44-
sock2 = connect(global_socket_name)
44+
sock2 = connect(global_socket_name1)
4545
conn2 = JSONRPCEndpoint(sock2, sock2)
4646

4747
run(conn2)
@@ -63,10 +63,18 @@
6363

6464
# Now we test a faulty server
6565

66+
if Sys.iswindows()
67+
global_socket_name2 = "\\\\.\\pipe\\jsonrpc-testrun2"
68+
elseif Sys.isunix()
69+
global_socket_name2 = joinpath(tempdir(), "jsonrpc-testrun2")
70+
else
71+
error("Unknown operating system.")
72+
end
73+
6674
server_is_up = Base.Condition()
6775

6876
server_task2 = @async try
69-
server = listen(global_socket_name)
77+
server = listen(global_socket_name2)
7078
notify(server_is_up)
7179
sock = accept(server)
7280
global conn = JSONRPC.JSONRPCEndpoint(sock, sock)
@@ -85,7 +93,7 @@
8593

8694
wait(server_is_up)
8795

88-
sock2 = connect(global_socket_name)
96+
sock2 = connect(global_socket_name2)
8997
conn2 = JSONRPCEndpoint(sock2, sock2)
9098

9199
run(conn2)

0 commit comments

Comments
 (0)