Skip to content

Commit

Permalink
Merge pull request #4682 from fluent/reduce-test-execution-time
Browse files Browse the repository at this point in the history
test_in_udp: Reduce execution time of message_length_limit test
  • Loading branch information
ashie authored Oct 22, 2024
2 parents a5cccf5 + fa01800 commit f493f25
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions test/plugin/test_in_udp.rb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,31 @@ def create_udp_socket(host, port)

test 'message_length_limit' do
message_length_limit = 32

if Fluent.windows?
expected_records = ["0" * 30, "4" * 30]
else
expected_records = 1.upto(3).collect do |i|
"#{i}" * message_length_limit
end
expected_records.prepend("0" * 30)
expected_records.append("4" * 30)
end

d = create_driver(base_config + %!
format none
message_length_limit #{message_length_limit}
!)
d.run(expect_records: 3, timeout: 5) do
d.run(expect_records: expected_records.size, timeout: 5) do
create_udp_socket('127.0.0.1', @port) do |u|
3.times do |i|
u.send("0" * 30 + "\n", 0)
1.upto(3) do |i|
u.send("#{i}" * 40 + "\n", 0)
end
u.send("4" * 30 + "\n", 0)
end
end

if Fluent.windows?
expected_records = []
else
expected_records = 3.times.collect do |i|
"#{i}" * message_length_limit
end
end
actual_records = d.events.collect do |event|
event[2]["message"]
end
Expand Down

0 comments on commit f493f25

Please sign in to comment.