File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ def initialize(**options)
49
49
@keyed = { }
50
50
end
51
51
52
+ attr :group
53
+
52
54
attr :state
53
55
54
56
# A human readable representation of the container.
Original file line number Diff line number Diff line change 39
39
expect ( container . statistics . restarts ) . to be == 2
40
40
end
41
41
42
+ it "can handle interrupts" do
43
+ finished = IO . pipe
44
+ interrupted = IO . pipe
45
+
46
+ container . spawn ( restart : true ) do |instance |
47
+ Thread . handle_interrupt ( Interrupt => :never ) do
48
+ $stderr. puts "ready"
49
+ instance . ready!
50
+
51
+ finished . first . gets
52
+ $stderr. puts "finishing in child"
53
+ rescue ::Interrupt
54
+ $stderr. puts "incorrectly interrupted in child"
55
+ interrupted . last . puts "incorrectly interrupted"
56
+ end
57
+ rescue ::Interrupt
58
+ $stderr. puts "correctly interrupted in child"
59
+ interrupted . last . puts "correctly interrupted"
60
+ end
61
+
62
+ container . wait_until_ready
63
+
64
+ $stderr. puts "interrupting"
65
+ container . group . interrupt
66
+
67
+ sleep ( 0.001 )
68
+ $stderr. puts "finishing"
69
+ finished . last . puts "finished"
70
+
71
+ expect ( interrupted . first . gets ) . to be == "correctly interrupted\n "
72
+
73
+ container . stop
74
+ end
75
+
42
76
it "should be multiprocess" do
43
77
expect ( subject ) . to be ( :multiprocess? )
44
78
end
You can’t perform that action at this time.
0 commit comments