mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
input generator tests
This commit is contained in:
parent
9bbfcc362b
commit
97202677ff
1 changed files with 35 additions and 0 deletions
35
spec/inputs/generator.rb
Normal file
35
spec/inputs/generator.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require "test_utils"
|
||||
|
||||
describe "inputs/generator" do
|
||||
extend LogStash::RSpec
|
||||
|
||||
class Shiftcount
|
||||
def initialize; @count = 0; end
|
||||
def <<(arg); @count += 1 end
|
||||
attr_reader :count
|
||||
end
|
||||
|
||||
describe "generate events" do
|
||||
event_count = 100000 + rand(50)
|
||||
|
||||
config <<-CONFIG
|
||||
input {
|
||||
generator {
|
||||
type => "blah"
|
||||
count => #{event_count}
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
input do |plugins|
|
||||
sequence = 0
|
||||
generator = plugins.first
|
||||
output = Shiftcount.new
|
||||
generator.register
|
||||
start = Time.now
|
||||
generator.run(output)
|
||||
duration = Time.now - start
|
||||
puts "Rate: #{event_count / duration}"
|
||||
end # input
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue