mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
4008a7ad7e
commit
dfd6164edd
14 changed files with 55 additions and 30 deletions
|
@ -6,5 +6,9 @@ set -e
|
|||
# installing gems. See https://github.com/elastic/logstash/issues/5179
|
||||
export JRUBY_OPTS="-J-Xmx1g"
|
||||
|
||||
rake test:install-default
|
||||
rake test:integration
|
||||
rm -rf build/*
|
||||
rake artifact:tar
|
||||
cd build
|
||||
tar xvf *.tar.gz
|
||||
cd ../qa/integration
|
||||
rspec
|
||||
|
|
1
qa/integration/.rspec
Normal file
1
qa/integration/.rspec
Normal file
|
@ -0,0 +1 @@
|
|||
--default-path specs/
|
|
@ -12,13 +12,13 @@ config: |-
|
|||
}
|
||||
}
|
||||
output {
|
||||
#file {
|
||||
# path => "kafka_input.output"
|
||||
# flush_interval => 0
|
||||
# codec => line { format => "%{message}" }
|
||||
#}
|
||||
file {
|
||||
path => "kafka_input.output"
|
||||
flush_interval => 0
|
||||
codec => line { format => "%{message}" }
|
||||
}
|
||||
}
|
||||
|
||||
input: how_sample.input
|
||||
setup_script: download_input.sh
|
||||
actual_output: kafka_input.output
|
||||
teardown_script:
|
||||
|
|
|
@ -57,7 +57,7 @@ class Fixture
|
|||
end
|
||||
|
||||
def teardown
|
||||
File.delete(@actual_output) if @settings.is_set?(@actual_output) && output_exists?
|
||||
File.delete(@actual_output) if @settings.is_set?("actual_output") && output_exists?
|
||||
puts "Tearing down services"
|
||||
services = @settings.get("services")
|
||||
services.each do |name|
|
||||
|
|
|
@ -15,6 +15,11 @@ class TestSettings
|
|||
@suite_settings = YAML.load_file(SUITE_SETTINGS_FILE)
|
||||
# Per test settings, where one can override stuff and define test specific config
|
||||
@test_settings = YAML.load_file(@tests_settings_file)
|
||||
|
||||
if verbose_mode?
|
||||
puts "Test settings file: #{@tests_settings_file}"
|
||||
puts "Suite settings file: #{SUITE_SETTINGS_FILE}"
|
||||
end
|
||||
|
||||
if is_set?("config")
|
||||
if get("config").is_a?(Hash)
|
||||
|
@ -37,6 +42,10 @@ class TestSettings
|
|||
@suite_settings[key]
|
||||
end
|
||||
end
|
||||
|
||||
def verbose_mode?
|
||||
@suite_settings["verbose_mode"]
|
||||
end
|
||||
|
||||
def is_set?(key)
|
||||
@suite_settings.key?(key) || @test_settings.key?(key)
|
||||
|
|
|
@ -22,7 +22,7 @@ setup_es() {
|
|||
|
||||
start_es() {
|
||||
es_args=$@
|
||||
$current_dir/elasticsearch/bin/elasticsearch $es_args -p $current_dir/elasticsearch.pid > /tmp/elasticsearch.log 2>/dev/null &
|
||||
$current_dir/elasticsearch/bin/elasticsearch $es_args -p $current_dir/elasticsearch/elasticsearch.pid > /tmp/elasticsearch.log 2>/dev/null &
|
||||
count=120
|
||||
echo "Waiting for elasticsearch to respond..."
|
||||
while ! curl --silent localhost:9200 && [[ $count -ne 0 ]]; do
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
my_dir="$(dirname "$0")"
|
||||
set -ex
|
||||
current_dir="$(dirname "$0")"
|
||||
|
||||
stop_es() {
|
||||
pid=$(cat $current_dir/elasticsearch.pid)
|
||||
pid=$(cat $current_dir/elasticsearch/elasticsearch.pid)
|
||||
[ "x$pid" != "x" ] && [ "$pid" -gt 0 ]
|
||||
kill -SIGTERM $pid
|
||||
}
|
||||
|
|
|
@ -33,5 +33,5 @@ start_kafka
|
|||
|
||||
# Set up topics
|
||||
$current_dir/kafka/bin/kafka-topics.sh --create --partitions 1 --replication-factor 1 --topic logstash_topic_plain --zookeeper localhost:2181
|
||||
cat $current_dir/kafka_input.input | $current_dir/kafka/bin/kafka-console-producer.sh --topic logstash_topic_plain --broker-list localhost:9092
|
||||
cat $current_dir/../fixtures/how_sample.input | $current_dir/kafka/bin/kafka-console-producer.sh --topic logstash_topic_plain --broker-list localhost:9092
|
||||
echo "Kafka Setup complete"
|
||||
|
|
|
@ -8,7 +8,7 @@ require 'yaml'
|
|||
# A locally started Logstash service
|
||||
class LogstashService < Service
|
||||
|
||||
LS_VERSION_FILE = File.expand_path(File.join("../../../",versions.yml), __FILE__)
|
||||
LS_VERSION_FILE = File.expand_path(File.join("../../../../", "versions.yml"), __FILE__)
|
||||
LS_BIN = "bin/logstash"
|
||||
|
||||
STDIN_CONFIG = "input {stdin {}} output { }"
|
||||
|
|
|
@ -6,7 +6,7 @@ require "rspec/wait"
|
|||
require "yaml"
|
||||
require "fileutils"
|
||||
|
||||
describe "Beat Input", :integration => true do
|
||||
describe "Beat Input" do
|
||||
before(:all) do
|
||||
@fixture = Fixture.new(__FILE__)
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require_relative '../framework/fixture'
|
|||
require_relative '../framework/settings'
|
||||
require_relative '../services/logstash_service'
|
||||
|
||||
describe "a config which indexes data into Elasticsearch", :integration => true do
|
||||
describe "a config which indexes data into Elasticsearch" do
|
||||
|
||||
before(:all) {
|
||||
@fixture = Fixture.new(__FILE__)
|
||||
|
|
|
@ -3,7 +3,7 @@ require_relative '../framework/settings'
|
|||
require_relative '../services/logstash_service'
|
||||
require "rspec/wait"
|
||||
|
||||
describe "Kafka Input", :integration => true do
|
||||
describe "Kafka Input" do
|
||||
let(:timeout_seconds) { 5 }
|
||||
before(:all) {
|
||||
@fixture = Fixture.new(__FILE__)
|
||||
|
@ -17,10 +17,9 @@ describe "Kafka Input", :integration => true do
|
|||
logstash_service = @fixture.get_service("logstash")
|
||||
logstash_service.start_background(@fixture.config)
|
||||
|
||||
# TODO: File Output is busted so this test fails
|
||||
#wait(timeout_seconds).for { @fixture.output_exists? }.to be true
|
||||
#expect(@fixture.output_equals_expected?).to be true,
|
||||
# lambda { "Expected File output to match what was ingested into Kafka." }
|
||||
wait(timeout_seconds).for { @fixture.output_exists? }.to be true
|
||||
expect(@fixture.output_equals_expected?).to be true
|
||||
lambda { "Expected File output to match what was ingested into Kafka." }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require_relative '../framework/settings'
|
|||
require_relative '../services/logstash_service'
|
||||
require "logstash/devutils/rspec/spec_helper"
|
||||
|
||||
describe "Monitoring API", :integration => true do
|
||||
describe "Monitoring API" do
|
||||
before(:all) {
|
||||
@fixture = Fixture.new(__FILE__)
|
||||
}
|
||||
|
@ -11,15 +11,25 @@ describe "Monitoring API", :integration => true do
|
|||
after(:all) {
|
||||
@fixture.teardown
|
||||
}
|
||||
|
||||
let(:number_of_events) { 5 }
|
||||
let(:max_retry) { 120 }
|
||||
|
||||
it "can retrieve event stats" do
|
||||
logstash_service = @fixture.get_service("logstash")
|
||||
logstash_service.start_with_stdin
|
||||
5.times { logstash_service.write_to_stdin("Hello world") }
|
||||
# check metrics
|
||||
result = logstash_service.monitoring_api.event_stats
|
||||
try { expect(result["in"]).to eq(5) }
|
||||
expect(result["in"]).to eq(5)
|
||||
number_of_events.times { logstash_service.write_to_stdin("Hello world") }
|
||||
|
||||
begin
|
||||
sleep(1) while (result = logstash_service.monitoring_api.event_stats).nil?
|
||||
rescue
|
||||
retry
|
||||
end
|
||||
|
||||
Stud.try(max_retry.times, RSpec::Expectations::ExpectationNotMetError) do
|
||||
result = logstash_service.monitoring_api.event_stats
|
||||
expect(result["in"]).to eq(number_of_events)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
---
|
||||
ls_version: 5.0.0-alpha6
|
||||
snapshot: true
|
||||
# Use this to output more debug-level information
|
||||
verbose_mode: false
|
||||
# Typically we use the binaries in LS_HOME/build. If you want to QA a LS in different location,
|
||||
# use the absolute path below
|
||||
#ls_home_abs_path: /tmp/logstash-5.0.0-alpha6
|
Loading…
Add table
Add a link
Reference in a new issue