This repository has been archived by the owner on May 2, 2021. It is now read-only.
forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
529e6c7
commit e98f463
Showing
5 changed files
with
19 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "rubygems" | ||
require "optparse" | ||
$:.unshift "#{File.dirname(__FILE__)}/../lib" | ||
$:.unshift "#{File.dirname(__FILE__)}/../test" | ||
|
||
#require "logstash/test_syntax" | ||
#require "logstash/filters/test_date" | ||
#require "logstash/filters/test_multiline" | ||
|
||
def check_lib(lib, provider, optional=true, message=nil) | ||
begin | ||
require lib | ||
puts "+ Found #{optional ? "optional" : "required"} library '#{lib}'" | ||
return { :optional => optional, :found => true } | ||
rescue LoadError => e | ||
puts "- Missing #{optional ? "optional" : "required"} library '#{lib}' - try 'gem install #{provider}'#{optional ? " if you want this library" : ""}. #{message}" | ||
return { :optional => optional, :found => false } | ||
end | ||
end | ||
|
||
def report_ruby_version | ||
puts "Running #{RUBY_VERSION}p#{RUBY_PATCHLEVEL} on #{RUBY_PLATFORM}" | ||
end | ||
|
||
def check_libraries | ||
results = [] | ||
results << check_lib("em-http-request", "em-http-request", true, | ||
"needed for ElasticSearch input, output, and logstash-web support.") | ||
results << check_lib("em-mongo", "em-mongo", true, | ||
"needed for the mongodb output.") | ||
results << check_lib("grok", "jls-grok", true, | ||
"needed for the grok filter.") | ||
results << check_lib("em-websocket", "em-websocket", true, | ||
"needed for websocket output") | ||
results << check_lib("rack", "rack", true, | ||
"needed for logstash-web") | ||
results << check_lib("thin", "thin", true, | ||
"needed for logstash-web") | ||
results << check_lib("amqp", "amqp", true, | ||
"needed for AMQP input and output") | ||
results << check_lib("sinatra/async", "async_sinatra", true, | ||
"needed for logstash-web") | ||
results << check_lib("uuidtools", "uuidtools", true, | ||
"needed for AMQP input and output") | ||
results << check_lib("ap", "awesome_print", true, | ||
"improve logstash debug logging output") | ||
results << check_lib("eventmachine", "eventmachine", false, | ||
"required for logstash to function") | ||
results << check_lib("json", "json", false, | ||
"required for logstash to function") | ||
|
||
missing_required = results.count { |r| !r[:optional] and !r[:found] } | ||
if missing_required == 0 | ||
puts "All required libraries found :)" | ||
else | ||
suffix = (missing_required > 1) ? "ies" : "y" | ||
puts "FATAL: Missing #{missing_required} required librar#{suffix}" | ||
return false | ||
end | ||
|
||
return true | ||
end | ||
|
||
def run_tests | ||
require "#{File.dirname(__FILE__)}/../test/run" | ||
return Test::Unit::AutoRunner.run | ||
end | ||
|
||
def main(args) | ||
report_ruby_version | ||
# TODO(sissel): Add a way to call out specific things to test, like | ||
# logstash-web, elasticsearch, mongodb, syslog, etc. | ||
if !check_libraries | ||
puts "Library check failed." | ||
return 1 | ||
end | ||
|
||
if !run_tests | ||
puts "Test suite failed." | ||
return 1 | ||
end | ||
|
||
return 0 | ||
end | ||
|
||
exit(main(ARGV)) | ||
|
||
require "logstash/runner" | ||
|
||
ARGV.unshift("test") | ||
LogStash::Runner.new.main(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,7 @@ def run(args) | |
public | ||
def wait | ||
@thread.join | ||
return 0 | ||
end # def wait | ||
end # class LogStash::Web::Runner | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters