Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit d8e79f8

Browse files
committed
Eliminates one class of frequently-encountered timing issues with tests
Fixes logstash-plugins#102
1 parent 6947c42 commit d8e79f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spec/inputs/tcp_spec.rb

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def get_port
7272
end
7373

7474
insist { events.length } == event_count
75+
events = events.sort_by {|e| e.get("message")} # the ordering of events in the queue is highly timing-dependent
7576
event_count.times do |i|
7677
event = events[i]
7778
insist { event.get("message") } == "#{i} ☹"
@@ -106,6 +107,7 @@ def get_port
106107
end
107108

108109
insist { events.length } == event_count
110+
events = events.sort_by {|e| e.get("message")} # the ordering of events in the queue is highly timing-dependent
109111
event_count.times do |i|
110112
insist { events[i].get("message") } == "#{i} ☹"
111113
insist { events[i].get("host") } == "1.2.3.4"
@@ -231,6 +233,7 @@ def get_port
231233
(1..event_count).map{queue.pop}
232234
end
233235

236+
events = events.sort_by {|e| e.get("idx")} # the ordering of events in the queue is highly timing-dependent
234237
events.each_with_index do |event, idx|
235238
insist { event.get("hello") } == data["hello"]
236239
insist { event.get("foo").to_a } == data["foo"] # to_a to cast Java ArrayList produced by JrJackson

0 commit comments

Comments
 (0)