use jruby 9.1.9.0

Work done by @guyboertje and @ph

Since JRuby 1.7.25 is now EOL we are migrating Logstash to use JRuby 9k and JDK8 only,
Not much needed updating to make this work, its was mostly a drop in replacement from the previous version.

The major point was the change in the implementation of Time in JRuby, JRuby now use `java.time`
instead of joda time, this allow JRuby to have nanoseconds precision on time object.
This commit is contained in:
Pier-Hugues Pellerin 2017-02-15 15:12:50 +00:00
parent fae99f1f9f
commit 76286b4f0e
33 changed files with 123 additions and 145 deletions

2
.gitignore vendored
View file

@ -33,7 +33,7 @@ qa/.vm_ssh_config
qa/.vagrant
qa/acceptance/.vagrant
qa/Gemfile.lock
Gemfile.jruby-1.9.lock
Gemfile.jruby-2.3.lock
Gemfile
*.ipr
*.iws

View file

@ -7,21 +7,22 @@ cache:
- vendor/bundle
- ~/.gradle/
rvm:
- jruby-1.7.25
- jruby-9.1.9.0
jdk:
- oraclejdk8
env:
- INTEGRATION=false SPEC_OPTS="--order rand --format documentation"
- INTEGRATION=true SPEC_OPTS="--order rand --format documentation"
- INTEGRATION=false FEATURE_FLAG=persistent_queues SPEC_OPTS="--order rand --format documentation"
- INTEGRATION=true FEATURE_FLAG=persistent_queues SPEC_OPTS="--order rand --format documentation"
- INTEGRATION=false SPEC_OPTS="--order rand --format documentation" JRUBY_OPTS='-Xcompile.invokedynamic=false'
- INTEGRATION=true SPEC_OPTS="--order rand --format documentation" JRUBY_OPTS='-Xcompile.invokedynamic=false'
- INTEGRATION=false FEATURE_FLAG=persistent_queues SPEC_OPTS="--order rand --format documentation" JRUBY_OPTS='-Xcompile.invokedynamic=false'
- INTEGRATION=true FEATURE_FLAG=persistent_queues SPEC_OPTS="--order rand --format documentation" JRUBY_OPTS='-Xcompile.invokedynamic=false'
before_install:
- sudo apt-get remove -y docker-engine
- sudo apt-get install -y docker-engine
- sudo service docker stop
- sudo dockerd --disable-legacy-registry &>/dev/null &
- export JRUBY_OPTS=""
# Force bundler 1.12.5 because version 1.13 has issues, see https://github.com/fastlane/fastlane/issues/6065#issuecomment-246044617
- yes | gem uninstall -q -i /home/travis/.rvm/gems/jruby-1.7.25@global bundler
- yes | gem uninstall -q -i /home/travis/.rvm/gems/jruby-9.1.9.0@global bundler
- gem install bundler -v 1.12.5 --no-rdoc --no-ri --no-document --quiet
install:
- rake test:install-core

View file

@ -11,13 +11,13 @@ gem "file-dependencies", "0.1.6"
gem "ci_reporter_rspec", "1.0.0", :group => :development
gem "simplecov", :group => :development
gem "tins", "1.6", :group => :development
gem "rspec", "~> 3.1.0", :group => :development
gem "rspec", "~> 3.5", :group => :development
gem "logstash-devutils", :group => :development
gem "benchmark-ips", :group => :development
gem "octokit", "3.8.0", :group => :build
gem "stud", "~> 0.0.22", :group => :build
gem "fpm", "~> 1.3.3", :group => :build
gem "rubyzip", "~> 1.1.7", :group => :build
gem "rubyzip", "~> 1.2.1", :group => :build
gem "gems", "~> 0.8.3", :group => :build
gem "rack-test", :require => "rack/test", :group => :development
gem "flores", "~> 0.0.6", :group => :development

View file

@ -95,3 +95,4 @@ inconsistencies between ruby versions.
# This is good.
str[0, 1]

View file

@ -10,7 +10,9 @@ Signal.trap("INT") { exit 1 }
require_relative "../lib/bootstrap/environment"
::Gem.clear_paths
::Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
::Gem.paths = ENV
ENV["BUNDLE_GEMFILE"] = LogStash::Environment::GEMFILE_PATH

View file

@ -49,7 +49,8 @@ module LogStash
# make sure we use our own installed bundler
LogStash::Rubygems.patch!
::Gem.clear_paths
::Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = Environment.logstash_gem_home
ENV['GEM_HOME'] = ENV['GEM_PATH'] = Environment.logstash_gem_home
::Gem.paths = ENV
# set BUNDLE_GEMFILE ENV before requiring bundler to avoid bundler recurse and load unrelated Gemfile(s)
ENV["BUNDLE_GEMFILE"] = Environment::GEMFILE_PATH
@ -89,8 +90,8 @@ module LogStash
# require "logstash/patches/rubygems" # patch rubygems before clear_paths
LogStash::Rubygems.patch!
::Gem.clear_paths
::Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
::Gem.paths = ENV
# set BUNDLE_GEMFILE ENV before requiring bundler to avoid bundler recurse and load unrelated Gemfile(s).
# in the context of calling Bundler::CLI this is not really required since Bundler::CLI will look at
# Bundler.settings[:gemfile] unlike Bundler.setup. For the sake of consistency and defensive/future proofing, let's keep it here.
@ -106,7 +107,7 @@ module LogStash
)
end
# create Gemfile.jruby-1.9.lock from template iff a template exists it itself does not exist
lock_template = ::File.join(ENV["LOGSTASH_HOME"], "Gemfile.jruby-1.9.lock.release")
lock_template = ::File.join(ENV["LOGSTASH_HOME"], "Gemfile.jruby-2.3.lock.release")
if ::File.exists?(lock_template) && !::File.exists?(Environment::LOCKFILE)
FileUtils.copy(lock_template, Environment::LOCKFILE)
end

View file

@ -18,7 +18,7 @@ module LogStash
GEMFILE_PATH = ::File.join(LOGSTASH_HOME, "Gemfile")
LOCAL_GEM_PATH = ::File.join(LOGSTASH_HOME, 'vendor', 'local_gems')
CACHE_PATH = ::File.join(LOGSTASH_HOME, "vendor", "cache")
LOCKFILE = Pathname.new(::File.join(LOGSTASH_HOME, "Gemfile.jruby-1.9.lock"))
LOCKFILE = Pathname.new(::File.join(LOGSTASH_HOME, "Gemfile.jruby-2.3.lock"))
GEMFILE = Pathname.new(::File.join(LOGSTASH_HOME, "Gemfile"))
# @return [String] the ruby version string bundler uses to craft its gem path

View file

@ -7,6 +7,7 @@ require "bundler/dsl"
require "bundler/injector"
require "bundler/shared_helpers"
require "pluginmanager/gemfile"
require "rubygems/specification"
require "pathname"
@ -23,6 +24,12 @@ end
module Bundler
class LogstashInjector < ::Bundler::Injector
def self.inject!(new_deps, options = { :gemfile => LogStash::Environment::GEMFILE, :lockfile => LogStash::Environment::LOCKFILE })
# Make sure all the available Specifications
# are loaded before trying to inject any new gems
# If we dont do this, we will have a stale index that wont have the gems
# that we just have installed.
::Gem::Specification.reset
gemfile = options.delete(:gemfile)
lockfile = options.delete(:lockfile)

View file

@ -1,63 +0,0 @@
# encoding: utf-8
require "pluginmanager/ui"
require "stud/temporary"
module LogStash module PluginManager
class CustomGemIndexer
GEMS_DIR = "gems"
class << self
# Copy the file to a specific format that `Gem::Indexer` can understand
# See `#update_in_memory_index`
def copy_to_local_source(temporary_directory)
local_source = Stud::Temporary.pathname
local_source_gems = ::File.join(local_source, GEMS_DIR)
FileUtils.mkdir_p(local_source_gems)
PluginManager.ui.debug("Creating the index structure format from #{temporary_directory} to #{local_source}")
Dir.glob(::File.join(temporary_directory, "**", "*.gem")).each do |file|
destination = ::File.join(local_source_gems, ::File.basename(file))
FileUtils.cp(file, destination)
end
local_source
end
# *WARNING*: Bundler need to not be activated at this point because it won't find anything that
# is not defined in the gemfile/lock combo
#
# This takes a folder with a special structure, will generate an index
# similar to what rubygems do and make them available in the local program,
# we use this **side effect** to validate theses gems with the current gemfile/lock.
# Bundler will assume they are system gems and will use them when doing resolution checks.
#
#.
# ├── gems
# │   ├── addressable-2.4.0.gem
# │   ├── cabin-0.9.0.gem
# │   ├── ffi-1.9.14-java.gem
# │   ├── gemoji-1.5.0.gem
# │   ├── launchy-2.4.3-java.gem
# │   ├── logstash-output-elasticsearch-5.2.0-java.gem
# │   ├── logstash-output-secret-0.1.0.gem
# │   ├── manticore-0.6.0-java.gem
# │   ├── spoon-0.0.6.gem
# │   └── stud-0.0.22.gem
#
# Right now this work fine, but I think we could also use Bundler's SourceList classes to handle the same thing
def update_in_memory_index!(local_source)
PluginManager.ui.debug("Generating indexes in #{local_source}")
indexer = ::Gem::Indexer.new(local_source, { :build_modern => true})
indexer.ui = ::Gem::SilentUI.new unless ENV["DEBUG"]
indexer.generate_index
end
def index(path)
local_source = copy_to_local_source(path)
update_in_memory_index!(local_source)
local_source
end
end
end
end end

View file

@ -10,7 +10,7 @@ module LogStash module PluginManager
# - Generate the specifications
# - Copy the data in the right folders
class GemInstaller
GEM_HOME = Pathname.new(::File.join(LogStash::Environment::BUNDLE_DIR, "jruby", "1.9"))
GEM_HOME = Pathname.new(::File.join(LogStash::Environment::BUNDLE_DIR, "jruby", "2.3.0"))
SPECIFICATIONS_DIR = "specifications"
GEMS_DIR = "gems"
CACHE_DIR = "cache"
@ -28,8 +28,8 @@ module LogStash module PluginManager
create_destination_folders
extract_files
write_specification
display_post_install_message
copy_gem_file_to_cache
post_install_message
end
def self.install(gem_file, display_post_install_message = false, gem_home = GEM_HOME)
@ -69,8 +69,8 @@ module LogStash module PluginManager
end
end
def display_post_install_message
PluginManager.ui.info(spec.post_install_message) if display_post_install_message?
def post_install_message
spec.post_install_message if display_post_install_message?
end
def display_post_install_message?

View file

@ -2,7 +2,6 @@
require "pluginmanager/ui"
require "pluginmanager/bundler/logstash_injector"
require "pluginmanager/gem_installer"
require "pluginmanager/custom_gem_indexer"
require "pluginmanager/errors"
require "pluginmanager/pack_installer/pack"
require "bootstrap/util/compress"
@ -29,24 +28,27 @@ module LogStash module PluginManager module PackInstaller
pack = LogStash::PluginManager::PackInstaller::Pack.new(uncompressed_path)
raise PluginManager::InvalidPackError, "The pack must contains at least one plugin" unless pack.valid?
local_source = LogStash::PluginManager::CustomGemIndexer.index(uncompressed_path)
# Install the gems to make them available locally when bundler does his local resolution
post_install_messages = []
pack.gems.each do |packed_gem|
PluginManager.ui.debug("Installing, #{packed_gem.name}, version: #{packed_gem.version} file: #{packed_gem.file}")
post_install_messages << LogStash::PluginManager::GemInstaller::install(packed_gem.file, packed_gem.plugin?)
end
# Try to add the gems to the current gemfile and lock file, if successful
# both of them will be updated. This injector is similar to Bundler's own injector class
# minus the support for additionals source and doing local resolution only.
::Bundler::LogstashInjector.inject!(pack)
# When successful its safe to install the gem and their specifications in the bundle directory
pack.gems.each do |packed_gem|
PluginManager.ui.debug("Installing, #{packed_gem.name}, version: #{packed_gem.version} file: #{packed_gem.file}")
LogStash::PluginManager::GemInstaller::install(packed_gem.file, packed_gem.plugin?)
post_install_messages.compact.each do |message|
PluginManager.ui.info(message)
end
PluginManager.ui.info("Install successful")
rescue ::Bundler::BundlerError => e
raise PluginManager::InstallError.new(e), "An error occurred went installing plugins"
ensure
FileUtils.rm_rf(uncompressed_path) if uncompressed_path && Dir.exist?(uncompressed_path)
FileUtils.rm_rf(local_source) if local_source && Dir.exist?(local_source)
end
private

View file

@ -4,8 +4,8 @@ require "logstash/errors"
module LogStash module BootstrapCheck
class BadRuby
def self.check(settings)
if RUBY_VERSION < "1.9.2"
raise LogStash::BootstrapCheckError, "Ruby 1.9.2 or later is required. (You are running: " + RUBY_VERSION + ")"
if RUBY_VERSION < "2.0"
raise LogStash::BootstrapCheckError, "Ruby 2.0 or later is required. (You are running: " + RUBY_VERSION + ")"
end
end
end

View file

@ -31,7 +31,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency "sinatra", '~> 1.4', '>= 1.4.6'
gem.add_runtime_dependency 'puma', '~> 2.16'
gem.add_runtime_dependency "jruby-openssl", "0.9.16" # >= 0.9.13 Required to support TLSv1.2
gem.add_runtime_dependency "jruby-openssl", "0.9.20" # >= 0.9.13 Required to support TLSv1.2
gem.add_runtime_dependency "chronic_duration", "0.10.6"
# TODO(sissel): Treetop 1.5.x doesn't seem to work well, but I haven't
@ -43,7 +43,7 @@ Gem::Specification.new do |gem|
# filetools and rakelib
gem.add_runtime_dependency "minitar", "~> 0.5.4"
gem.add_runtime_dependency "rubyzip", "~> 1.1.7"
gem.add_runtime_dependency "rubyzip", "~> 1.2.1"
gem.add_runtime_dependency "thread_safe", "~> 0.3.5" #(Apache 2.0 license)
gem.add_runtime_dependency "jrjackson", "~> 0.4.2" #(Apache 2.0 license)

View file

@ -56,7 +56,8 @@ describe LogStash::Compiler do
describe "applying protocol and id metadata" do
it "should apply the correct source metadata to all components" do
pipeline.plugin_vertices.each do |pv|
# TODO: seems to be a jruby regression we cannot currently call each on a stream
pipeline.get_plugin_vertices.each do |pv|
name_idx = pv.plugin_definition.name.split("_").last
source_protocol_idx = pv.source_with_metadata.protocol.split("_").last
source_id_idx = pv.source_with_metadata.id.split("_").last

View file

@ -24,7 +24,7 @@ describe LogStash::Filters::Base do
end
it "should provide class public API" do
[:register, :filter, :multi_filter, :execute, :threadsafe?, :filter_matched, :filter?, :close].each do |method|
[:register, :filter, :multi_filter, :execute, :threadsafe?, :close].each do |method|
expect(subject).to respond_to(method)
end
end

View file

@ -12,7 +12,7 @@ describe LogStash::Timestamp do
end
it "should coerce iso8601 string" do
t = Time.now
t = DateTime.now.to_time
ts = LogStash::Timestamp.new(t)
expect(LogStash::Timestamp.coerce(ts.to_iso8601).to_i).to eq(t.to_i)
end
@ -57,27 +57,27 @@ describe LogStash::Timestamp do
end
it "should allow unary operation +" do
current = Time.now
current = DateTime.now.to_time
t = LogStash::Timestamp.new(current) + 10
expect(t).to eq(current + 10)
end
describe "subtraction" do
it "should work on a timestamp object" do
t = Time.now
t = DateTime.now.to_time
current = LogStash::Timestamp.new(t)
future = LogStash::Timestamp.new(t + 10)
expect(future - current).to eq(10)
end
it "should work on with time object" do
current = Time.now
current = DateTime.now.to_time
t = LogStash::Timestamp.new(current + 10)
expect(t - current).to eq(10)
end
it "should work with numeric value" do
current = Time.now
current = DateTime.now.to_time
t = LogStash::Timestamp.new(current + 10)
expect(t - 10).to eq(current)
end
@ -100,11 +100,11 @@ describe LogStash::Timestamp do
subject { LogStash::Timestamp.new(now) }
it "should support to_i" do
expect(subject.to_i).to eq(now.to_i)
expect(subject.to_i).to be_kind_of(Integer)
end
it "should support to_f" do
expect(subject.to_f).to eq(now.to_f)
expect(subject.to_f).to be_kind_of(Float)
end
end

View file

@ -13,10 +13,6 @@ require "json"
require_relative "../support/helpers"
require_relative "../support/matchers"
class NullRunner
def run(args); end
end
describe LogStash::Runner do
subject { LogStash::Runner }
@ -174,12 +170,14 @@ describe LogStash::Runner do
let(:queue_override_path) { "/tmp/queue-override_path" }
it "should set data paths" do
LogStash::SETTINGS.set("path.queue", queue_override_path)
expect(LogStash::Agent).to receive(:new) do |settings|
expect(settings.get("path.data")).to eq(test_data_path)
expect(settings.get("path.queue")).to eq(queue_override_path)
end
LogStash::SETTINGS.set("path.queue", queue_override_path)
args = ["--path.data", test_data_path, "-e", pipeline_string]
subject.run("bin/logstash", args)

View file

@ -80,7 +80,7 @@ describe LogStash::Setting do
end
context "when the argument's class does not match @klass" do
it "should throw an exception" do
expect { subject.set("not a number") }.to raise_error
expect { subject.set("not a number") }.to raise_error ArgumentError
end
end
context "when strict=false" do
@ -131,7 +131,7 @@ describe LogStash::Setting do
context "when validation fails" do
let(:new_value) { "very very very very very big text" }
it "should raise an exception" do
expect { subject.set(new_value) }.to raise_error
expect { subject.set(new_value) }.to raise_error ArgumentError
end
it "should not change the value" do
subject.set(new_value) rescue nil

View file

@ -12,7 +12,7 @@ describe LogStash::Timestamp do
t = LogStash::Timestamp.now
expect(t.time.to_i).to be_within(1).of Time.now.to_i
now = Time.now.utc
now = DateTime.now.to_time.utc
t = LogStash::Timestamp.new(now)
expect(t.time).to eq(now)

View file

@ -130,6 +130,12 @@ public class JrubyTimestampExtLibrary implements Library {
return ruby_to_iso8601(context);
}
@JRubyMethod(name = "inspect")
public IRubyObject ruby_inspect(ThreadContext context)
{
return ruby_to_iso8601(context);
}
@JRubyMethod(name = "to_iso8601")
public IRubyObject ruby_to_iso8601(ThreadContext context)
{
@ -206,15 +212,8 @@ public class JrubyTimestampExtLibrary implements Library {
{
RubyTime t;
if (args.length == 1) {
IRubyObject epoch = args[0];
if (epoch instanceof RubyBigDecimal) {
// bug in JRuby prevents correctly parsing a BigDecimal fractional part, see https://github.com/elastic/logstash/issues/4565
double usec = ((RubyBigDecimal)epoch).frac().convertToFloat().getDoubleValue() * 1000000;
t = (RubyTime)RubyTime.at(context, context.runtime.getTime(), ((RubyBigDecimal)epoch).to_int(), new RubyFloat(context.runtime, usec));
} else {
t = (RubyTime)RubyTime.at(context, context.runtime.getTime(), epoch);
}
// JRuby 9K has fixed the problem iwth BigDecimal precision see https://github.com/elastic/logstash/issues/4565
t = (RubyTime)RubyTime.at(context, context.runtime.getTime(), args[0]);
} else {
t = (RubyTime)RubyTime.at(context, context.runtime.getTime(), args[0], args[1]);
}

View file

@ -5,6 +5,15 @@ require_relative '../../rspec/matchers'
require_relative 'config_helper'
require_relative "../../platform_config"
# This is a non obvious hack,
# EllipticalCurve are not completely implemented in JRuby 9k and the new version of SSH from the standard library
# use them.
#
# Details: https://github.com/jruby/jruby-openssl/issues/105
Net::SSH::Transport::Algorithms::ALGORITHMS.values.each { |algs| algs.reject! { |a| a =~ /^ecd(sa|h)-sha2/ } }
Net::SSH::KnownHosts::SUPPORTED_TYPE.reject! { |t| t =~ /^ecd(sa|h)-sha2/ }
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
$LOAD_PATH.unshift File.join(ROOT, 'logstash-core/lib')

View file

@ -201,7 +201,7 @@ class LogstashService < Service
end
def lock_file
File.join(@logstash_home, "Gemfile.jruby-1.9.lock")
File.join(@logstash_home, "Gemfile.jruby-2.3.lock")
end
class PluginCli

View file

@ -151,10 +151,10 @@ describe "Test Logstash instance" do
}
start_ls.call()
# we use a try since logstash may have started but the webserver may not yet
first_id = try(num_retries) { get_id }
first_id = Stud.try(num_retries.times, Errno::ECONNREFUSED) { get_id }
@ls1.teardown
start_ls.call()
second_id = try(num_retries) { get_id }
second_id = Stud.try(num_retries.times, Errno::ECONNREFUSED) { get_id }
expect(first_id).to eq(second_id)
end
end

View file

@ -54,7 +54,7 @@ describe "CLI > logstash-plugin prepare-offline-pack", :offline => true do
unpacked = unpack(temporary_zip_file)
filters = @logstash_plugin.list(plugins_to_pack.first).stderr_and_stdout.split("\n")
filters = @logstash_plugin.list(plugins_to_pack.first).stderr_and_stdout.split("\n").delete_if { |f| f =~ /cext/ }
expect(unpacked.plugins.collect(&:name)).to include(*filters)
expect(unpacked.plugins.size).to eq(filters.size)

View file

@ -40,7 +40,7 @@ namespace "artifact" do
# See more in https://github.com/elastic/logstash/issues/4818
"vendor/??*/**/.mvn/**/*",
"Gemfile",
"Gemfile.jruby-1.9.lock",
"Gemfile.jruby-2.3.lock",
]
end
@ -275,6 +275,10 @@ namespace "artifact" do
require "fpm/errors" # TODO(sissel): fix this in fpm
require "fpm/package/dir"
require "fpm/package/gem" # TODO(sissel): fix this in fpm; rpm needs it.
require "childprocess/jruby/pump"
# TODO(ph): Cabin is closing the fd when it reach EOF, childprocess will attempt to write to it and hit an IOError.
# This will make a the thread dies, in 1.7.25 we had a Thread Death
require_relative "childprocess_patch"
dir = FPM::Package::Dir.new

View file

@ -0,0 +1,20 @@
# This is a patch for childprocess and this is due to ruby-cabin/fpm interaction.
# When we use the logger.pipe construct and the IO reach EOF we close the IO.
# The problem Childprocess will try to flush to it and hit an IOError making the software crash in JRuby 9k.
#
# In JRuby 1.7.25 we hit a thread death.
#
module ChildProcess
module JRuby
class Pump
alias_method :old_pump, :pump
def ignore_close_io
old_pump
rescue IOError
end
alias_method :pump, :ignore_close_io
end
end
end

View file

@ -38,7 +38,7 @@ namespace "test" do
plugins_to_exclude = ENV.fetch("EXCLUDE_PLUGIN", "").split(",")
# grab all spec files using the live plugins gem specs. this allows correctly also running the specs
# of a local plugin dir added using the Gemfile :path option. before this, any local plugin spec would
# not be run because they were not under the vendor/bundle/jruby/1.9/gems path
# not be run because they were not under the vendor/bundle/jruby/2.0/gems path
test_files = LogStash::PluginManager.find_plugins_gem_specs.map do |spec|
if plugins_to_exclude.size > 0
if !plugins_to_exclude.include?(Pathname.new(spec.gem_dir).basename.to_s)

View file

@ -1,6 +1,6 @@
namespace "vendor" do
VERSIONS = {
"jruby" => { "version" => "1.7.25", "sha1" => "cd15aef419f97cff274491e53fcfb8b88ec36785" },
"jruby" => { "version" => "9.1.9.0", "sha1" => "b062fe6e411e4dab52ac7a25078b63e831471f9b" },
}
def vendor(*args)

View file

@ -33,10 +33,14 @@ class JSONIOThingy < IO
end
end
# Refactor the suite to https://github.com/elastic/logstash/issues/7148
RSpec::Expectations.configuration.on_potential_false_positives = :nothing
RSpec.configure do |c|
Flores::RSpec.configure(c)
c.include LogStashHelper
c.extend LogStashHelper
c.before(:each) do
# TODO: commented out on post-merged in master - the logger has moved to log4j
#

View file

@ -1,6 +1,7 @@
# encoding: utf-8
require_relative '../spec_helper'
require 'rakelib/default_plugins'
require 'spec_helper'
require_relative '../../rakelib/default_plugins'
describe "Project licenses" do

View file

@ -36,15 +36,13 @@ describe LogStash::PluginManager::GemInstaller do
context "when we want the message" do
it "display the message" do
expect(LogStash::PluginManager.ui).to receive(:info).with(message)
subject.install(simple_gem, true, temporary_gem_home)
expect(subject.install(simple_gem, true, temporary_gem_home)).to eq(message)
end
end
context "when we dont want the message" do
it "doesn't display the message" do
expect(LogStash::PluginManager.ui).not_to receive(:info).with(message)
subject.install(simple_gem, false, temporary_gem_home)
expect(subject.install(simple_gem, false, temporary_gem_home)).to be_nil
end
end
end

View file

@ -54,13 +54,6 @@ describe LogStash::PluginManager::PackInstaller::Local do
expect(::LogStash::PluginManager::GemInstaller).to receive(:install).with(/logstash-input-packtest/, anything)
expect(::LogStash::PluginManager::GemInstaller).to receive(:install).with(/logstash-input-packtestdep/, anything)
# Since the Gem::Indexer have side effect and we have more things loaded
# I have to disable it in the tests
mock_indexer = double("Gem::Indexer")
allow(mock_indexer).to receive(:ui=).with(anything)
expect(mock_indexer).to receive(:generate_index)
expect(::Gem::Indexer).to receive(:new).with(be_kind_of(String), hash_including(:build_modern => true)).and_return(mock_indexer)
expect { subject.execute }.not_to raise_error
end
end

View file

@ -56,7 +56,7 @@ describe LogStash::Retryable do
expect do
subject.retryable(:on_retry => callback){i += 1; raise E}
end.to raise_error
end.to raise_error E
expect(i).to eq(2)
@ -86,7 +86,7 @@ describe LogStash::Retryable do
expect do
subject.retryable(:tries => n, :on_retry => callback){i += 1; raise E}
end.to raise_error
end.to raise_error E
expect(i).to eq(n + 1)