add a check for the exit code, so if the exit code is not zero we make the rake task to fail otherwise it pass always causing false positive

move to use exit insted of fail as it aborts the test execution

add a comment to clarify why we set the exit code in the rake task

Fixes #2920
This commit is contained in:
Pere Urbon-Bayes 2015-03-30 18:29:05 +02:00 committed by Jordan Sissel
parent dbe4154aa6
commit fb88eef749

View file

@ -1,3 +1,10 @@
##
# In Logstash we use rspec throw the runner interface so we need to
# call explicity to exit in order to set the proper exit code, otherwise
# most common CI systems can not know whats up with this tests.
# In general this is not a problem, because the most common rspec usage
# is throw the rake task, where rspec sets this himself internally.
##
namespace "test" do
def run_rspec(*args)
require "logstash/environment"
@ -8,15 +15,15 @@ namespace "test" do
end
task "core" do
run_rspec(Rake::FileList["spec/**/*_spec.rb"])
exit run_rspec(Rake::FileList["spec/**/*_spec.rb"])
end
task "core-fail-fast" do
run_rspec("--fail-fast", Rake::FileList["spec/**/*_spec.rb"])
exit run_rspec("--fail-fast", Rake::FileList["spec/**/*_spec.rb"])
end
task "plugins" do
run_rspec("--order", "rand", Rake::FileList[File.join(ENV["GEM_HOME"], "gems/logstash-*/spec/{input,filter,codec,output}s/*_spec.rb")])
exit run_rspec("--order", "rand", Rake::FileList[File.join(ENV["GEM_HOME"], "gems/logstash-*/spec/{input,filter,codec,output}s/*_spec.rb")])
end
task "install-core" => ["bootstrap", "plugin:install-core", "plugin:install-development-dependencies"]