Skip to content

Commit 60c969a

Browse files
kenhysashie
andauthored
Backport(v1.16) test_in_udp: Reduce execution time of message_length_limit test (#4682) (#4790)
**Which issue(s) this PR fixes**: Backport #4682 **What this PR does / why we need it**: Although it's improved in #4676, it still takes 5 seconds on windows. It can be reduced more by sending data that doesn't exceed the limit. ``` test: message_length_limit: .: (1.104855) ``` **Docs Changes**: **Release Note**: Signed-off-by: Takuro Ashie <ashie@clear-code.com> Co-authored-by: Takuro Ashie <ashie@clear-code.com>
1 parent 5c08ab6 commit 60c969a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

test/plugin/test_in_udp.rb

100755100644
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,25 +268,31 @@ def create_udp_socket(host, port)
268268

269269
test 'message_length_limit' do
270270
message_length_limit = 32
271+
272+
if Fluent.windows?
273+
expected_records = ["0" * 30, "4" * 30]
274+
else
275+
expected_records = 1.upto(3).collect do |i|
276+
"#{i}" * message_length_limit
277+
end
278+
expected_records.prepend("0" * 30)
279+
expected_records.append("4" * 30)
280+
end
281+
271282
d = create_driver(base_config + %!
272283
format none
273284
message_length_limit #{message_length_limit}
274285
!)
275-
d.run(expect_records: 3, timeout: 5) do
286+
d.run(expect_records: expected_records.size, timeout: 5) do
276287
create_udp_socket('127.0.0.1', @port) do |u|
277-
3.times do |i|
288+
u.send("0" * 30 + "\n", 0)
289+
1.upto(3) do |i|
278290
u.send("#{i}" * 40 + "\n", 0)
279291
end
292+
u.send("4" * 30 + "\n", 0)
280293
end
281294
end
282295

283-
if Fluent.windows?
284-
expected_records = []
285-
else
286-
expected_records = 3.times.collect do |i|
287-
"#{i}" * message_length_limit
288-
end
289-
end
290296
actual_records = d.events.collect do |event|
291297
event[2]["message"]
292298
end

0 commit comments

Comments
 (0)