Skip to content

Commit c030575

Browse files
committed
Fix timeout values for CI
1 parent aac52b7 commit c030575

File tree

2 files changed

+32
-30
lines changed

2 files changed

+32
-30
lines changed

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-I lib-edge
12
--require spec_helper
23
--color
34
--warnings

spec/concurrent/edge/erlang_actor_spec.rb

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
end
1616

1717
specify '#receive' do
18-
id = -> v { v }
1918
succ = -> v { v.succ }
2019

2120
[[[:v], -> { receive }, :v],
22-
[[:v], -> { receive on(ANY, &id) }, :v],
21+
[[:v], -> { receive on(ANY, &identity) }, :v],
2322
[[:v, 1], -> { receive Numeric }, 1],
2423
[[:v, 1], -> { receive(Numeric, &succ) }, 2],
2524

@@ -33,14 +32,14 @@
3332
[[:v, 1], -> { receive Numeric, timeout: 1, timeout_value: :timeout }, 1],
3433
[[:v, 1], -> { receive(Numeric, timeout: 1, timeout_value: :timeout, &succ) }, 2],
3534

36-
[[:v], -> { receive on(Numeric, &id), on(TIMEOUT, nil), timeout: 0 }, nil],
35+
[[:v], -> { receive on(Numeric, &identity), on(TIMEOUT, nil), timeout: 0 }, nil],
3736
[[:v], -> { receive on(Numeric, &succ), on(TIMEOUT, nil), timeout: 0 }, nil],
38-
[[:v], -> { receive on(Numeric, &id), on(TIMEOUT, :timeout), timeout: 0 }, :timeout],
37+
[[:v], -> { receive on(Numeric, &identity), on(TIMEOUT, :timeout), timeout: 0 }, :timeout],
3938
[[:v], -> { receive on(Numeric, &succ), on(TIMEOUT, :timeout), timeout: 0 }, :timeout],
4039

41-
[[:v, 1], -> { receive on(Numeric, &id), on(TIMEOUT, nil), timeout: 1 }, 1],
40+
[[:v, 1], -> { receive on(Numeric, &identity), on(TIMEOUT, nil), timeout: 1 }, 1],
4241
[[:v, 1], -> { receive on(Numeric, &succ), on(TIMEOUT, nil), timeout: 1 }, 2],
43-
[[:v, 1], -> { receive on(Numeric, &id), on(TIMEOUT, :timeout), timeout: 1 }, 1],
42+
[[:v, 1], -> { receive on(Numeric, &identity), on(TIMEOUT, :timeout), timeout: 1 }, 1],
4443
[[:v, 1], -> { receive on(Numeric, &succ), on(TIMEOUT, :timeout), timeout: 1 }, 2],
4544
].each_with_index do |(messages, body, result), i|
4645
a = Concurrent::ErlangActor.spawn(type, &body)
@@ -229,14 +228,14 @@
229228
b = spawn { :done }
230229
b.terminated.wait
231230
ref = monitor b
232-
[b, ref, receive(timeout: 0.01, timeout_value: :timeout)]
231+
[b, ref, receive(timeout: 1, timeout_value: :timeout)]
233232
end,
234233
on_pool:
235234
-> do
236235
b = spawn { :done }
237236
b.terminated.wait
238237
ref = monitor b
239-
receive(timeout: 0.01) { |v| [b, ref, v] }
238+
receive(timeout: 1) { |v| [b, ref, v] }
240239
end }
241240

242241
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -324,7 +323,7 @@
324323
-> do
325324
b = spawn { :done }
326325
b.terminated.wait
327-
sleep 0.01
326+
sleep 0.1
328327
trap
329328
link b
330329
[b, receive]
@@ -333,7 +332,7 @@
333332
-> do
334333
b = spawn { :done }
335334
b.terminated.wait
336-
sleep 0.01
335+
sleep 0.1
337336
trap
338337
link b
339338
receive { |v| [b, v] }
@@ -374,15 +373,15 @@
374373
-> do
375374
b = spawn(link: true) { :ok }
376375
trap
377-
[receive, b]
376+
[receive(timeout: 1), b]
378377
end,
379378
on_pool:
380379
-> do
381380
b = spawn(link: true) { :ok }
382381
trap
383382
receive(on(ANY) { |v| [v, b] },
384383
on(TIMEOUT) { |v| [nil, b] },
385-
timeout: 0.01)
384+
timeout: 1)
386385
end }
387386

388387
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -396,14 +395,14 @@
396395
body = { on_thread:
397396
-> do
398397
spawn(link: true) { terminate :boom }
399-
receive(timeout: 0.01)
398+
receive(timeout: 1)
400399
end,
401400
on_pool:
402401
-> do
403402
spawn(link: true) { terminate :boom }
404403
receive(on(ANY) { |v| [v, b] },
405404
on(TIMEOUT) { |v| [nil, b] },
406-
timeout: 0.01)
405+
timeout: 1)
407406
end }
408407

409408
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -416,15 +415,15 @@
416415
-> do
417416
b = spawn(link: true) { terminate :boom }
418417
trap
419-
[receive(timeout: 0.01), b]
418+
[receive(timeout: 1), b]
420419
end,
421420
on_pool:
422421
-> do
423422
b = spawn(link: true) { terminate :boom }
424423
trap
425424
receive(on(ANY) { |v| [v, b] },
426425
on(TIMEOUT) { |v| [nil, b] },
427-
timeout: 0.01)
426+
timeout: 1)
428427
end }
429428

430429
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -460,15 +459,15 @@
460459
-> do
461460
b = spawn(link: true) { terminate :normal, value: :ok }
462461
trap
463-
[receive, b]
462+
[receive(timeout: 1), b]
464463
end,
465464
on_pool:
466465
-> do
467466
b = spawn(link: true) { terminate :normal, value: :ok }
468467
trap
469468
receive(on(ANY) { |v| [v, b] },
470469
on(TIMEOUT) { |v| [nil, b] },
471-
timeout: 0.01)
470+
timeout: 1)
472471
end }
473472

474473
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -565,7 +564,7 @@
565564
terminate pid, :normal # sends the signal to mailbox
566565
receive(on(ANY, :continued),
567566
on(TIMEOUT, :timeout),
568-
timeout: 1)
567+
timeout: 0.01)
569568
end }
570569

571570
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -578,13 +577,13 @@
578577
-> do
579578
terminate pid, :normal
580579
trap
581-
receive(timeout: 0.01)
580+
receive(timeout: 0)
582581
end,
583582
on_pool:
584583
-> do
585584
terminate pid, :normal
586585
trap
587-
receive(on(ANY, &identity), on(TIMEOUT, nil), timeout: 0.01)
586+
receive(on(ANY, &identity), on(TIMEOUT, nil), timeout: 0)
588587
end }
589588

590589
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -620,7 +619,7 @@
620619
specify 4 do
621620
body = { on_thread:
622621
-> do
623-
b = spawn(link: true) { trap; receive timeout: 0.01, timeout_value: :timeout }
622+
b = spawn(link: true) { trap; receive timeout: 1, timeout_value: :timeout }
624623
terminate b, :normal
625624
b
626625
end,
@@ -630,7 +629,7 @@
630629
trap
631630
receive(on(ANY, &identity),
632631
on(TIMEOUT, :timeout),
633-
timeout: 0.01)
632+
timeout: 1)
634633
end
635634

636635
terminate b, :normal
@@ -648,7 +647,7 @@
648647
b = spawn(link: true) { receive timeout: 0.01; terminate :continued }
649648
terminate b, :normal
650649
trap
651-
[b, receive(timeout: 0.02)]
650+
[b, receive(timeout: 1)]
652651
end,
653652
on_pool:
654653
-> do
@@ -739,10 +738,10 @@
739738
specify 9 do
740739
body = { on_thread:
741740
-> do
742-
b = spawn(link: true) { receive timeout: 0.01; :done }
741+
b = spawn(link: true) { receive timeout: 1; :done }
743742
terminate b, :kill
744743
trap
745-
[b, receive(timeout: 0.01)]
744+
[b, receive(timeout: 1)]
746745
end,
747746
on_pool:
748747
-> do
@@ -762,12 +761,12 @@
762761
body = { on_thread:
763762
-> do
764763
terminate pid, :kill
765-
receive timeout: 0.01
764+
receive timeout: 0
766765
end,
767766
on_pool:
768767
-> do
769768
terminate pid, :kill
770-
receive(on(ANY, :continued), on(TIMEOUT, :timeout), timeout: 1)
769+
receive(on(ANY, :continued), on(TIMEOUT, :timeout), timeout: 0)
771770
end }
772771

773772
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -780,13 +779,13 @@
780779
-> do
781780
terminate pid, :kill
782781
trap
783-
receive timeout: 0.01
782+
receive timeout: 0
784783
end,
785784
on_pool:
786785
-> do
787786
terminate pid, :kill
788787
trap
789-
receive(on(ANY, &identity), on(TIMEOUT, :timeout), timeout: 1)
788+
receive(on(ANY, &identity), on(TIMEOUT, :timeout), timeout: 0)
790789
end }
791790

792791
a = Concurrent::ErlangActor.spawn(type, &body.fetch(type))
@@ -922,6 +921,8 @@
922921
let(:type) { :on_pool }
923922
it_behaves_like 'erlang actor'
924923

924+
include Concurrent::ErlangActor::EnvironmentConstants
925+
925926
specify "receives message repeatedly with keep" do
926927
actor = Concurrent::ErlangActor.spawn(:on_pool) do
927928
receive on(ANY) { |v| v == :done ? terminate(:normal, value: 42) : reply(v) },

0 commit comments

Comments
 (0)