diff --git a/.rubocop.yml b/.rubocop.yml index 8630d0425..21e75173b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -30,7 +30,33 @@ Lint/BigDecimalNew: Enabled: true #################### Layout ########################### -##### Enabled Cops ##### +##### Enabled/Disabled Cops ##### +Layout/EmptyLineAfterGuardClause: + Enabled: false +Layout/EmptyLineAfterMagicComment: + Enabled: true +Layout/EmptyLineAfterMultilineCondition: + Enabled: false +Layout/EmptyLineBetweenDefs: + EnabLEd: true +Layout/EmptyLines: + Enabled: true +Layout/EmptyLinesAroundAccessModifier: + Enabled: false +Layout/EmptyLinesAroundArguments: + Enabled: true +Layout/EmptyLinesAroundAttributeAccessor: + Enabled: true +Layout/EmptyLinesAroundBeginBody: + Enabled: true +Layout/EmptyLinesAroundBlockBody: + Enabled: true +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Enabled: true +Layout/EmptyLinesAroundMethodBody: + Enabled: true +Layout/EmptyLinesAroundModuleBody: + Enabled: true Layout/TrailingWhitespace: Enabled: true Layout/TrailingEmptyLines: @@ -77,34 +103,8 @@ Layout/ElseAlignment: Enabled: false Layout/EmptyComment: Enabled: false -Layout/EmptyLineAfterGuardClause: - Enabled: false -Layout/EmptyLineAfterMagicComment: - Enabled: false -Layout/EmptyLineAfterMultilineCondition: - Enabled: false -Layout/EmptyLineBetweenDefs: - Enabled: false -Layout/EmptyLines: - Enabled: false -Layout/EmptyLinesAroundAccessModifier: - Enabled: false -Layout/EmptyLinesAroundArguments: - Enabled: false -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: false -Layout/EmptyLinesAroundBeginBody: - Enabled: false -Layout/EmptyLinesAroundBlockBody: - Enabled: false Layout/EmptyLinesAroundClassBody: Enabled: false -Layout/EmptyLinesAroundExceptionHandlingKeywords: - Enabled: false -Layout/EmptyLinesAroundMethodBody: - Enabled: false -Layout/EmptyLinesAroundModuleBody: - Enabled: false Layout/EndAlignment: Enabled: false Layout/EndOfLine: diff --git a/ci/test_supported_plugins.rb b/ci/test_supported_plugins.rb index 4d9fb7c71..f9b615de1 100644 --- a/ci/test_supported_plugins.rb +++ b/ci/test_supported_plugins.rb @@ -1,7 +1,7 @@ # encoding: utf-8 -# Test the -# - build (rspec), +# Test the +# - build (rspec), # - packaging (gem build) # - and deploy (bin/logstash-plugin install) # of a plugins inside the current Logstash, using its JRuby @@ -104,7 +104,6 @@ class Plugin end end - # reason could be a symbol, describing the phase that broke: # :unit_test, :gem_build, :gem_install FailureDetail = Struct.new(:plugin_name, :reason) @@ -267,5 +266,3 @@ if failed_plugins else puts "NO ERROR ON PLUGINS!" end - - diff --git a/lib/bootstrap/bundler.rb b/lib/bootstrap/bundler.rb index 156e12830..0e8d13065 100644 --- a/lib/bootstrap/bundler.rb +++ b/lib/bootstrap/bundler.rb @@ -143,7 +143,6 @@ module LogStash "BUNDLE_GEMFILE" => LogStash::Environment::GEMFILE_PATH, "BUNDLE_SILENCE_ROOT_WARNING" => "true", "BUNDLE_WITHOUT" => options[:without].join(":")}) do - if !debug? # Will deal with transient network errors execute_bundler_with_retry(options) @@ -311,6 +310,5 @@ module LogStash ensure $stdout = old_stdout end - end end diff --git a/lib/bootstrap/environment.rb b/lib/bootstrap/environment.rb index 1ae44f7f5..d7f8c90c5 100644 --- a/lib/bootstrap/environment.rb +++ b/lib/bootstrap/environment.rb @@ -72,7 +72,6 @@ module LogStash def pattern_path(path) return ::File.join(LOGSTASH_HOME, "patterns", path) end - end end diff --git a/lib/bootstrap/rubygems.rb b/lib/bootstrap/rubygems.rb index 433e9fc46..34a05ff7d 100644 --- a/lib/bootstrap/rubygems.rb +++ b/lib/bootstrap/rubygems.rb @@ -29,6 +29,7 @@ module LogStash require_relative "patches/gems" Gems.versions(plugin) end + # Take a gem package and extract it to a specific target # @param [String] Gem file, this must be a path # @param [String, String] Return a Gem::Package and the installed path @@ -51,6 +52,5 @@ module LogStash return [package, target_path] end - end end diff --git a/lib/bootstrap/util/compress.rb b/lib/bootstrap/util/compress.rb index d7ad13e07..7bac73812 100644 --- a/lib/bootstrap/util/compress.rb +++ b/lib/bootstrap/util/compress.rb @@ -22,12 +22,10 @@ require "zlib" require "stud/temporary" module LogStash - class CompressError < StandardError; end module Util module Zip - extend self # Extract a zip file into a destination directory. @@ -61,7 +59,6 @@ module LogStash end module Tar - extend self # Extract a tar.gz file into a destination directory. diff --git a/lib/pluginmanager/bundler/logstash_injector.rb b/lib/pluginmanager/bundler/logstash_injector.rb index d9d5a7ad8..2b0597074 100644 --- a/lib/pluginmanager/bundler/logstash_injector.rb +++ b/lib/pluginmanager/bundler/logstash_injector.rb @@ -26,7 +26,6 @@ require "pluginmanager/gemfile" require "rubygems/specification" require "pathname" - # This class cannot be in the logstash namespace, because of the way the DSL # class interact with the other libraries module Bundler diff --git a/lib/pluginmanager/bundler/logstash_uninstall.rb b/lib/pluginmanager/bundler/logstash_uninstall.rb index 2ab4168e4..2dbee48cc 100644 --- a/lib/pluginmanager/bundler/logstash_uninstall.rb +++ b/lib/pluginmanager/bundler/logstash_uninstall.rb @@ -47,7 +47,6 @@ module Bundler def uninstall!(gem_name) unfreeze_gemfile do - dependencies_from = dependants_gems(gem_name) if dependencies_from.size > 0 diff --git a/lib/pluginmanager/errors.rb b/lib/pluginmanager/errors.rb index 7a10957ff..f506cfb68 100644 --- a/lib/pluginmanager/errors.rb +++ b/lib/pluginmanager/errors.rb @@ -21,6 +21,7 @@ module LogStash module PluginManager class UnpackablePluginError < PluginManagerError; end class FileNotFoundError < PluginManagerError; end class InvalidPackError < PluginManagerError; end + class InstallError < PluginManagerError attr_reader :original_exception diff --git a/lib/pluginmanager/proxy_support.rb b/lib/pluginmanager/proxy_support.rb index 4102d58ce..fa2ad11f9 100644 --- a/lib/pluginmanager/proxy_support.rb +++ b/lib/pluginmanager/proxy_support.rb @@ -23,7 +23,6 @@ require "fileutils" require "stud/temporary" require "jar-dependencies" - # This is a bit of a hack, to make sure that all of our call pass to a specific proxies. # We do this before any jar-dependences check is done, meaning we have to silence him. module Jars diff --git a/lib/pluginmanager/util.rb b/lib/pluginmanager/util.rb index 638ff734d..ccf0aa736 100644 --- a/lib/pluginmanager/util.rb +++ b/lib/pluginmanager/util.rb @@ -19,7 +19,6 @@ require "rubygems/package" require "yaml" module LogStash::PluginManager - def self.load_aliases_definitions(path = File.expand_path('plugin_aliases.yml', __dir__)) content = IO.read(path) @@ -58,7 +57,6 @@ module LogStash::PluginManager # @option options [Array] :rubygems_source Gem sources to lookup for the verification # @return [Boolean] true if valid logstash plugin gem name & version or a .gem file def self.logstash_plugin?(plugin, version = nil, options={}) - if plugin_file?(plugin) begin return logstash_plugin_gem_spec?(plugin_file_spec(plugin)) @@ -174,7 +172,6 @@ module LogStash::PluginManager # @param plugin_list [Array] array of [plugin name, version] tuples # @return [Array] array of [plugin name, version, ...] tuples when duplicate names have been merged and non duplicate version requirements added def self.merge_duplicates(plugin_list) - # quick & dirty naive dedup for now # TODO: properly merge versions requirements plugin_list.uniq(&:first) diff --git a/lib/pluginmanager/x_pack_interceptor.rb b/lib/pluginmanager/x_pack_interceptor.rb index f850cd3ae..a25b288ab 100644 --- a/lib/pluginmanager/x_pack_interceptor.rb +++ b/lib/pluginmanager/x_pack_interceptor.rb @@ -16,11 +16,9 @@ # under the License. module LogStash; module PluginManager - # Centralised messaging about installing and removing x-pack, which is no longer a plugin, but # part of the distribution. module XPackInterceptor - module Install extend self diff --git a/logstash-core-plugin-api/logstash-core-plugin-api.gemspec b/logstash-core-plugin-api/logstash-core-plugin-api.gemspec index 59ce44714..db1e79c79 100644 --- a/logstash-core-plugin-api/logstash-core-plugin-api.gemspec +++ b/logstash-core-plugin-api/logstash-core-plugin-api.gemspec @@ -1,4 +1,5 @@ # -*- encoding: utf-8 -*- + lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) diff --git a/logstash-core/lib/logstash/agent.rb b/logstash-core/lib/logstash/agent.rb index 3971d4173..6cdb2b0a6 100644 --- a/logstash-core/lib/logstash/agent.rb +++ b/logstash-core/lib/logstash/agent.rb @@ -488,7 +488,6 @@ class LogStash::Agent resolve_actions_and_converge_state([]) # We stop all the pipeline, so we converge to a empty state end - def setting(key) @settings.get(key) end diff --git a/logstash-core/lib/logstash/api/command_factory.rb b/logstash-core/lib/logstash/api/command_factory.rb index 592833ad5..6ed9e5701 100644 --- a/logstash-core/lib/logstash/api/command_factory.rb +++ b/logstash-core/lib/logstash/api/command_factory.rb @@ -22,7 +22,6 @@ require "logstash/api/commands/stats" require "logstash/api/commands/node" require "logstash/api/commands/default_metadata" - module LogStash module Api class CommandFactory diff --git a/logstash-core/lib/logstash/codecs/base.rb b/logstash-core/lib/logstash/codecs/base.rb index e6f48b871..9479c40af 100644 --- a/logstash-core/lib/logstash/codecs/base.rb +++ b/logstash-core/lib/logstash/codecs/base.rb @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. - require "logstash/plugin" # This is the base class for logstash codecs. diff --git a/logstash-core/lib/logstash/compiler/lscl.rb b/logstash-core/lib/logstash/compiler/lscl.rb index 4a6063d28..c476431a2 100644 --- a/logstash-core/lib/logstash/compiler/lscl.rb +++ b/logstash-core/lib/logstash/compiler/lscl.rb @@ -87,6 +87,7 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC end class Plugins < Node; end + class Plugin < Node def expr expr_attributes = self.map_expr_attributes @@ -337,7 +338,6 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC all_elements = [first_element, *rest_elements] - res = if all_elements.size == 1 elem = all_elements.first if elem.is_a?(Selector) diff --git a/logstash-core/lib/logstash/compiler/lscl/lscl_grammar.rb b/logstash-core/lib/logstash/compiler/lscl/lscl_grammar.rb index 8d2487f6c..8dd50b34c 100644 --- a/logstash-core/lib/logstash/compiler/lscl/lscl_grammar.rb +++ b/logstash-core/lib/logstash/compiler/lscl/lscl_grammar.rb @@ -1,6 +1,5 @@ # Autogenerated from a Treetop grammar. Edits may be lost. - require "treetop/runtime" require "logstash/compiler/lscl.rb" @@ -284,7 +283,6 @@ module LogStashCompilerLSCLGrammar def cs2 elements[3] end - end def _nt_plugin_section @@ -470,7 +468,6 @@ module LogStashCompilerLSCLGrammar def plugin elements[0] end - end def _nt_plugins @@ -549,7 +546,6 @@ module LogStashCompilerLSCLGrammar def attribute elements[0] end - end module Plugin2 @@ -572,7 +568,6 @@ module LogStashCompilerLSCLGrammar def cs3 elements[5] end - end def _nt_plugin @@ -1479,7 +1474,6 @@ module LogStashCompilerLSCLGrammar def value elements[0] end - end module Array2 @@ -1490,7 +1484,6 @@ module LogStashCompilerLSCLGrammar def cs2 elements[3] end - end def _nt_array @@ -1610,7 +1603,6 @@ module LogStashCompilerLSCLGrammar def cs2 elements[3] end - end def _nt_hash @@ -1687,7 +1679,6 @@ module LogStashCompilerLSCLGrammar def hashentry elements[0] end - end def _nt_hashentries @@ -1854,7 +1845,6 @@ module LogStashCompilerLSCLGrammar def if elements[0] end - end def _nt_branch @@ -1958,7 +1948,6 @@ module LogStashCompilerLSCLGrammar def cs3 elements[5] end - end def _nt_if @@ -2086,7 +2075,6 @@ module LogStashCompilerLSCLGrammar def cs4 elements[7] end - end def _nt_else_if @@ -2216,7 +2204,6 @@ module LogStashCompilerLSCLGrammar def cs2 elements[3] end - end def _nt_else @@ -2328,7 +2315,6 @@ module LogStashCompilerLSCLGrammar def expression elements[0] end - end def _nt_condition @@ -2404,7 +2390,6 @@ module LogStashCompilerLSCLGrammar def cs2 elements[3] end - end def _nt_expression @@ -2529,7 +2514,6 @@ module LogStashCompilerLSCLGrammar def cs3 elements[5] end - end module NegativeExpression1 @@ -2808,7 +2792,6 @@ module LogStashCompilerLSCLGrammar def cs elements[1] end - end def _nt_not_in_operator @@ -2932,7 +2915,6 @@ module LogStashCompilerLSCLGrammar def rvalue elements[0] end - end module MethodCall2 @@ -2951,7 +2933,6 @@ module LogStashCompilerLSCLGrammar def cs3 elements[5] end - end def _nt_method_call @@ -3268,7 +3249,6 @@ module LogStashCompilerLSCLGrammar def cs2 elements[3] end - end def _nt_regexp_expression @@ -3547,7 +3527,6 @@ module LogStashCompilerLSCLGrammar r0 end - end class LogStashCompilerLSCLGrammarParser < Treetop::Runtime::CompiledParser diff --git a/logstash-core/lib/logstash/config/config_ast.rb b/logstash-core/lib/logstash/config/config_ast.rb index 385edc77f..f011fac85 100644 --- a/logstash-core/lib/logstash/config/config_ast.rb +++ b/logstash-core/lib/logstash/config/config_ast.rb @@ -92,7 +92,6 @@ module LogStash; module Config; module AST set_meta(PROCESS_ESCAPE_SEQUENCES, val) end - def compile LogStash::Config::AST.exclusive { do_compile } end @@ -156,6 +155,7 @@ module LogStash; module Config; module AST class Comment < Node; end class Whitespace < Node; end + class PluginSection < Node # Global plugin numbering for the janky instance variable naming we use # like @filter__1 @@ -168,8 +168,6 @@ module LogStash; module Config; module AST generate_variables code = [] @variables.each do |plugin, name| - - code << <<-CODE @generated_objects[:#{name}] = #{plugin.compile_initializer} @#{plugin.plugin_type}s << @generated_objects[:#{name}] @@ -228,6 +226,7 @@ module LogStash; module Config; module AST end class Plugins < Node; end + class Plugin < Node def plugin_type if recursive_select_parent(Plugin).any? @@ -324,11 +323,13 @@ module LogStash; module Config; module AST return text_value.inspect end end + class Attribute < Node def compile return %Q(#{name.compile} => #{value.compile}) end end + class RValue < Node; end class Value < RValue; end @@ -343,6 +344,7 @@ module LogStash; module Config; module AST return Unicode.wrap(text_value) end end + class String < Value def compile if get_meta(PROCESS_ESCAPE_SEQUENCES) @@ -352,21 +354,25 @@ module LogStash; module Config; module AST end end end + class RegExp < Value def compile return "Regexp.new(" + Unicode.wrap(text_value[1...-1]) + ")" end end + class Number < Value def compile return text_value end end + class Array < Value def compile return "[" << recursive_select(Value).collect(&:compile).reject(&:empty?).join(", ") << "]" end end + class Hash < Value def validate! duplicate_values = find_duplicate_keys @@ -408,7 +414,6 @@ module LogStash; module Config; module AST class Branch < Node def compile - # this construct is non obvious. we need to loop through each event and apply the conditional. # each branch of a conditional will contain a construct (a filter for example) that also loops through # the events variable so we have to initialize it to [event] for the branch code. @@ -454,6 +459,7 @@ module LogStash; module Config; module AST << children.collect(&:compile).map { |s| s.split("\n", -1).map { |l| " " + l }.join("\n") }.join("") << "\n" end end + class Elsif < BranchEntry def compile children = recursive_inject { |e| e.is_a?(Branch) || e.is_a?(Plugin) } @@ -461,6 +467,7 @@ module LogStash; module Config; module AST << children.collect(&:compile).map { |s| s.split("\n", -1).map { |l| " " + l }.join("\n") }.join("") << "\n" end end + class Else < BranchEntry def compile children = recursive_inject { |e| e.is_a?(Branch) || e.is_a?(Plugin) } @@ -529,26 +536,28 @@ module LogStash; module Config; module AST return " #{text_value} " end end + module RegExpOperator def compile return " #{text_value} " end end + module BooleanOperator def compile return " #{text_value} " end end + class Selector < RValue def compile return "event.get(#{text_value.inspect})" end end + class SelectorElement < Node; end end; end; end - - # Monkeypatch Treetop::Runtime::SyntaxNode's inspect method to skip # any Whitespace or SyntaxNodes with no children. class Treetop::Runtime::SyntaxNode diff --git a/logstash-core/lib/logstash/config/cpu_core_strategy.rb b/logstash-core/lib/logstash/config/cpu_core_strategy.rb index a0280b4da..0f8adbf3b 100644 --- a/logstash-core/lib/logstash/config/cpu_core_strategy.rb +++ b/logstash-core/lib/logstash/config/cpu_core_strategy.rb @@ -18,7 +18,6 @@ require "logstash/config/defaults" module LogStash module Config module CpuCoreStrategy - extend self def maximum diff --git a/logstash-core/lib/logstash/config/defaults.rb b/logstash-core/lib/logstash/config/defaults.rb index abb1c3749..0018d8ae4 100644 --- a/logstash-core/lib/logstash/config/defaults.rb +++ b/logstash-core/lib/logstash/config/defaults.rb @@ -18,7 +18,6 @@ require "concurrent" module LogStash module Config module Defaults - extend self def input diff --git a/logstash-core/lib/logstash/config/grammar.rb b/logstash-core/lib/logstash/config/grammar.rb index 23d0cd012..6ee61e4e2 100644 --- a/logstash-core/lib/logstash/config/grammar.rb +++ b/logstash-core/lib/logstash/config/grammar.rb @@ -1,6 +1,5 @@ # Autogenerated from a Treetop grammar. Edits may be lost. - require "treetop/runtime" require "logstash/config/config_ast" @@ -308,7 +307,6 @@ module LogStashConfig def cs2 elements[3] end - end def _nt_plugin_section @@ -494,7 +492,6 @@ module LogStashConfig def plugin elements[0] end - end def _nt_plugins @@ -573,7 +570,6 @@ module LogStashConfig def attribute elements[0] end - end module Plugin2 @@ -596,7 +592,6 @@ module LogStashConfig def cs3 elements[5] end - end def _nt_plugin @@ -1503,7 +1498,6 @@ module LogStashConfig def value elements[0] end - end module Array2 @@ -1514,7 +1508,6 @@ module LogStashConfig def cs2 elements[3] end - end def _nt_array @@ -1634,7 +1627,6 @@ module LogStashConfig def cs2 elements[3] end - end def _nt_hash @@ -1711,7 +1703,6 @@ module LogStashConfig def hashentry elements[0] end - end def _nt_hashentries @@ -1878,7 +1869,6 @@ module LogStashConfig def if elements[0] end - end def _nt_branch @@ -1982,7 +1972,6 @@ module LogStashConfig def cs3 elements[5] end - end def _nt_if @@ -2110,7 +2099,6 @@ module LogStashConfig def cs4 elements[7] end - end def _nt_else_if @@ -2240,7 +2228,6 @@ module LogStashConfig def cs2 elements[3] end - end def _nt_else @@ -2352,7 +2339,6 @@ module LogStashConfig def expression elements[0] end - end def _nt_condition @@ -2428,7 +2414,6 @@ module LogStashConfig def cs2 elements[3] end - end def _nt_expression @@ -2553,7 +2538,6 @@ module LogStashConfig def cs3 elements[5] end - end module NegativeExpression1 @@ -2832,7 +2816,6 @@ module LogStashConfig def cs elements[1] end - end def _nt_not_in_operator @@ -2956,7 +2939,6 @@ module LogStashConfig def rvalue elements[0] end - end module MethodCall2 @@ -2975,7 +2957,6 @@ module LogStashConfig def cs3 elements[5] end - end def _nt_method_call @@ -3292,7 +3273,6 @@ module LogStashConfig def cs2 elements[3] end - end def _nt_regexp_expression @@ -3571,7 +3551,6 @@ module LogStashConfig r0 end - end class LogStashConfigParser < Treetop::Runtime::CompiledParser diff --git a/logstash-core/lib/logstash/config/mixin.rb b/logstash-core/lib/logstash/config/mixin.rb index bcf60c3ba..e034c9223 100644 --- a/logstash-core/lib/logstash/config/mixin.rb +++ b/logstash-core/lib/logstash/config/mixin.rb @@ -47,7 +47,6 @@ LogStash::Environment.load_locale! # } # module LogStash::Config::Mixin - include LogStash::Util::SubstitutionVariables include LogStash::Util::Loggable @@ -166,7 +165,6 @@ module LogStash::Config::Mixin end # def config_init module DSL - include LogStash::Util::SubstitutionVariables attr_accessor :flags diff --git a/logstash-core/lib/logstash/config/modules_common.rb b/logstash-core/lib/logstash/config/modules_common.rb index 5d5db1b87..157ead21b 100644 --- a/logstash-core/lib/logstash/config/modules_common.rb +++ b/logstash-core/lib/logstash/config/modules_common.rb @@ -81,7 +81,6 @@ module LogStash module Config next end - alt_name = "module-#{module_name}" pipeline_id = alt_name module_settings.set("pipeline.id", pipeline_id) diff --git a/logstash-core/lib/logstash/dependency_report.rb b/logstash-core/lib/logstash/dependency_report.rb index a56a9ef58..7f827ec02 100644 --- a/logstash-core/lib/logstash/dependency_report.rb +++ b/logstash-core/lib/logstash/dependency_report.rb @@ -80,7 +80,6 @@ class LogStash::DependencyReport < Clamp::Command # Look at META-INF/MANIFEST.MF for any jars in each gem # Note any important details. Gem::Specification.select { |g| g.requirements && g.requirements.any? { |r| r =~ /^jar / } }.collect do |gem| - # Where is the gem installed root = gem.full_gem_path diff --git a/logstash-core/lib/logstash/elasticsearch_client.rb b/logstash-core/lib/logstash/elasticsearch_client.rb index a59d72e3c..1fde69a8c 100644 --- a/logstash-core/lib/logstash/elasticsearch_client.rb +++ b/logstash-core/lib/logstash/elasticsearch_client.rb @@ -27,6 +27,7 @@ module LogStash class ElasticsearchClient # duplicated here from Elasticsearch::Transport::Transport::Response # to create a normalised response across different client IMPL attr_reader :status, :body, :headers + def initialize(status, body, headers={}) @status, @body, @headers = status, body, headers @body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding) diff --git a/logstash-core/lib/logstash/environment.rb b/logstash-core/lib/logstash/environment.rb index f461d3b81..3a26b1b25 100644 --- a/logstash-core/lib/logstash/environment.rb +++ b/logstash-core/lib/logstash/environment.rb @@ -113,8 +113,6 @@ module LogStash # post_process ].each {|setting| SETTINGS.register(setting) } - - # Compute the default queue path based on `path.data` default_queue_file_path = ::File.join(SETTINGS.get("path.data"), "queue") SETTINGS.register Setting::WritableDirectory.new("path.queue", default_queue_file_path) diff --git a/logstash-core/lib/logstash/filters/base.rb b/logstash-core/lib/logstash/filters/base.rb index 49d564237..41ddbbd35 100644 --- a/logstash-core/lib/logstash/filters/base.rb +++ b/logstash-core/lib/logstash/filters/base.rb @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. - require "logstash/plugin" require "logstash/config/mixin" require "logstash/util/decorators" @@ -160,7 +159,6 @@ class LogStash::Filters::Base < LogStash::Plugin @slow_logger.on_event("event processing time", @original_params, event, java.lang.System.nanoTime - time) end - # in 1.5.0 multi_filter is meant to be used in the generated filter function in LogStash::Config::AST::Plugin only # and is temporary until we refactor the filter method interface to accept events list and return events list, # just list in multi_filter see https://github.com/elastic/logstash/issues/2872. diff --git a/logstash-core/lib/logstash/inputs/base.rb b/logstash-core/lib/logstash/inputs/base.rb index 7cf05e50d..0465403a9 100644 --- a/logstash-core/lib/logstash/inputs/base.rb +++ b/logstash-core/lib/logstash/inputs/base.rb @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. - require "logstash/plugin" require "logstash/config/mixin" require "logstash/codecs/base" diff --git a/logstash-core/lib/logstash/instrument/metric_store.rb b/logstash-core/lib/logstash/instrument/metric_store.rb index c2d23bc29..f31b149a7 100644 --- a/logstash-core/lib/logstash/instrument/metric_store.rb +++ b/logstash-core/lib/logstash/instrument/metric_store.rb @@ -66,7 +66,6 @@ module LogStash module Instrument # to the provided default_value_generator block will be stored. # @return [Metric] the value as it exists in the tree after this operation def fetch_or_store(namespaces, key, default_value = nil) - # We first check in the `@fast_lookup` store to see if we have already see that metrics before, # This give us a `o(1)` access, which is faster than searching through the structured # data store (Which is a `o(n)` operation where `n` is the number of element in the namespace and @@ -134,7 +133,6 @@ module LogStash module Instrument key_paths.reduce(get(*key_paths)) {|acc, p| acc[p]} end - # Return a hash including the values of the keys given at the path given # # Example Usage: diff --git a/logstash-core/lib/logstash/instrument/metric_type/counter.rb b/logstash-core/lib/logstash/instrument/metric_type/counter.rb index 21f101b91..9c22a7831 100644 --- a/logstash-core/lib/logstash/instrument/metric_type/counter.rb +++ b/logstash-core/lib/logstash/instrument/metric_type/counter.rb @@ -22,7 +22,6 @@ module LogStash module Instrument module MetricType def initialize(namespaces, key) super(key.to_s) - end def execute(action, value = 1) diff --git a/logstash-core/lib/logstash/instrument/periodic_poller/cgroup.rb b/logstash-core/lib/logstash/instrument/periodic_poller/cgroup.rb index c84b6cbbe..c9de321ff 100644 --- a/logstash-core/lib/logstash/instrument/periodic_poller/cgroup.rb +++ b/logstash-core/lib/logstash/instrument/periodic_poller/cgroup.rb @@ -22,6 +22,7 @@ module LogStash module Instrument module PeriodicPoller include LogStash::Util::Loggable class Override attr_reader :key, :value + def initialize(key) @key = key @value = java.lang.System.getProperty(@key) @@ -89,6 +90,7 @@ module LogStash module Instrument module PeriodicPoller module ControllerResource attr_reader :base_path, :override, :offset_path + def implemented? true end @@ -102,6 +104,7 @@ module LogStash module Instrument module PeriodicPoller @procs[:read_int] = lambda {|path| IO.readlines(path).first.to_i } @procs[:read_lines] = lambda {|path| IO.readlines(path) } end + def call_if_file_exists(call_key, file, not_found_value) path = ::File.join(@base_path, @offset_path, file) if ::File.exist?(path) @@ -125,6 +128,7 @@ module LogStash module Instrument module PeriodicPoller def initialize(original_path) common_initialize(CPUACCT_DIR, "ls.cgroup.cpuacct.path.override", original_path) end + def to_hash {:control_group => offset_path, :usage_nanos => cpuacct_usage} end @@ -140,6 +144,7 @@ module LogStash module Instrument module PeriodicPoller def initialize(original_path) common_initialize(CPU_DIR, "ls.cgroup.cpu.path.override", original_path) end + def to_hash { :control_group => offset_path, @@ -152,9 +157,11 @@ module LogStash module Instrument module PeriodicPoller def cfs_period_us call_if_file_exists(:read_int, "cpu.cfs_period_us", -1) end + def cfs_quota_us call_if_file_exists(:read_int, "cpu.cfs_quota_us", -1) end + def build_cpu_stats_hash stats = CpuStats.new lines = call_if_file_exists(:read_lines, "cpu.stat", []) @@ -165,9 +172,11 @@ module LogStash module Instrument module PeriodicPoller class UnimplementedResource attr_reader :controller, :original_path + def initialize(controller, original_path) @controller, @original_path = controller, original_path end + def implemented? false end @@ -179,6 +188,7 @@ module LogStash module Instrument module PeriodicPoller @number_of_times_throttled = -1 @time_throttled_nanos = -1 end + def update(lines) lines.each do |line| fields = line.split(/\s+/) @@ -190,6 +200,7 @@ module LogStash module Instrument module PeriodicPoller end end end + def to_hash { :number_of_elapsed_periods => @number_of_elapsed_periods, diff --git a/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb b/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb index 2fb38d000..f7f2fcfe1 100644 --- a/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb +++ b/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb @@ -32,7 +32,6 @@ java_import 'javax.naming.directory.Attribute' java_import 'org.logstash.instrument.reports.MemoryReport' java_import 'org.logstash.instrument.reports.ProcessReport' - module LogStash module Instrument module PeriodicPoller class JVM < Base class GarbageCollectorName @@ -118,7 +117,6 @@ module LogStash module Instrument module PeriodicPoller metric.gauge(cpu_path, :total_in_millis, cpu_metrics["total_in_millis"]) metric.gauge(path + [:mem], :total_virtual_in_bytes, process_metrics["mem"]["total_virtual_in_bytes"]) - end def collect_load_average diff --git a/logstash-core/lib/logstash/java_pipeline.rb b/logstash-core/lib/logstash/java_pipeline.rb index 079be8432..b0542b5b6 100644 --- a/logstash-core/lib/logstash/java_pipeline.rb +++ b/logstash-core/lib/logstash/java_pipeline.rb @@ -645,5 +645,4 @@ module LogStash; class JavaPipeline < AbstractPipeline def inputs_running? @input_threads.any?(&:alive?) end - end; end diff --git a/logstash-core/lib/logstash/json.rb b/logstash-core/lib/logstash/json.rb index 9df87f64a..b5d137f6c 100644 --- a/logstash-core/lib/logstash/json.rb +++ b/logstash-core/lib/logstash/json.rb @@ -27,7 +27,6 @@ module LogStash # options[:symbolize_keys] ? JrJackson::Raw.parse_sym(data) : JrJackson::Raw.parse_raw(data) JrJackson::Ruby.parse(data, options) - rescue JrJackson::ParseError => e raise LogStash::Json::ParserError.new(e.message) end @@ -38,13 +37,11 @@ module LogStash # also look for Java::JavaUtil::ArrayList, see TODO submit issue # o.is_a?(Enumerable) ? JrJackson::Raw.generate(o) : JrJackson::Json.dump(o) JrJackson::Base.generate(o, options) - rescue => e raise LogStash::Json::GeneratorError.new(e.message) end alias_method :load, "jruby_load".to_sym alias_method :dump, "jruby_dump".to_sym - end end diff --git a/logstash-core/lib/logstash/modules/cli_parser.rb b/logstash-core/lib/logstash/modules/cli_parser.rb index e75b3c041..f69d0884f 100644 --- a/logstash-core/lib/logstash/modules/cli_parser.rb +++ b/logstash-core/lib/logstash/modules/cli_parser.rb @@ -19,6 +19,7 @@ module LogStash module Modules class CLIParser include LogStash::Util::Loggable attr_reader :output + def initialize(module_names, module_variables) @output = [] # The #compact here catches instances when module_variables may be nil or diff --git a/logstash-core/lib/logstash/modules/elasticsearch_importer.rb b/logstash-core/lib/logstash/modules/elasticsearch_importer.rb index 2a27f22dd..07c68cea7 100644 --- a/logstash-core/lib/logstash/modules/elasticsearch_importer.rb +++ b/logstash-core/lib/logstash/modules/elasticsearch_importer.rb @@ -46,5 +46,4 @@ module LogStash module Modules class ElasticsearchImporter response = @client.head(path) response.status >= 200 && response.status < 300 end - end end end # class LogStash::Modules::Importer diff --git a/logstash-core/lib/logstash/modules/kibana_client.rb b/logstash-core/lib/logstash/modules/kibana_client.rb index c4b624cc4..812dc3264 100644 --- a/logstash-core/lib/logstash/modules/kibana_client.rb +++ b/logstash-core/lib/logstash/modules/kibana_client.rb @@ -28,6 +28,7 @@ module LogStash module Modules class KibanaClient class Response # to create a custom response with body as an Object (Hash or Array) attr_reader :status, :body, :headers + def initialize(status, body, headers={}) @status, @body, @headers = status, body, headers @body = body.is_a?(String) ? LogStash::Json.load(body) : body @@ -130,7 +131,6 @@ module LogStash module Modules class KibanaClient # content will be converted to a json string def post(relative_path, content, headers = nil) - body = content.is_a?(String) ? content : LogStash::Json.dump(content) options = {:body => body}.merge(headers || @http_options) safely(:post, relative_path, options) diff --git a/logstash-core/lib/logstash/modules/kibana_settings.rb b/logstash-core/lib/logstash/modules/kibana_settings.rb index 0fd5d3cf9..d2ed4f24b 100644 --- a/logstash-core/lib/logstash/modules/kibana_settings.rb +++ b/logstash-core/lib/logstash/modules/kibana_settings.rb @@ -22,6 +22,7 @@ module LogStash module Modules class KibanaSettings < KibanaBase class Setting attr_reader :name, :value + def initialize(name, value) @name, @value = name, value end diff --git a/logstash-core/lib/logstash/modules/scaffold.rb b/logstash-core/lib/logstash/modules/scaffold.rb index 05bbc4de0..548825be6 100644 --- a/logstash-core/lib/logstash/modules/scaffold.rb +++ b/logstash-core/lib/logstash/modules/scaffold.rb @@ -66,5 +66,4 @@ module LogStash module Modules class Scaffold def is_enabled?(settings) true end - end end end # class LogStash::Modules::Scaffold diff --git a/logstash-core/lib/logstash/outputs/base.rb b/logstash-core/lib/logstash/outputs/base.rb index 231d19f1e..750fb626d 100644 --- a/logstash-core/lib/logstash/outputs/base.rb +++ b/logstash-core/lib/logstash/outputs/base.rb @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. - require "logstash/plugin" require "logstash/config/mixin" require "concurrent/atomic/atomic_fixnum" diff --git a/logstash-core/lib/logstash/patches/bugfix_jruby_2558.rb b/logstash-core/lib/logstash/patches/bugfix_jruby_2558.rb index 05458a037..b01049e4c 100644 --- a/logstash-core/lib/logstash/patches/bugfix_jruby_2558.rb +++ b/logstash-core/lib/logstash/patches/bugfix_jruby_2558.rb @@ -44,6 +44,7 @@ if LogStash::Environment.windows? alias_method :orig_peeraddr, :peeraddr include JRubyBug2558SocketPeerAddrBugFix end + class UDPSocket alias_method :orig_peeraddr, :peeraddr include JRubyBug2558SocketPeerAddrBugFix diff --git a/logstash-core/lib/logstash/patches/clamp.rb b/logstash-core/lib/logstash/patches/clamp.rb index 80a9dcbe3..149d2f02c 100644 --- a/logstash-core/lib/logstash/patches/clamp.rb +++ b/logstash-core/lib/logstash/patches/clamp.rb @@ -33,7 +33,6 @@ module Clamp end module Option - module Declaration def deprecated_option(switches, type, description, opts = {}) Option::Definition.new(switches, type, description, opts).tap do |option| @@ -45,7 +44,6 @@ module Clamp end module StrictDeclaration - include Clamp::Attribute::Declaration include LogStash::Util::Loggable diff --git a/logstash-core/lib/logstash/pipeline_action/create.rb b/logstash-core/lib/logstash/pipeline_action/create.rb index d6ae384ea..ffd097777 100644 --- a/logstash-core/lib/logstash/pipeline_action/create.rb +++ b/logstash-core/lib/logstash/pipeline_action/create.rb @@ -18,7 +18,6 @@ require "logstash/pipeline_action/base" require "logstash/java_pipeline" - module LogStash module PipelineAction class Create < Base include LogStash::Util::Loggable diff --git a/logstash-core/lib/logstash/pipelines_registry.rb b/logstash-core/lib/logstash/pipelines_registry.rb index 6032387ce..9361e95ac 100644 --- a/logstash-core/lib/logstash/pipelines_registry.rb +++ b/logstash-core/lib/logstash/pipelines_registry.rb @@ -122,9 +122,9 @@ module LogStash end end - class PipelinesRegistry attr_reader :states + include LogStash::Util::Loggable def initialize diff --git a/logstash-core/lib/logstash/plugins/builtin/pipeline/input.rb b/logstash-core/lib/logstash/plugins/builtin/pipeline/input.rb index fc0cc629e..e4fdc658d 100644 --- a/logstash-core/lib/logstash/plugins/builtin/pipeline/input.rb +++ b/logstash-core/lib/logstash/plugins/builtin/pipeline/input.rb @@ -36,7 +36,6 @@ module ::LogStash; module Plugins; module Builtin; module Pipeline; class Input end # add address to the plugin stats metric.gauge(:address, address) - end def run(queue) @@ -85,5 +84,4 @@ module ::LogStash; module Plugins; module Builtin; module Pipeline; class Input def isRunning @running.get end - end; end; end; end; end diff --git a/logstash-core/lib/logstash/plugins/event_factory_support.rb b/logstash-core/lib/logstash/plugins/event_factory_support.rb index 007218858..5f1d9b2ee 100644 --- a/logstash-core/lib/logstash/plugins/event_factory_support.rb +++ b/logstash-core/lib/logstash/plugins/event_factory_support.rb @@ -3,7 +3,6 @@ require 'logstash/util/thread_safe_attributes' module LogStash module Plugins module EventFactorySupport - extend LogStash::Util::ThreadSafeAttributes # The event_factory method is effectively final and should not be re-defined by plugins. @@ -62,7 +61,6 @@ module LogStash end private_constant :TargetedEventFactory - end end end diff --git a/logstash-core/lib/logstash/runner.rb b/logstash-core/lib/logstash/runner.rb index 9352ef725..ee8436e91 100644 --- a/logstash-core/lib/logstash/runner.rb +++ b/logstash-core/lib/logstash/runner.rb @@ -368,7 +368,6 @@ class LogStash::Runner < Clamp::StrictCommand configure_plugin_paths(setting("path.plugins")) - @settings.format_settings.each {|line| logger.debug(line) } # Check for absence of any configuration @@ -441,7 +440,6 @@ class LogStash::Runner < Clamp::StrictCommand org.apache.logging.log4j.LogManager.shutdown agent_return - rescue org.logstash.LockException => e logger.fatal(I18n.t("logstash.runner.locked-data-path", :path => setting("path.data"))) return 1 diff --git a/logstash-core/lib/logstash/settings.rb b/logstash-core/lib/logstash/settings.rb index d1df037cd..47fd481f8 100644 --- a/logstash-core/lib/logstash/settings.rb +++ b/logstash-core/lib/logstash/settings.rb @@ -24,7 +24,6 @@ require "logstash/util/time_value" require "i18n" module LogStash - class Settings include LogStash::Util::SubstitutionVariables @@ -77,7 +76,6 @@ module LogStash "queue.type", ] - def initialize @settings = {} # Theses settings were loaded from the yaml file diff --git a/logstash-core/lib/logstash/util.rb b/logstash-core/lib/logstash/util.rb index 614ea50a5..be839342a 100644 --- a/logstash-core/lib/logstash/util.rb +++ b/logstash-core/lib/logstash/util.rb @@ -74,7 +74,6 @@ module LogStash::Util } end - # Merge hash 'src' into 'dst' nondestructively # # Duplicate keys will become array values @@ -156,7 +155,6 @@ module LogStash::Util return dst end # def hash_merge_many - # normalize method definition based on platform. # normalize is used to convert an object create through # json deserialization from JrJackson in :raw mode to pure Ruby @@ -234,5 +232,4 @@ module LogStash::Util value.respond_to?(:empty?) ? value.empty? : !value end end - end # module LogStash::Util diff --git a/logstash-core/lib/logstash/util/decorators.rb b/logstash-core/lib/logstash/util/decorators.rb index 9fce4875c..989484f6d 100644 --- a/logstash-core/lib/logstash/util/decorators.rb +++ b/logstash-core/lib/logstash/util/decorators.rb @@ -18,7 +18,6 @@ require "logstash/util" module LogStash::Util - # Decorators provides common manipulation on the event data. module Decorators include LogStash::Util::Loggable @@ -64,7 +63,5 @@ module LogStash::Util event.set("tags", tags) end - end # module LogStash::Util::Decorators - end # module LogStash::Util diff --git a/logstash-core/lib/logstash/util/safe_uri.rb b/logstash-core/lib/logstash/util/safe_uri.rb index 7b88cdaea..d568bba31 100644 --- a/logstash-core/lib/logstash/util/safe_uri.rb +++ b/logstash-core/lib/logstash/util/safe_uri.rb @@ -26,7 +26,6 @@ class LogStash::Util::SafeURI extend Forwardable - attr_reader :uri public diff --git a/logstash-core/lib/logstash/util/settings_helper.rb b/logstash-core/lib/logstash/util/settings_helper.rb index 59fe9ab6b..b319d84b9 100644 --- a/logstash-core/lib/logstash/util/settings_helper.rb +++ b/logstash-core/lib/logstash/util/settings_helper.rb @@ -30,7 +30,6 @@ require "logstash/environment" # The methods should be called in the above order before the settings are ready to be used. ######################## module LogStash::Util::SettingsHelper - # The `path.settings` and `path.logs` can not be defined in "logstash/environment" since the `Environment::LOGSTASH_HOME` doesn't # exist unless launched via "bootstrap/environment" def self.pre_process @@ -93,5 +92,4 @@ module LogStash::Util::SettingsHelper # I know, double negative !(["--help", "-h"] & args).empty? end - end diff --git a/logstash-core/lib/logstash/util/substitution_variables.rb b/logstash-core/lib/logstash/util/substitution_variables.rb index baa47f331..58876ff40 100644 --- a/logstash-core/lib/logstash/util/substitution_variables.rb +++ b/logstash-core/lib/logstash/util/substitution_variables.rb @@ -21,7 +21,6 @@ require_relative 'lazy_singleton' require_relative 'password' module ::LogStash::Util::SubstitutionVariables - include LogStash::Util::Loggable SUBSTITUTION_PLACEHOLDER_REGEX = /\${(?[a-zA-Z_.][a-zA-Z0-9_.]*)(:(?[^}]*))?}/ diff --git a/logstash-core/lib/logstash/util/thread_safe_attributes.rb b/logstash-core/lib/logstash/util/thread_safe_attributes.rb index fddd3bc71..1a5258815 100644 --- a/logstash-core/lib/logstash/util/thread_safe_attributes.rb +++ b/logstash-core/lib/logstash/util/thread_safe_attributes.rb @@ -19,7 +19,6 @@ module LogStash module Util # @api internal module ThreadSafeAttributes - # Thread-safe lazy initialized attribute with a given (variable) name. def lazy_init_attr(attribute, variable: "@#{attribute}".to_sym, &block) raise ArgumentError.new("invalid attribute name: #{attribute}") unless attribute.match? /^[_A-Za-z]\w*$/ @@ -38,7 +37,6 @@ module LogStash end end end - end end end diff --git a/logstash-core/lib/logstash/util/unicode_trimmer.rb b/logstash-core/lib/logstash/util/unicode_trimmer.rb index b8bb1c0d3..9169eccca 100644 --- a/logstash-core/lib/logstash/util/unicode_trimmer.rb +++ b/logstash-core/lib/logstash/util/unicode_trimmer.rb @@ -1,4 +1,5 @@ # encoding: utf-8 + module LogStash::Util::UnicodeTrimmer # The largest possible unicode chars are 4 bytes # http://stackoverflow.com/questions/9533258/what-is-the-maximum-number-of-bytes-for-a-utf-8-encoded-character diff --git a/logstash-core/lib/logstash/util/worker_threads_default_printer.rb b/logstash-core/lib/logstash/util/worker_threads_default_printer.rb index a45184cc1..c27ffdfae 100644 --- a/logstash-core/lib/logstash/util/worker_threads_default_printer.rb +++ b/logstash-core/lib/logstash/util/worker_threads_default_printer.rb @@ -19,7 +19,6 @@ require "logstash/util" # This class exists to format the settings for default worker threads module LogStash module Util class WorkerThreadsDefaultPrinter - def initialize(settings) @setting = settings.fetch('pipeline.workers', 0) @default = settings.fetch('default-pipeline-workers', 0) @@ -39,5 +38,4 @@ module LogStash module Util class WorkerThreadsDefaultPrinter return if @default == 0 collector.push "Default pipeline workers: #{@default}" end - end end end diff --git a/logstash-core/spec/conditionals_spec.rb b/logstash-core/spec/conditionals_spec.rb index 6621b128f..41e6bb272 100644 --- a/logstash-core/spec/conditionals_spec.rb +++ b/logstash-core/spec/conditionals_spec.rb @@ -47,6 +47,7 @@ describe "conditionals in output" do def register end + def multi_receive(events) end end @@ -366,7 +367,6 @@ describe "conditionals in filter" do sample_one("sample") { expect(subject.get("tags")).to include("failure") } sample_one("some sample") { expect(subject.get("tags")).to include("failure") } end - end describe "negated expressions" do @@ -413,7 +413,6 @@ describe "conditionals in filter" do sample_one("sample") { expect(subject.get("tags")).not_to include("failure") } sample_one("some sample") { expect(subject.get("tags")).not_to include("failure") } end - end describe "value as an expression" do diff --git a/logstash-core/spec/logstash/acked_queue_concurrent_stress_spec.rb b/logstash-core/spec/logstash/acked_queue_concurrent_stress_spec.rb index 935274855..156d554c8 100644 --- a/logstash-core/spec/logstash/acked_queue_concurrent_stress_spec.rb +++ b/logstash-core/spec/logstash/acked_queue_concurrent_stress_spec.rb @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. - require "logstash/instrument/namespaced_metric" describe LogStash::WrappedAckedQueue, :stress_test => true do diff --git a/logstash-core/spec/logstash/agent/converge_spec.rb b/logstash-core/spec/logstash/agent/converge_spec.rb index 91a752f6a..d1ba2f587 100644 --- a/logstash-core/spec/logstash/agent/converge_spec.rb +++ b/logstash-core/spec/logstash/agent/converge_spec.rb @@ -64,11 +64,9 @@ describe LogStash::Agent do end context "system pipeline" do - let(:system_pipeline_config) { mock_pipeline_config(:system_pipeline, "input { dummyblockinginput { } } output { null {} }", { "pipeline.system" => true }) } context "when we have a finite pipeline and a system pipeline running" do - let(:finite_pipeline_config) { mock_pipeline_config(:main, "input { generator { count => 1000 } } output { null {} }") } let(:source_loader) do diff --git a/logstash-core/spec/logstash/agent/metrics_spec.rb b/logstash-core/spec/logstash/agent/metrics_spec.rb index 04ce55352..ad3b9e73b 100644 --- a/logstash-core/spec/logstash/agent/metrics_spec.rb +++ b/logstash-core/spec/logstash/agent/metrics_spec.rb @@ -81,7 +81,6 @@ describe LogStash::Agent do expect(mval(:stats, :flow, :queue_backpressure)).to be_a_kind_of(java.util.Map) expect(mval(:stats, :flow, :worker_concurrency)).to be_a_kind_of(java.util.Map) end - end context "when we try to start one pipeline" do diff --git a/logstash-core/spec/logstash/agent_spec.rb b/logstash-core/spec/logstash/agent_spec.rb index 776c0ed29..7efb61e85 100644 --- a/logstash-core/spec/logstash/agent_spec.rb +++ b/logstash-core/spec/logstash/agent_spec.rb @@ -28,9 +28,7 @@ require 'timeout' java_import org.logstash.Timestamp describe LogStash::Agent do - shared_examples "all Agent tests" do - let(:agent_settings) { mock_settings({}) } let(:agent_args) { {} } let(:pipeline_settings) { agent_settings.clone } @@ -194,7 +192,6 @@ describe LogStash::Agent do t.join end end - end context "when calling reload_state!" do context "with a pipeline with auto reloading turned off" do @@ -286,7 +283,6 @@ describe LogStash::Agent do end context "referenced environment variable does not exist" do - it "does not converge the pipeline" do expect(subject.converge_state_and_update).not_to be_a_successful_converge end @@ -393,7 +389,6 @@ describe LogStash::Agent do end context "metrics after config reloading" do - let(:initial_generator_threshold) { 1000 } let(:original_config_output) { Stud::Temporary.pathname } let(:new_config_output) { Stud::Temporary.pathname } diff --git a/logstash-core/spec/logstash/api/modules/logging_spec.rb b/logstash-core/spec/logstash/api/modules/logging_spec.rb index 9efb290c6..5fc138b87 100644 --- a/logstash-core/spec/logstash/api/modules/logging_spec.rb +++ b/logstash-core/spec/logstash/api/modules/logging_spec.rb @@ -24,7 +24,6 @@ describe LogStash::Api::Modules::Logging do include_context "api setup" describe "#logging" do - context "when setting a logger's log level" do it "should return a positive acknowledgement on success" do put '/', '{"logger.logstash": "ERROR"}' diff --git a/logstash-core/spec/logstash/api/modules/node_spec.rb b/logstash-core/spec/logstash/api/modules/node_spec.rb index bf34e365c..a514ed660 100644 --- a/logstash-core/spec/logstash/api/modules/node_spec.rb +++ b/logstash-core/spec/logstash/api/modules/node_spec.rb @@ -25,7 +25,6 @@ describe LogStash::Api::Modules::Node do include_examples "not found" describe "#hot threads" do - before(:all) do get "/hot_threads" end @@ -39,7 +38,6 @@ describe LogStash::Api::Modules::Node do end context "#threads count" do - before(:all) do get "/hot_threads?threads=5" end @@ -63,7 +61,6 @@ describe LogStash::Api::Modules::Node do end context "broken params in URL" do - before(:all) do get "/hot_threads?human=?threads=5" end @@ -80,7 +77,6 @@ describe LogStash::Api::Modules::Node do "/hot_threads?human=1", "/hot_threads?human=t", ].each do |path| - before(:all) do get path end diff --git a/logstash-core/spec/logstash/api/modules/plugins_spec.rb b/logstash-core/spec/logstash/api/modules/plugins_spec.rb index 0ac158c19..84a4c075f 100644 --- a/logstash-core/spec/logstash/api/modules/plugins_spec.rb +++ b/logstash-core/spec/logstash/api/modules/plugins_spec.rb @@ -61,7 +61,6 @@ describe LogStash::Api::Modules::Plugins do end context "#values" do - let(:payload) { LogStash::Json.load(last_response.body) } it "return totals of plugins" do diff --git a/logstash-core/spec/logstash/codecs/base_spec.rb b/logstash-core/spec/logstash/codecs/base_spec.rb index f216d5a89..a325e17d9 100644 --- a/logstash-core/spec/logstash/codecs/base_spec.rb +++ b/logstash-core/spec/logstash/codecs/base_spec.rb @@ -22,6 +22,7 @@ DATA_DOUBLE = "data".freeze # use a dummy NOOP output to test Outputs::Base class LogStash::Codecs::NOOPAsync < LogStash::Codecs::Base attr_reader :last_result + config_name "noop_async" def encode(event) @@ -31,6 +32,7 @@ end class LogStash::Codecs::NOOPSync < LogStash::Codecs::Base attr_reader :last_result + config_name "noop_sync" def encode_sync(event) @@ -40,6 +42,7 @@ end class LogStash::Codecs::NOOPMulti < LogStash::Codecs::Base attr_reader :last_result + config_name "noop_multi" def encode_sync(event) diff --git a/logstash-core/spec/logstash/compiler/compiler_spec.rb b/logstash-core/spec/logstash/compiler/compiler_spec.rb index 3bb464bf0..526e04e8b 100644 --- a/logstash-core/spec/logstash/compiler/compiler_spec.rb +++ b/logstash-core/spec/logstash/compiler/compiler_spec.rb @@ -298,7 +298,6 @@ describe LogStash::Compiler do it "should merge the values of the duplicate keys into an array" do expect(c_plugin).to ir_eql(j.iPlugin(rand_meta, FILTER, "grok", expected_plugin_args)) end - end describe "a filter plugin that has nested Hash directives" do @@ -428,7 +427,6 @@ describe LogStash::Compiler do EOS end - it "should contain both section declarations, in order" do expect(compiled_section).to ir_eql(compose( splugin("aplugin", {"count" => 1}), diff --git a/logstash-core/spec/logstash/config/config_ast_spec.rb b/logstash-core/spec/logstash/config/config_ast_spec.rb index 97302021e..b08152e6d 100644 --- a/logstash-core/spec/logstash/config/config_ast_spec.rb +++ b/logstash-core/spec/logstash/config/config_ast_spec.rb @@ -102,7 +102,6 @@ describe LogStashConfigParser do end end - context "invalid configuration" do it "rejects duplicate hash key" do parser = LogStashConfigParser.new @@ -223,6 +222,7 @@ describe LogStashConfigParser do @code = @config.compile eval(@code) end + def plugin(*args); end def line_to_source(*args); end end @@ -235,7 +235,6 @@ describe LogStashConfigParser do output { output1 { } }" } - it "should create a pipeline with both sections" do generated_objects = pipeline_klass.new(config_string, settings).instance_variable_get("@generated_objects") filters = generated_objects.keys.map(&:to_s).select {|obj_name| obj_name.match(/^filter.+?_\d+$/) } @@ -250,7 +249,6 @@ describe LogStashConfigParser do output { output1 { } }" } - it "should create a pipeline with both sections" do generated_objects = pipeline_klass.new(config_string, settings).instance_variable_get("@generated_objects") outputs = generated_objects.keys.map(&:to_s).select {|obj_name| obj_name.match(/^output.+?_\d+$/) } @@ -277,6 +275,7 @@ describe LogStashConfigParser do @code = @config.compile eval(@code) end + def plugin(*args); end def line_to_source(*args); end end diff --git a/logstash-core/spec/logstash/config/cpu_core_strategy_spec.rb b/logstash-core/spec/logstash/config/cpu_core_strategy_spec.rb index 8c6608e11..8f158d0a2 100644 --- a/logstash-core/spec/logstash/config/cpu_core_strategy_spec.rb +++ b/logstash-core/spec/logstash/config/cpu_core_strategy_spec.rb @@ -19,7 +19,6 @@ require "spec_helper" require "logstash/config/cpu_core_strategy" describe LogStash::Config::CpuCoreStrategy do - before do allow(LogStash::Config::Defaults).to receive(:cpu_cores).and_return(cores) end @@ -135,5 +134,4 @@ describe LogStash::Config::CpuCoreStrategy do expect(described_class.max_minus_two).to eq(1) end end - end diff --git a/logstash-core/spec/logstash/converge_result_spec.rb b/logstash-core/spec/logstash/converge_result_spec.rb index bd590e6ad..c084efccf 100644 --- a/logstash-core/spec/logstash/converge_result_spec.rb +++ b/logstash-core/spec/logstash/converge_result_spec.rb @@ -24,7 +24,6 @@ describe LogStash::ConvergeResult do subject { described_class.new(expected_actions_count) } - context "When the action was executed" do it "returns the time of execution" do expect(LogStash::ConvergeResult::FailedAction.new("testing").executed_at.class).to eq(LogStash::Timestamp) diff --git a/logstash-core/spec/logstash/environment_spec.rb b/logstash-core/spec/logstash/environment_spec.rb index 4b46deddc..2544491b7 100644 --- a/logstash-core/spec/logstash/environment_spec.rb +++ b/logstash-core/spec/logstash/environment_spec.rb @@ -19,9 +19,7 @@ require "spec_helper" require "logstash/environment" describe LogStash::Environment do - context "when loading jars dependencies" do - let(:default_jars_location) { File.join("vendor", "jar-dependencies") } let(:default_runtime_location) { File.join(default_jars_location, "runtime-jars", "*.jar") } let(:default_test_location) { File.join(default_jars_location, "test-jars", "*.jar") } @@ -37,7 +35,6 @@ describe LogStash::Environment do end context "when loading a jar file" do - let(:dummy_jar_file) { File.join(default_jars_location, "runtime-jars", "elasticsearch.jar") } it "requires the jar files if there are jars to load" do @@ -65,7 +62,6 @@ describe LogStash::Environment do end end - describe "OS detection" do windows_host_os = %w(bccwin cygwin mingw mswin wince) linux_host_os = %w(linux) diff --git a/logstash-core/spec/logstash/event_spec.rb b/logstash-core/spec/logstash/event_spec.rb index 4b9cfbd1d..50f9a646a 100644 --- a/logstash-core/spec/logstash/event_spec.rb +++ b/logstash-core/spec/logstash/event_spec.rb @@ -247,7 +247,6 @@ describe LogStash::Event do end end - # TODO(talevy): migrate tests to Java. no reason to test logging logic in ruby when it is being # done in java land. @@ -343,7 +342,6 @@ describe LogStash::Event do end context "initialize" do - it "should accept Ruby Hash" do e = LogStash::Event.new({"foo" => 1, TIMESTAMP => "2015-05-28T23:02:05.350Z"}) expect(e.get("foo")).to eq(1) diff --git a/logstash-core/spec/logstash/filter_delegator_spec.rb b/logstash-core/spec/logstash/filter_delegator_spec.rb index 37fda5151..6aa7fc46b 100644 --- a/logstash-core/spec/logstash/filter_delegator_spec.rb +++ b/logstash-core/spec/logstash/filter_delegator_spec.rb @@ -21,7 +21,6 @@ require "logstash/filter_delegator" require "support/shared_contexts" describe LogStash::FilterDelegator do - include_context "execution_context" let(:filter_id) { "my-filter" } @@ -57,6 +56,7 @@ describe LogStash::FilterDelegator do config :host, :validate => :string def register; end def flush(options = {}); @events ; end + def filter(event) @events ||= [] @events << event @@ -85,7 +85,6 @@ describe LogStash::FilterDelegator do end context "when the filter buffer events" do - it "has incremented :in" do subject.multi_filter(events) expect(collector.snapshot_metric.metric_store.get_with_path("/null")[:null]["my-filter".to_sym][:events][:in].value).to eq(events.size) @@ -132,6 +131,7 @@ describe LogStash::FilterDelegator do config_name "super_plugin" config :host, :validate => :string def register; end + def filter(event) event end @@ -159,5 +159,4 @@ describe LogStash::FilterDelegator do expect(subject.config_name).to eq("super_plugin") end end - end diff --git a/logstash-core/spec/logstash/filters/base_spec.rb b/logstash-core/spec/logstash/filters/base_spec.rb index ee390691b..2885c77be 100644 --- a/logstash-core/spec/logstash/filters/base_spec.rb +++ b/logstash-core/spec/logstash/filters/base_spec.rb @@ -382,7 +382,6 @@ describe LogStash::Filters::NOOP do sample_one("type" => "noop", "go" => "away", "tags" => "blackhole") do expect(subject.get("[tags]")).to eq("blackhole") end - end describe "when metrics are disabled" do diff --git a/logstash-core/spec/logstash/instrument/metric_type/counter_spec.rb b/logstash-core/spec/logstash/instrument/metric_type/counter_spec.rb index 2cbb8bf03..da4953f7f 100644 --- a/logstash-core/spec/logstash/instrument/metric_type/counter_spec.rb +++ b/logstash-core/spec/logstash/instrument/metric_type/counter_spec.rb @@ -35,5 +35,4 @@ describe LogStash::Instrument::MetricType::Counter do expect(LogStash::Json.dump(subject)).to eq("0") end end - end diff --git a/logstash-core/spec/logstash/instrument/metric_type/gauge_spec.rb b/logstash-core/spec/logstash/instrument/metric_type/gauge_spec.rb index 4aab9db4d..8c0a5a95e 100644 --- a/logstash-core/spec/logstash/instrument/metric_type/gauge_spec.rb +++ b/logstash-core/spec/logstash/instrument/metric_type/gauge_spec.rb @@ -41,6 +41,4 @@ describe LogStash::Instrument::MetricType::Gauge do expect(LogStash::Json.dump(subject)).to eq("\"#{value}\"") end end - - end diff --git a/logstash-core/spec/logstash/instrument/namespaced_null_metric_spec.rb b/logstash-core/spec/logstash/instrument/namespaced_null_metric_spec.rb index 991e95647..b6f35f342 100644 --- a/logstash-core/spec/logstash/instrument/namespaced_null_metric_spec.rb +++ b/logstash-core/spec/logstash/instrument/namespaced_null_metric_spec.rb @@ -43,5 +43,4 @@ describe LogStash::Instrument::NamespacedNullMetric do expect(subject.namespace_name).to eq([namespace]) expect(new_namespace.namespace_name).to eq([:root, :wally]) end - end diff --git a/logstash-core/spec/logstash/instrument/null_metric_spec.rb b/logstash-core/spec/logstash/instrument/null_metric_spec.rb index 382fc408d..9b491e573 100644 --- a/logstash-core/spec/logstash/instrument/null_metric_spec.rb +++ b/logstash-core/spec/logstash/instrument/null_metric_spec.rb @@ -20,7 +20,6 @@ require_relative "../../support/matchers" require "spec_helper" describe LogStash::Instrument::NullMetric do - let(:key) { "test" } subject { LogStash::Instrument::NullMetric.new(nil) } diff --git a/logstash-core/spec/logstash/instrument/periodic_poller/jvm_spec.rb b/logstash-core/spec/logstash/instrument/periodic_poller/jvm_spec.rb index 54f71c6f6..1479c20ae 100644 --- a/logstash-core/spec/logstash/instrument/periodic_poller/jvm_spec.rb +++ b/logstash-core/spec/logstash/instrument/periodic_poller/jvm_spec.rb @@ -44,7 +44,6 @@ describe LogStash::Instrument::PeriodicPoller::JVM::GarbageCollectorName do end end - describe LogStash::Instrument::PeriodicPoller::JVM do let(:metric) { LogStash::Instrument::Metric.new(LogStash::Instrument::Collector.new) } let(:options) { {} } diff --git a/logstash-core/spec/logstash/instrument/wrapped_write_client_spec.rb b/logstash-core/spec/logstash/instrument/wrapped_write_client_spec.rb index 23301abae..762943f35 100644 --- a/logstash-core/spec/logstash/instrument/wrapped_write_client_spec.rb +++ b/logstash-core/spec/logstash/instrument/wrapped_write_client_spec.rb @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. - require_relative "../../support/mocks_classes" require "spec_helper" require "java" @@ -139,5 +138,4 @@ describe LogStash::WrappedWriteClient do include_examples "queue tests" end - end diff --git a/logstash-core/spec/logstash/java_filter_delegator_spec.rb b/logstash-core/spec/logstash/java_filter_delegator_spec.rb index 75bfca54b..9f39da5dc 100644 --- a/logstash-core/spec/logstash/java_filter_delegator_spec.rb +++ b/logstash-core/spec/logstash/java_filter_delegator_spec.rb @@ -22,7 +22,6 @@ require "support/shared_contexts" java_import org.logstash.RubyUtil describe LogStash::FilterDelegator do - class MockGauge def increment(_) end @@ -81,6 +80,7 @@ describe LogStash::FilterDelegator do config :host, :validate => :string def register; end def flush(options = {}); @events ; end + def filter(event) @events ||= [] @events << event @@ -116,7 +116,6 @@ describe LogStash::FilterDelegator do end context "when the filter buffer events" do - it "has incremented :in" do subject.to_java.multiFilter(events) expect( @@ -167,6 +166,7 @@ describe LogStash::FilterDelegator do config_name "super_plugin" config :host, :validate => :string def register; end + def filter(event) event end @@ -196,5 +196,4 @@ describe LogStash::FilterDelegator do expect(subject.config_name).to eq("super_plugin") end end - end diff --git a/logstash-core/spec/logstash/java_integration_spec.rb b/logstash-core/spec/logstash/java_integration_spec.rb index 097b2869f..31c0393f5 100644 --- a/logstash-core/spec/logstash/java_integration_spec.rb +++ b/logstash-core/spec/logstash/java_integration_spec.rb @@ -18,15 +18,12 @@ require "spec_helper" describe "Java integration" do - context "type equivalence" do - # here we test for both is_a? and case/when usage of the Java types # because these are the specific use-cases in our code and the expected # behaviour. context "Java::JavaUtil::ArrayList" do - it "should report to be a Ruby Array" do expect(Java::JavaUtil::ArrayList.new.is_a?(Array)).to eq(true) end @@ -178,7 +175,6 @@ describe "Java integration" do end context "when intersecting with a Ruby Array" do - context "using string collection with duplicates and single result" do let(:initial_array) {["foo", "bar", "foo"]} @@ -214,7 +210,6 @@ describe "Java integration" do end context "when unioning with a Ruby Array" do - context "using string collection with duplicates" do let(:initial_array) {["foo", "bar", "foo"]} @@ -271,7 +266,6 @@ describe "Java integration" do context "Enumerable implementation" do context "Java Map interface should report key with nil value as included" do - it "should support include? method" do expect(Java::JavaUtil::LinkedHashMap.new({"foo" => nil}).include?("foo")).to eq(true) end @@ -290,7 +284,6 @@ describe "Java integration" do end context "Java Map interface should report key with a value as included" do - it "should support include? method" do expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).include?("foo")).to eq(true) end @@ -309,7 +302,6 @@ describe "Java integration" do end context "Java Map interface should report non existing key as not included" do - it "should support include? method" do expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1})).not_to include("bar") end diff --git a/logstash-core/spec/logstash/java_pipeline_spec.rb b/logstash-core/spec/logstash/java_pipeline_spec.rb index f8c559cbf..a5320ded6 100644 --- a/logstash-core/spec/logstash/java_pipeline_spec.rb +++ b/logstash-core/spec/logstash/java_pipeline_spec.rb @@ -155,12 +155,15 @@ class DummyFlushingFilter < LogStash::Filters::Base def register() end def filter(event) end + def periodic_flush true end + def flush(options) [::LogStash::Event.new("message" => "dummy_flush")] end + def close() end end @@ -544,7 +547,6 @@ describe LogStash::JavaPipeline do allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutput").and_return(::LogStash::Outputs::DummyOutput) end - let(:test_config_without_output_workers) { <<-eos input { @@ -784,7 +786,6 @@ describe LogStash::JavaPipeline do end end - describe "max inflight warning" do let(:config) { "input { dummyinput {} } output { dummyoutput {} }" } let(:batch_size) { 1 } @@ -984,7 +985,6 @@ describe LogStash::JavaPipeline do pipeline.shutdown end - end it_behaves_like 'it flushes correctly' @@ -1315,7 +1315,6 @@ describe LogStash::JavaPipeline do collect_stats expect(collected_stats).to be_nil end - end context 'when dlq is enabled' do diff --git a/logstash-core/spec/logstash/json_spec.rb b/logstash-core/spec/logstash/json_spec.rb index 45c79b12b..384b9f2cc 100644 --- a/logstash-core/spec/logstash/json_spec.rb +++ b/logstash-core/spec/logstash/json_spec.rb @@ -21,7 +21,6 @@ require "logstash/environment" require "logstash/util" describe "LogStash::Json" do - let(:hash) {{"a" => 1}} let(:json_hash) {"{\"a\":1}"} @@ -73,7 +72,6 @@ describe "LogStash::Json" do end context "pretty print" do - let(:hash) { { "foo" => "bar", :zoo => 2 } } it "should serialize with pretty print" do diff --git a/logstash-core/spec/logstash/modules/cli_parser_spec.rb b/logstash-core/spec/logstash/modules/cli_parser_spec.rb index fcd4dafa7..df57f67a3 100644 --- a/logstash-core/spec/logstash/modules/cli_parser_spec.rb +++ b/logstash-core/spec/logstash/modules/cli_parser_spec.rb @@ -19,7 +19,6 @@ require "spec_helper" require "logstash/modules/cli_parser" describe LogStash::Modules::CLIParser do - subject { LogStash::Modules::CLIParser.new(module_names, module_variables) } let(:logger) { double("logger") } let(:module_name) { "foo" } @@ -140,5 +139,4 @@ describe LogStash::Modules::CLIParser do end end end - end diff --git a/logstash-core/spec/logstash/modules/kibana_client_spec.rb b/logstash-core/spec/logstash/modules/kibana_client_spec.rb index f2ed11ae8..54016272c 100644 --- a/logstash-core/spec/logstash/modules/kibana_client_spec.rb +++ b/logstash-core/spec/logstash/modules/kibana_client_spec.rb @@ -23,6 +23,7 @@ module LogStash module Modules def http(method, endpoint, options) self end + def call KibanaTestResponse.new(200, '{"version":{"number":"1.2.3","build_snapshot":false}}', {}) end diff --git a/logstash-core/spec/logstash/modules/settings_merger_spec.rb b/logstash-core/spec/logstash/modules/settings_merger_spec.rb index 5c9429eab..c0f65f274 100644 --- a/logstash-core/spec/logstash/modules/settings_merger_spec.rb +++ b/logstash-core/spec/logstash/modules/settings_merger_spec.rb @@ -46,7 +46,6 @@ describe LogStash::Modules::SettingsMerger do end describe "#merge_kibana_auth" do - before do described_class.merge_kibana_auth!(mod_settings) end @@ -72,7 +71,6 @@ describe LogStash::Modules::SettingsMerger do expect(mod_settings["var.kibana.password"]).to eq("stott") end end - end describe "#merge_cloud_settings" do diff --git a/logstash-core/spec/logstash/persisted_queue_config_validator_spec.rb b/logstash-core/spec/logstash/persisted_queue_config_validator_spec.rb index d291904ce..6faba3072 100644 --- a/logstash-core/spec/logstash/persisted_queue_config_validator_spec.rb +++ b/logstash-core/spec/logstash/persisted_queue_config_validator_spec.rb @@ -22,7 +22,6 @@ require 'securerandom' require_relative '../support/helpers' describe LogStash::PersistedQueueConfigValidator do - context("when persisted queues are enabled") do let(:input_block) { "input { generator {} }" } let(:config_path) { temporary_file(input_block) } @@ -212,6 +211,5 @@ describe LogStash::PersistedQueueConfigValidator do end end end - end end diff --git a/logstash-core/spec/logstash/pipeline_action/create_spec.rb b/logstash-core/spec/logstash/pipeline_action/create_spec.rb index 1aadf7dc0..771681153 100644 --- a/logstash-core/spec/logstash/pipeline_action/create_spec.rb +++ b/logstash-core/spec/logstash/pipeline_action/create_spec.rb @@ -45,7 +45,6 @@ describe LogStash::PipelineAction::Create do expect(subject.pipeline_id).to eq(:main) end - context "when we have really short lived pipeline" do let(:pipeline_config) { mock_pipeline_config(:main, "input { generator { count => 1 } } output { null {} }") } diff --git a/logstash-core/spec/logstash/pipeline_dlq_commit_spec.rb b/logstash-core/spec/logstash/pipeline_dlq_commit_spec.rb index 3ef961afb..8069f984e 100644 --- a/logstash-core/spec/logstash/pipeline_dlq_commit_spec.rb +++ b/logstash-core/spec/logstash/pipeline_dlq_commit_spec.rb @@ -115,5 +115,4 @@ describe LogStash::JavaPipeline do subject.shutdown end end - end diff --git a/logstash-core/spec/logstash/pipelines_registry_spec.rb b/logstash-core/spec/logstash/pipelines_registry_spec.rb index 286eeffb3..ac3806311 100644 --- a/logstash-core/spec/logstash/pipelines_registry_spec.rb +++ b/logstash-core/spec/logstash/pipelines_registry_spec.rb @@ -19,7 +19,6 @@ require "spec_helper" require "logstash/pipelines_registry" describe LogStash::PipelinesRegistry do - let(:pipeline_id) { "test".to_sym } let(:pipeline) { double("Pipeline") } let(:logger) { double("Logger") } @@ -109,7 +108,6 @@ describe LogStash::PipelinesRegistry do let (:pipeline2) { double("pipeline2") } it "should create a loading state before calling the create block" do - # create a thread which calls create_pipeline and wait in the create # block so we can controle the pipeline initialization phase t = Thread.new do @@ -198,7 +196,6 @@ describe LogStash::PipelinesRegistry do # 2nd call: finished_execution? is true expect(subject.running_pipelines).to be_empty - queue = Queue.new # threadsafe queue in_block = Concurrent::AtomicBoolean.new(false) @@ -343,6 +340,5 @@ describe LogStash::PipelinesRegistry do expect(subject.running_user_defined_pipelines).to be_empty end end - end end diff --git a/logstash-core/spec/logstash/plugin_spec.rb b/logstash-core/spec/logstash/plugin_spec.rb index fbf3d70d6..f3d8ee48c 100644 --- a/logstash-core/spec/logstash/plugin_spec.rb +++ b/logstash-core/spec/logstash/plugin_spec.rb @@ -191,7 +191,6 @@ describe LogStash::Plugin do config :foo_tag, :validate => :string, :default => "bar" end ].each do |klass| - it "subclass #{klass.name} does not modify params" do klass.new(args) expect(args).to be_empty @@ -199,7 +198,6 @@ describe LogStash::Plugin do end context "codec initialization" do - class LogStash::Codecs::Noop < LogStash::Codecs::Base config_name "noop" @@ -212,7 +210,6 @@ describe LogStash::Plugin do expect_any_instance_of(LogStash::Codecs::Noop).to receive(:register).once LogStash::Plugin.new(args) end - end end @@ -304,8 +301,6 @@ describe LogStash::Plugin do 'when there is not ID configured for the plugin' => {}, 'when a user provide an ID for the plugin' => { 'id' => 'ABC' }, }.each do |desc, config_override| - - context(desc) do let(:config) { super().merge(config_override) } @@ -428,7 +423,6 @@ describe LogStash::Plugin do end end end - end describe "deprecation logger" do diff --git a/logstash-core/spec/logstash/plugins/builtin/pipeline_input_output_spec.rb b/logstash-core/spec/logstash/plugins/builtin/pipeline_input_output_spec.rb index 7adc7a91f..81ecd83d5 100644 --- a/logstash-core/spec/logstash/plugins/builtin/pipeline_input_output_spec.rb +++ b/logstash-core/spec/logstash/plugins/builtin/pipeline_input_output_spec.rb @@ -120,7 +120,6 @@ describe ::LogStash::Plugins::Builtin::Pipeline do )[:filter] expect(event_metrics[:send_to].value).to eq([address]) end - end after(:each) do diff --git a/logstash-core/spec/logstash/plugins/ca_trusted_fingerprint_support_spec.rb b/logstash-core/spec/logstash/plugins/ca_trusted_fingerprint_support_spec.rb index fd40c5cd7..43f76c962 100644 --- a/logstash-core/spec/logstash/plugins/ca_trusted_fingerprint_support_spec.rb +++ b/logstash-core/spec/logstash/plugins/ca_trusted_fingerprint_support_spec.rb @@ -9,7 +9,6 @@ require 'logstash/outputs/base' java_import "org.logstash.util.CATrustedFingerprintTrustStrategy" describe LogStash::Plugins::CATrustedFingerprintSupport do - let(:ca_trusted_fingerprint_support) { described_class } [ @@ -18,9 +17,7 @@ describe LogStash::Plugins::CATrustedFingerprintSupport do LogStash::Codecs::Base, LogStash::Outputs::Base ].each do |base_class| - context "that inherits from `#{base_class}`" do - let(:plugin_base_class) { base_class } subject(:plugin_class) do @@ -39,7 +36,6 @@ describe LogStash::Plugins::CATrustedFingerprintSupport do let(:plugin) { plugin_class.new(options) } context '#initialize' do - shared_examples 'normalizes fingerprints' do context '#ca_trusted_fingerprint' do it "normalizes to an array of capital hex fingerprints" do @@ -109,5 +105,4 @@ describe LogStash::Plugins::CATrustedFingerprintSupport do end end end - end diff --git a/logstash-core/spec/logstash/plugins/event_factory_support_spec.rb b/logstash-core/spec/logstash/plugins/event_factory_support_spec.rb index 07005c576..20cc2e471 100644 --- a/logstash-core/spec/logstash/plugins/event_factory_support_spec.rb +++ b/logstash-core/spec/logstash/plugins/event_factory_support_spec.rb @@ -8,7 +8,6 @@ require 'logstash/codecs/base' require 'logstash/outputs/base' describe LogStash::Plugins::EventFactorySupport do - let(:event_factory_support) { described_class } [ @@ -17,9 +16,7 @@ describe LogStash::Plugins::EventFactorySupport do LogStash::Codecs::Base, LogStash::Outputs::Base ].each do |base_class| - context "that inherits from `#{base_class}`" do - let(:plugin_base_class) { base_class } subject(:plugin_class) do @@ -40,17 +37,14 @@ describe LogStash::Plugins::EventFactorySupport do let(:plugin) { plugin_class.new(options) } shared_examples 'an event factory' do - it 'returns an event' do expect( event_factory.new_event ).to be_a LogStash::Event expect( event = event_factory.new_event('foo' => 'bar') ).to be_a LogStash::Event expect( event.get('foo') ).to eql 'bar' end - end describe 'event_factory' do - subject(:event_factory) { plugin.send(:event_factory) } it_behaves_like 'an event factory' @@ -58,19 +52,15 @@ describe LogStash::Plugins::EventFactorySupport do it 'memoizes the factory instance' do expect( event_factory ).to be plugin.send(:event_factory) end - end describe 'targeted_event_factory (no config :target option)' do - it 'raises an error' do expect { plugin.send(:targeted_event_factory) }.to raise_error(ArgumentError, /target/) end - end describe 'targeted_event_factory' do - subject(:plugin_class) do Class.new(plugin_base_class) do config_name 'sample' @@ -94,7 +84,6 @@ describe LogStash::Plugins::EventFactorySupport do end context 'with target' do - let(:options) { super().merge('target' => '[the][baz]') } it 'returns an event' do @@ -111,11 +100,9 @@ describe LogStash::Plugins::EventFactorySupport do it 'uses a different factory from the basic one' do expect( targeted_event_factory ).not_to be plugin.send(:event_factory) end - end context 'from_json (integration)' do - let(:json) { '[ {"foo": "bar"}, { "baz": { "a": 1 } } ]' } let(:options) { super().merge('target' => 'internal') } @@ -126,11 +113,8 @@ describe LogStash::Plugins::EventFactorySupport do expect( events[0].get('[internal]') ).to eql 'foo' => 'bar' expect( events[1].get('[internal]') ).to eql 'baz' => { 'a' => 1 } end - end end - end end - end diff --git a/logstash-core/spec/logstash/plugins/registry_spec.rb b/logstash-core/spec/logstash/plugins/registry_spec.rb index 659bb4b49..c90f1575b 100644 --- a/logstash-core/spec/logstash/plugins/registry_spec.rb +++ b/logstash-core/spec/logstash/plugins/registry_spec.rb @@ -26,7 +26,6 @@ class LogStash::Inputs::Dummy < LogStash::Inputs::Base def register; end end - class LogStash::Inputs::NewPlugin < LogStash::Inputs::Base config_name "new_plugin" diff --git a/logstash-core/spec/logstash/runner_spec.rb b/logstash-core/spec/logstash/runner_spec.rb index c4454bd80..59c62ebe5 100644 --- a/logstash-core/spec/logstash/runner_spec.rb +++ b/logstash-core/spec/logstash/runner_spec.rb @@ -31,7 +31,6 @@ require_relative "../support/helpers" require_relative "../support/matchers" describe LogStash::Runner do - subject(:runner) { LogStash::Runner } let(:logger) { double("logger") } let(:agent) { double("agent") } @@ -87,7 +86,6 @@ describe LogStash::Runner do subject { LogStash::Runner.new("") } context "when -e is given" do - let(:args) { ["-e", "input {} output {}"] } let(:agent) { double("agent") } @@ -134,7 +132,6 @@ describe LogStash::Runner do context "--auto-reload" do subject { LogStash::Runner.new("") } context "when -e is given" do - let(:args) { ["-r", "-e", "input {} output {}"] } it "should exit immediately" do @@ -212,8 +209,6 @@ describe LogStash::Runner do expect(settings.get("path.queue")).to eq(queue_override_path) end - - args = ["--path.data", test_data_path, "-e", pipeline_string] subject.run("bin/logstash", args) end diff --git a/logstash-core/spec/logstash/settings/bytes_spec.rb b/logstash-core/spec/logstash/settings/bytes_spec.rb index 3095736b3..241215db6 100644 --- a/logstash-core/spec/logstash/settings/bytes_spec.rb +++ b/logstash-core/spec/logstash/settings/bytes_spec.rb @@ -37,7 +37,6 @@ describe LogStash::Setting::Bytes do subject { described_class.new("a byte value", default, false) } describe "#set" do - # Hard-coded test just to make sure at least one known case is working context "when given '10mb'" do it "returns 10485760" do diff --git a/logstash-core/spec/logstash/settings/port_range_spec.rb b/logstash-core/spec/logstash/settings/port_range_spec.rb index a5117378e..367b558ab 100644 --- a/logstash-core/spec/logstash/settings/port_range_spec.rb +++ b/logstash-core/spec/logstash/settings/port_range_spec.rb @@ -19,7 +19,6 @@ require "logstash/settings" require "spec_helper" describe LogStash::Setting::PortRange do - context "When the value is an Integer" do subject { LogStash::Setting::PortRange.new("mynewtest", 9000) } @@ -65,7 +64,6 @@ describe LogStash::Setting::PortRange do expect { subject }.to raise_error end - it "raises an exception on update" do expect { LogStash::Setting::PortRange.new("mynewtest", 10000).set("dsfnsdknfksdnfjksdnfjns") }.to raise_error end @@ -74,12 +72,10 @@ describe LogStash::Setting::PortRange do context "when the value is an unknown type" do subject { LogStash::Setting::PortRange.new("mynewtest", 0.1) } - it "raises an argument error" do expect { subject }.to raise_error end - it "raises an exception on update" do expect { LogStash::Setting::PortRange.new("mynewtest", 10000).set(0.1) }.to raise_error end diff --git a/logstash-core/spec/logstash/settings/setting_with_deprecated_alias_spec.rb b/logstash-core/spec/logstash/settings/setting_with_deprecated_alias_spec.rb index 85dee75f8..9ddd87a78 100644 --- a/logstash-core/spec/logstash/settings/setting_with_deprecated_alias_spec.rb +++ b/logstash-core/spec/logstash/settings/setting_with_deprecated_alias_spec.rb @@ -19,7 +19,6 @@ require "spec_helper" require "logstash/settings" describe LogStash::Setting::SettingWithDeprecatedAlias do - let(:canonical_setting_name) { "canonical.setting" } let(:deprecated_setting_name) { "legacy.setting" } @@ -56,7 +55,6 @@ describe LogStash::Setting::SettingWithDeprecatedAlias do end context "when only the deprecated alias is set" do - let(:value) { "crusty_value" } before(:each) do @@ -78,7 +76,6 @@ describe LogStash::Setting::SettingWithDeprecatedAlias do end context 'using a boolean setting' do - let(:value) { true } let(:default_value) { false } @@ -93,7 +90,6 @@ describe LogStash::Setting::SettingWithDeprecatedAlias do it 'validates deprecated alias' do expect { settings.get_setting(canonical_setting_name).deprecated_alias.validate_value }.to_not raise_error end - end end diff --git a/logstash-core/spec/logstash/settings/writable_directory_spec.rb b/logstash-core/spec/logstash/settings/writable_directory_spec.rb index ca2ada2af..413465449 100644 --- a/logstash-core/spec/logstash/settings/writable_directory_spec.rb +++ b/logstash-core/spec/logstash/settings/writable_directory_spec.rb @@ -48,7 +48,6 @@ describe LogStash::Setting::WritableDirectory do before { subject.set(path) } context "when the directory is missing" do - context "and the parent is writable" do after { Dir.unlink(path) @@ -104,7 +103,6 @@ describe LogStash::Setting::WritableDirectory do it_behaves_like "failure" end unless LogStash::Environment.windows? - context "but is a symlink" do before { FileUtils.symlink("whatever", path) } it_behaves_like "failure" diff --git a/logstash-core/spec/logstash/settings_spec.rb b/logstash-core/spec/logstash/settings_spec.rb index b3962322f..ce29817cb 100644 --- a/logstash-core/spec/logstash/settings_spec.rb +++ b/logstash-core/spec/logstash/settings_spec.rb @@ -21,7 +21,6 @@ require "logstash/settings" require "fileutils" describe LogStash::Settings do - let(:numeric_setting_name) { "number" } let(:numeric_setting) { LogStash::Setting.new(numeric_setting_name, Numeric, 1) } @@ -186,7 +185,6 @@ describe LogStash::Settings do end describe "#from_yaml" do - before :each do LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "../../src/test/resources/logstash.keystore.with.default.pass")) LogStash::Util::SubstitutionVariables.send(:reset_secret_store) @@ -197,8 +195,6 @@ describe LogStash::Settings do end context "placeholders in flat logstash.yml" do - - after do ENV.delete('SOME_LOGSTASH_SPEC_ENV_VAR') ENV.delete('some.logstash.spec.env.var') @@ -251,7 +247,6 @@ describe LogStash::Settings do } } context "when running PasswordValidator coerce" do - it "raises an error when supplied value is not LogStash::Util::Password" do expect { LogStash::Setting::ValidatedPassword.new("test.validated.password", "testPassword", password_policies) @@ -273,7 +268,6 @@ describe LogStash::Settings do end context "placeholders in nested logstash.yml" do - before :each do LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "../../src/test/resources/logstash.keystore.with.default.pass")) LogStash::Util::SubstitutionVariables.send(:reset_secret_store) diff --git a/logstash-core/spec/logstash/shutdown_watcher_spec.rb b/logstash-core/spec/logstash/shutdown_watcher_spec.rb index 00182ea5c..1526126ea 100644 --- a/logstash-core/spec/logstash/shutdown_watcher_spec.rb +++ b/logstash-core/spec/logstash/shutdown_watcher_spec.rb @@ -41,7 +41,6 @@ describe LogStash::ShutdownWatcher do end describe ".unsafe_shutdown = false" do - before :each do subject.class.unsafe_shutdown = false end @@ -64,7 +63,6 @@ describe LogStash::ShutdownWatcher do end describe ".unsafe_shutdown = true" do - before :each do subject.class.unsafe_shutdown = true end @@ -79,7 +77,6 @@ describe LogStash::ShutdownWatcher do end describe ".unsafe_shutdown = false" do - before :each do subject.class.unsafe_shutdown = false end diff --git a/logstash-core/spec/logstash/state_resolver_spec.rb b/logstash-core/spec/logstash/state_resolver_spec.rb index e99ccab87..3c2ffc4b7 100644 --- a/logstash-core/spec/logstash/state_resolver_spec.rb +++ b/logstash-core/spec/logstash/state_resolver_spec.rb @@ -210,6 +210,5 @@ describe LogStash::StateResolver do end end end - end end diff --git a/logstash-core/spec/logstash/util/accessors_spec.rb b/logstash-core/spec/logstash/util/accessors_spec.rb index fe61fcd9a..61aedaabb 100644 --- a/logstash-core/spec/logstash/util/accessors_spec.rb +++ b/logstash-core/spec/logstash/util/accessors_spec.rb @@ -28,9 +28,7 @@ rescue LoadError end describe "LogStash::Util::Accessors", :if => class_exists do - context "using simple field" do - it "should get value of word key" do str = "hello" data = { "hello" => "world" } @@ -89,7 +87,6 @@ describe "LogStash::Util::Accessors", :if => class_exists do end context "using field path" do - it "should get shallow string value of word key" do str = "[hello]" data = { "hello" => "world" } diff --git a/logstash-core/spec/logstash/util/buftok_spec.rb b/logstash-core/spec/logstash/util/buftok_spec.rb index a7116046a..cccb9c476 100644 --- a/logstash-core/spec/logstash/util/buftok_spec.rb +++ b/logstash-core/spec/logstash/util/buftok_spec.rb @@ -18,7 +18,6 @@ require "spec_helper" describe FileWatch::BufferedTokenizer do - subject { FileWatch::BufferedTokenizer.new } it "should tokenize a single token" do @@ -45,7 +44,6 @@ describe FileWatch::BufferedTokenizer do end context 'with delimiter' do - subject { FileWatch::BufferedTokenizer.new(delimiter) } let(:delimiter) { "||" } @@ -58,7 +56,5 @@ describe FileWatch::BufferedTokenizer do expect(subject.extract("")).to eq([]) expect(subject.extract("foo||bar")).to eq(["foo"]) end - end - end diff --git a/logstash-core/spec/logstash/util/charset_spec.rb b/logstash-core/spec/logstash/util/charset_spec.rb index 061e66534..c4cfe0b0a 100644 --- a/logstash-core/spec/logstash/util/charset_spec.rb +++ b/logstash-core/spec/logstash/util/charset_spec.rb @@ -50,7 +50,6 @@ describe LogStash::Util::Charset do expect(subject.convert(data).encoding.name).to eq("UTF-8") end end - end context "with valid non UTF-8 source encoding" do diff --git a/logstash-core/spec/logstash/util/java_version_spec.rb b/logstash-core/spec/logstash/util/java_version_spec.rb index a33d502d1..8e835d289 100644 --- a/logstash-core/spec/logstash/util/java_version_spec.rb +++ b/logstash-core/spec/logstash/util/java_version_spec.rb @@ -84,7 +84,6 @@ describe "LogStash::Util::JavaVersion" do # Not sure this is what is being returned, but it doesn't match the # regex, which is the point expect(mod.parse_java_version("JCL - 20140103_01 based on Oracle 7u51-b11 - ")).to be_nil end @@ -119,5 +118,4 @@ describe "LogStash::Util::JavaVersion" do include_examples("version parsing", "a build", "1.4.0-beta", 1, 4, 0, 0, "beta") include_examples("version parsing", "an update+build", "1.4.0_03-beta", 1, 4, 0, 3, "beta") end - end diff --git a/logstash-core/spec/logstash/util/plugin_version_spec.rb b/logstash-core/spec/logstash/util/plugin_version_spec.rb index 589292d7c..5079dde4f 100644 --- a/logstash-core/spec/logstash/util/plugin_version_spec.rb +++ b/logstash-core/spec/logstash/util/plugin_version_spec.rb @@ -19,11 +19,9 @@ require "spec_helper" require "logstash/util/plugin_version" describe "LogStash::Util::PluginVersion" do - subject { LogStash::Util::PluginVersion } context "#find_version!" do - let(:gem) { "bundler" } it 'raises an PluginNoVersionError if we cant find the plugin in the gem path' do @@ -36,7 +34,6 @@ describe "LogStash::Util::PluginVersion" do end context "with a pre release gem" do - it 'return the version of the gem' do # Gem::Specification.find_by_name return nil if the gem is not activated, as for # example the pre release ones. @@ -44,7 +41,6 @@ describe "LogStash::Util::PluginVersion" do expect { subject.find_version!(gem) }.not_to raise_error end end - end context "#new" do diff --git a/logstash-core/spec/logstash/util/secretstore_spec.rb b/logstash-core/spec/logstash/util/secretstore_spec.rb index 4283297ae..8912d94c1 100644 --- a/logstash-core/spec/logstash/util/secretstore_spec.rb +++ b/logstash-core/spec/logstash/util/secretstore_spec.rb @@ -20,7 +20,6 @@ require "logstash/settings" java_import "org.logstash.secret.store.SecretStoreExt" describe SecretStoreExt do - subject {SecretStoreExt} let(:settings) { LogStash::SETTINGS.clone } diff --git a/logstash-core/spec/logstash/util/time_value_spec.rb b/logstash-core/spec/logstash/util/time_value_spec.rb index 312a91ec6..bd6d6bb81 100644 --- a/logstash-core/spec/logstash/util/time_value_spec.rb +++ b/logstash-core/spec/logstash/util/time_value_spec.rb @@ -26,7 +26,6 @@ RSpec.shared_examples "coercion example" do |value, expected| end end - module LogStash module Util describe TimeValue do it_behaves_like "coercion example", TimeValue.new(100, :hour), TimeValue.new(100, :hour) diff --git a/logstash-core/spec/logstash/util/unicode_trimmer_spec.rb b/logstash-core/spec/logstash/util/unicode_trimmer_spec.rb index 963cc4f2b..77646f4c0 100644 --- a/logstash-core/spec/logstash/util/unicode_trimmer_spec.rb +++ b/logstash-core/spec/logstash/util/unicode_trimmer_spec.rb @@ -1,4 +1,5 @@ # encoding: utf-8 + require "spec_helper" require "logstash/util/unicode_trimmer" require "flores/rspec" diff --git a/logstash-core/spec/logstash/util/wrapped_synchronous_queue_spec.rb b/logstash-core/spec/logstash/util/wrapped_synchronous_queue_spec.rb index f1b21d939..9e6441958 100644 --- a/logstash-core/spec/logstash/util/wrapped_synchronous_queue_spec.rb +++ b/logstash-core/spec/logstash/util/wrapped_synchronous_queue_spec.rb @@ -19,7 +19,6 @@ require "spec_helper" require "logstash/instrument/collector" describe LogStash::WrappedSynchronousQueue do - subject {LogStash::WrappedSynchronousQueue.new(5)} describe "queue clients" do diff --git a/logstash-core/spec/logstash/util_spec.rb b/logstash-core/spec/logstash/util_spec.rb index 9123f3e7f..145686e4c 100644 --- a/logstash-core/spec/logstash/util_spec.rb +++ b/logstash-core/spec/logstash/util_spec.rb @@ -28,7 +28,6 @@ module TestingClassName end describe LogStash::Util do - subject { described_class } context "stringify_keys" do diff --git a/logstash-core/spec/plugin_metadata_spec.rb b/logstash-core/spec/plugin_metadata_spec.rb index 16d66afa5..97205c355 100644 --- a/logstash-core/spec/plugin_metadata_spec.rb +++ b/logstash-core/spec/plugin_metadata_spec.rb @@ -20,7 +20,6 @@ require 'logstash/plugin_metadata' require 'securerandom' describe LogStash::PluginMetadata do - let(:registry) { described_class } before(:each) { registry.reset! } @@ -61,7 +60,6 @@ describe LogStash::PluginMetadata do expect(plugin_registry.set?(:foo)).to be false end end - end describe 'instance' do diff --git a/logstash-core/spec/static/i18n_spec.rb b/logstash-core/spec/static/i18n_spec.rb index 4df6e65f7..b71ca4f4a 100644 --- a/logstash-core/spec/static/i18n_spec.rb +++ b/logstash-core/spec/static/i18n_spec.rb @@ -25,7 +25,6 @@ describe I18n do glob_path = File.join(LogStash::Environment::LOGSTASH_HOME, "logstash-*", "lib", "**", "*.rb") Dir.glob(glob_path).each do |file_name| - context "in file \"#{file_name}\"" do File.foreach(file_name) do |line| next unless (match = line.match(I18N_T_REGEX)) diff --git a/logstash-core/spec/support/mocks_classes.rb b/logstash-core/spec/support/mocks_classes.rb index 251dd63a2..9759dcc25 100644 --- a/logstash-core/spec/support/mocks_classes.rb +++ b/logstash-core/spec/support/mocks_classes.rb @@ -154,7 +154,6 @@ module LogStash end end end - # A Test Source loader will return the same configuration on every fetch call class TestSourceLoader FailedFetch = LogStash::Config::SourceLoader::FailedFetch diff --git a/logstash-core/spec/support/shared_contexts.rb b/logstash-core/spec/support/shared_contexts.rb index c47cc753f..c15f7e740 100644 --- a/logstash-core/spec/support/shared_contexts.rb +++ b/logstash-core/spec/support/shared_contexts.rb @@ -36,7 +36,6 @@ shared_context "execution_context" do end shared_context "api setup" do |settings_overrides={}| - ## # blocks until the condition returns true, or the limit has passed # @return [true] if the condition was met diff --git a/logstash-core/spec/support/shared_examples.rb b/logstash-core/spec/support/shared_examples.rb index c782fba55..edb029c10 100644 --- a/logstash-core/spec/support/shared_examples.rb +++ b/logstash-core/spec/support/shared_examples.rb @@ -60,7 +60,6 @@ shared_examples "metrics commons operations" do expect { subject.gauge(key, "pluto") }.not_to raise_error end - it "raises an exception if the key is an empty string" do expect { subject.gauge("", 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided) end diff --git a/qa/Rakefile b/qa/Rakefile index ffdd10f48..a3f61c5ff 100644 --- a/qa/Rakefile +++ b/qa/Rakefile @@ -28,9 +28,7 @@ task :spec => 'spec:all' task :default => :spec namespace :qa do - namespace :vm do - def user_feedback_string_for(action, platform, machines, options={}) experimental_string = options["experimental"] ? "experimental" : "non experimental" message = "#{action} all #{experimental_string} VM's defined in acceptance/Vagrantfile" diff --git a/qa/acceptance/spec/config_helper.rb b/qa/acceptance/spec/config_helper.rb index 6641d5c9e..1b3a5b95c 100644 --- a/qa/acceptance/spec/config_helper.rb +++ b/qa/acceptance/spec/config_helper.rb @@ -18,7 +18,6 @@ require "json" module SpecsHelper - def self.configure(vagrant_boxes) setup_config = JSON.parse(File.read(File.join(File.dirname(__FILE__), "..", "..", ".vm_ssh_config"))) boxes = vagrant_boxes.inject({}) do |acc, v| diff --git a/qa/acceptance/spec/shared_examples/cli/logstash-plugin/generate.rb b/qa/acceptance/spec/shared_examples/cli/logstash-plugin/generate.rb index f0d254aef..0e6ae6708 100644 --- a/qa/acceptance/spec/shared_examples/cli/logstash-plugin/generate.rb +++ b/qa/acceptance/spec/shared_examples/cli/logstash-plugin/generate.rb @@ -29,7 +29,6 @@ shared_examples "logstash generate" do |logstash| end describe "on #{logstash.hostname}" do - GENERATE_TYPES = ["input", "filter", "codec", "output"] GENERATE_TYPES.each do |type| context "with type #{type}" do diff --git a/qa/acceptance/spec/shared_examples/installed.rb b/qa/acceptance/spec/shared_examples/installed.rb index 70c7e53e9..55a34c5ea 100644 --- a/qa/acceptance/spec/shared_examples/installed.rb +++ b/qa/acceptance/spec/shared_examples/installed.rb @@ -20,7 +20,6 @@ require 'logstash/version' # This test checks if a package is possible to be installed without errors. RSpec.shared_examples "installable" do |logstash| - before(:each) do logstash.uninstall logstash.install({:version => LOGSTASH_VERSION}) diff --git a/qa/acceptance/spec/shared_examples/installed_with_jdk.rb b/qa/acceptance/spec/shared_examples/installed_with_jdk.rb index 7cf01980a..ed790eda8 100644 --- a/qa/acceptance/spec/shared_examples/installed_with_jdk.rb +++ b/qa/acceptance/spec/shared_examples/installed_with_jdk.rb @@ -20,7 +20,6 @@ require 'logstash/version' # This test checks if a package is possible to be installed without errors. RSpec.shared_examples "installable_with_jdk" do |logstash| - before(:all) do #unset to force it using bundled JDK to run LS logstash.run_command("unset LS_JAVA_HOME") diff --git a/qa/acceptance/spec/shared_examples/running.rb b/qa/acceptance/spec/shared_examples/running.rb index f6f0a42fa..9cd9eb22d 100644 --- a/qa/acceptance/spec/shared_examples/running.rb +++ b/qa/acceptance/spec/shared_examples/running.rb @@ -20,7 +20,6 @@ require 'logstash/version' # Test if an installed package can actually be started and runs OK. RSpec.shared_examples "runnable" do |logstash| - before(:each) do logstash.install({:version => LOGSTASH_VERSION}) end diff --git a/qa/acceptance/spec/shared_examples/updated.rb b/qa/acceptance/spec/shared_examples/updated.rb index 96e1fd027..e915aef49 100644 --- a/qa/acceptance/spec/shared_examples/updated.rb +++ b/qa/acceptance/spec/shared_examples/updated.rb @@ -20,7 +20,6 @@ require 'logstash/version' # This test checks if the current package could used to update from the latest version released. RSpec.shared_examples "updated" do |logstash| - before(:all) { #unset to force it using bundled JDK to run LS logstash.run_command("unset LS_JAVA_HOME") diff --git a/qa/acceptance/spec/spec_helper.rb b/qa/acceptance/spec/spec_helper.rb index 20efaa985..71a741279 100644 --- a/qa/acceptance/spec/spec_helper.rb +++ b/qa/acceptance/spec/spec_helper.rb @@ -21,7 +21,6 @@ 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. diff --git a/qa/docker/patches/excon/unix_socket.rb b/qa/docker/patches/excon/unix_socket.rb index 63d973114..a666033dd 100644 --- a/qa/docker/patches/excon/unix_socket.rb +++ b/qa/docker/patches/excon/unix_socket.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Excon class UnixSocket < Excon::Socket private diff --git a/qa/docker/shared_examples/container.rb b/qa/docker/shared_examples/container.rb index 68658755f..c0503eb92 100644 --- a/qa/docker/shared_examples/container.rb +++ b/qa/docker/shared_examples/container.rb @@ -1,5 +1,4 @@ shared_examples_for 'the container is configured correctly' do |flavor| - before do @image = find_image(flavor) @container = create_container(@image, {}) diff --git a/qa/docker/shared_examples/container_config.rb b/qa/docker/shared_examples/container_config.rb index 8b090a20e..08108e5bb 100644 --- a/qa/docker/shared_examples/container_config.rb +++ b/qa/docker/shared_examples/container_config.rb @@ -1,5 +1,4 @@ shared_examples_for 'it runs with different configurations' do |flavor| - before do @image = find_image(flavor) @container = start_container(@image, options) diff --git a/qa/docker/shared_examples/container_options.rb b/qa/docker/shared_examples/container_options.rb index bb9e018a5..1d5108bff 100644 --- a/qa/docker/shared_examples/container_options.rb +++ b/qa/docker/shared_examples/container_options.rb @@ -1,5 +1,4 @@ shared_examples_for 'it applies settings correctly' do |flavor| - before do @image = find_image(flavor) @container = start_container(@image, options) diff --git a/qa/docker/spec/spec_helper.rb b/qa/docker/spec/spec_helper.rb index 7c36edfff..babef10dc 100644 --- a/qa/docker/spec/spec_helper.rb +++ b/qa/docker/spec/spec_helper.rb @@ -157,7 +157,6 @@ def normalized_architecture(cpu) end end - RSpec::Matchers.define :have_correct_license_label do |expected| match do |actual| values_match? license_label_for_flavor(expected), actual diff --git a/qa/integration/fixtures/logstash-dummy-pack/logstash-output-secret.gemspec b/qa/integration/fixtures/logstash-dummy-pack/logstash-output-secret.gemspec index 1bd925aff..ef895343e 100644 --- a/qa/integration/fixtures/logstash-dummy-pack/logstash-output-secret.gemspec +++ b/qa/integration/fixtures/logstash-dummy-pack/logstash-output-secret.gemspec @@ -22,12 +22,10 @@ This plugins will require the configuration of XXXXX in the logstash.yml Make sure you double check your configuration eos - # Gem dependencies s.add_runtime_dependency "manticore" s.add_runtime_dependency "gemoji", "< 2.0" - s.add_development_dependency "paquet" s.add_development_dependency "rake" end diff --git a/qa/integration/fixtures/logstash-dummy-pack/spec/outputs/secret_spec.rb b/qa/integration/fixtures/logstash-dummy-pack/spec/outputs/secret_spec.rb index 512ecc910..0997fb6ed 100644 --- a/qa/integration/fixtures/logstash-dummy-pack/spec/outputs/secret_spec.rb +++ b/qa/integration/fixtures/logstash-dummy-pack/spec/outputs/secret_spec.rb @@ -19,7 +19,6 @@ require "logstash/devutils/rspec/spec_helper" require "logstash/outputs/secret" require "logstash/codecs/plain" - describe LogStash::Outputs::Secret do let(:sample_event) { LogStash::Event.new } let(:output) { LogStash::Outputs::Secret.new } diff --git a/qa/integration/rspec.rb b/qa/integration/rspec.rb index 9da9e2315..247ef9b4c 100644 --- a/qa/integration/rspec.rb +++ b/qa/integration/rspec.rb @@ -33,5 +33,4 @@ require "rspec/core" RSpec.clear_examples - return RSpec::Core::Runner.run($JUNIT_ARGV).to_i diff --git a/qa/integration/specs/beats_input_spec.rb b/qa/integration/specs/beats_input_spec.rb index d87e2c248..be6ecf967 100644 --- a/qa/integration/specs/beats_input_spec.rb +++ b/qa/integration/specs/beats_input_spec.rb @@ -59,7 +59,6 @@ describe "Beat Input" do file.path end - it "successfully send events" do logstash_service.start_background(logstash_config) process = filebeat_service.run(filebeat_config_path) diff --git a/qa/integration/specs/cli/install_spec.rb b/qa/integration/specs/cli/install_spec.rb index 06ba4d42e..2dce0ba05 100644 --- a/qa/integration/specs/cli/install_spec.rb +++ b/qa/integration/specs/cli/install_spec.rb @@ -30,7 +30,6 @@ def gem_in_lock_file?(pattern, lock_file) end describe "CLI > logstash-plugin install" do - before(:all) do @fixture = Fixture.new(__FILE__) @logstash = @fixture.get_service("logstash") @@ -46,7 +45,6 @@ describe "CLI > logstash-plugin install" do # When you are on anything by linux we won't disable the internet with seccomp if RbConfig::CONFIG["host_os"] == "linux" context "without internet connection (linux seccomp wrapper)" do - let(:offline_wrapper_path) { File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "fixtures", "offline_wrapper")) } before do @@ -149,7 +147,6 @@ describe "CLI > logstash-plugin install" do installed = @logstash_plugin.list(plugin_name) expect(installed.stderr_and_stdout).to match(/#{plugin_name}/) end - end end end diff --git a/qa/integration/specs/cli/keystore_spec.rb b/qa/integration/specs/cli/keystore_spec.rb index 714d93b5d..aca64285e 100644 --- a/qa/integration/specs/cli/keystore_spec.rb +++ b/qa/integration/specs/cli/keystore_spec.rb @@ -25,7 +25,6 @@ require "fileutils" require "open3" describe "CLI > logstash-keystore" do - before(:all) do @fixture = Fixture.new(__FILE__) @logstash = @fixture.get_service("logstash") @@ -36,7 +35,6 @@ describe "CLI > logstash-keystore" do end context 'create' do - before do FileUtils.rm_f File.join(@logstash.logstash_home, 'config', 'logstash.keystore') end @@ -50,11 +48,9 @@ describe "CLI > logstash-keystore" do expect(keystore_list.stderr_and_stdout).to_not match(/ERROR/) expect(keystore_list.stderr_and_stdout).to include('Created Logstash keystore') end - end context 'list' do - before do keystore = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "fixtures", "logstash.keystore")) FileUtils.cp keystore, File.join(@logstash.logstash_home, 'config') @@ -69,7 +65,5 @@ describe "CLI > logstash-keystore" do expect(keystore_list.stderr_and_stdout).to_not match(/ERROR/) expect(keystore_list.stderr_and_stdout).to include('foo') # contains foo: bar end - end - end diff --git a/qa/integration/specs/cli/prepare_offline_pack_spec.rb b/qa/integration/specs/cli/prepare_offline_pack_spec.rb index d675645e1..22e5b4232 100644 --- a/qa/integration/specs/cli/prepare_offline_pack_spec.rb +++ b/qa/integration/specs/cli/prepare_offline_pack_spec.rb @@ -54,7 +54,6 @@ describe "CLI > logstash-plugin prepare-offline-pack" do context "creating a pack for integration plugins" do let(:plugin_to_pack) { "logstash-integration-jdbc" } - it "successfully create a pack" do execute = @logstash_plugin.prepare_offline_pack(plugin_to_pack, temporary_zip_file) @@ -70,7 +69,6 @@ describe "CLI > logstash-plugin prepare-offline-pack" do end end - context "create a pack from a wildcard" do let(:plugins_to_pack) { %w(logstash-filter-*) } diff --git a/qa/integration/specs/cli/remove_spec.rb b/qa/integration/specs/cli/remove_spec.rb index 351d3dbea..91aba8cf7 100644 --- a/qa/integration/specs/cli/remove_spec.rb +++ b/qa/integration/specs/cli/remove_spec.rb @@ -29,7 +29,6 @@ describe "CLI > logstash-plugin remove" do if RbConfig::CONFIG["host_os"] == "linux" context "without internet connection (linux seccomp wrapper)" do - let(:offline_wrapper_path) { File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "fixtures", "offline_wrapper")) } let(:offline_wrapper_cmd) { File.join(offline_wrapper_path, "offline") } @@ -74,7 +73,6 @@ describe "CLI > logstash-plugin remove" do expect(presence_check.stderr_and_stdout).to match(/logstash-codec-json/) end end - end else context "when no other plugins depends on this plugin" do diff --git a/qa/integration/specs/command_line_spec.rb b/qa/integration/specs/command_line_spec.rb index 87d96cc1e..5e5aa9b8b 100644 --- a/qa/integration/specs/command_line_spec.rb +++ b/qa/integration/specs/command_line_spec.rb @@ -20,7 +20,6 @@ require_relative "../framework/settings" require_relative "../framework/helpers" describe "CLI >" do - before(:all) do @fixture = Fixture.new(__FILE__) @logstash = @fixture.get_service("logstash") diff --git a/qa/integration/specs/dlq_spec.rb b/qa/integration/specs/dlq_spec.rb index adae9b869..2bacfd924 100644 --- a/qa/integration/specs/dlq_spec.rb +++ b/qa/integration/specs/dlq_spec.rb @@ -24,7 +24,6 @@ require_relative 'spec_helper.rb' require "logstash/devutils/rspec/spec_helper" describe "Test Dead Letter Queue" do - # template with an ip field let(:template) { { "index_patterns": ["te*"], "mappings": { "properties": { "ip": { "type": "ip" }}}} } # a message that is incompatible with the template @@ -47,7 +46,6 @@ describe "Test Dead Letter Queue" do es_client.perform_request("PUT", "_template/ip-template", {}, template) } - after(:each) do logstash_service.teardown end diff --git a/qa/integration/specs/es_output_how_spec.rb b/qa/integration/specs/es_output_how_spec.rb index d0fb054d2..8b42ce0b6 100644 --- a/qa/integration/specs/es_output_how_spec.rb +++ b/qa/integration/specs/es_output_how_spec.rb @@ -21,7 +21,6 @@ require_relative '../services/logstash_service' require_relative 'spec_helper.rb' describe "Test Elasticsearch output" do - before(:all) { @fixture = Fixture.new(__FILE__) es_allow_wildcard_deletes(@fixture.get_service("elasticsearch").get_client) diff --git a/qa/integration/specs/fatal_error_spec.rb b/qa/integration/specs/fatal_error_spec.rb index 2ba0ccad8..680a644b3 100644 --- a/qa/integration/specs/fatal_error_spec.rb +++ b/qa/integration/specs/fatal_error_spec.rb @@ -22,7 +22,6 @@ require_relative '../services/logstash_service' require "logstash/devutils/rspec/spec_helper" describe "uncaught exception" do - before(:all) do @fixture = Fixture.new(__FILE__) @logstash = @fixture.get_service("logstash") @@ -82,5 +81,4 @@ describe "uncaught exception" do end raise 'LS process did not exit!' unless @logstash.exited? end - end diff --git a/qa/integration/specs/install_java_plugin_spec.rb b/qa/integration/specs/install_java_plugin_spec.rb index 03f4d5bcf..144728093 100644 --- a/qa/integration/specs/install_java_plugin_spec.rb +++ b/qa/integration/specs/install_java_plugin_spec.rb @@ -22,7 +22,6 @@ require "logstash/devutils/rspec/spec_helper" require "stud/temporary" describe "Install and run java plugin" do - before(:all) do @fixture = Fixture.new(__FILE__) @logstash = @fixture.get_service("logstash") @@ -75,6 +74,5 @@ describe "Install and run java plugin" do result = @logstash.monitoring_api.event_stats expect(result["in"]).to eq(4) end - end end diff --git a/qa/integration/specs/java_api_spec.rb b/qa/integration/specs/java_api_spec.rb index ff21afccd..8152e8959 100644 --- a/qa/integration/specs/java_api_spec.rb +++ b/qa/integration/specs/java_api_spec.rb @@ -45,7 +45,6 @@ describe "Java plugin API" do let!(:settings_dir) { Stud::Temporary.directory } it "successfully sends events through Java plugins" do - @logstash.start_background_with_config_settings(config_to_temp_file(@fixture.config), settings_dir) # wait for Logstash to start diff --git a/qa/integration/specs/monitoring_api_spec.rb b/qa/integration/specs/monitoring_api_spec.rb index 71bb5be6c..33856ad31 100644 --- a/qa/integration/specs/monitoring_api_spec.rb +++ b/qa/integration/specs/monitoring_api_spec.rb @@ -343,5 +343,4 @@ describe "Test Monitoring API" do def logging_put_assert(result) expect(result['acknowledged']).to be(true), "result not acknowledged, got: #{result.inspect}" end - end diff --git a/qa/integration/specs/multiple_pipeline_spec.rb b/qa/integration/specs/multiple_pipeline_spec.rb index ce519ae21..314963366 100644 --- a/qa/integration/specs/multiple_pipeline_spec.rb +++ b/qa/integration/specs/multiple_pipeline_spec.rb @@ -105,7 +105,6 @@ describe "Test Logstash service when multiple pipelines are used" do end context 'readable pipelines.yml with invalid YAML contents' do - let!(:pipelines_yaml) do <<~EOYAML - pipeline.id: my_id diff --git a/qa/integration/specs/reload_config_spec.rb b/qa/integration/specs/reload_config_spec.rb index b210def0b..86c59ac03 100644 --- a/qa/integration/specs/reload_config_spec.rb +++ b/qa/integration/specs/reload_config_spec.rb @@ -25,7 +25,6 @@ require "json" require "logstash/util" describe "Test Logstash service when config reload is enabled" do - define_negated_matcher :exclude, :include before(:all) { diff --git a/qa/integration/specs/reserved_tags_field_spec.rb b/qa/integration/specs/reserved_tags_field_spec.rb index 999ecf141..a9e99d95e 100644 --- a/qa/integration/specs/reserved_tags_field_spec.rb +++ b/qa/integration/specs/reserved_tags_field_spec.rb @@ -48,7 +48,6 @@ describe "Guard reserved tags field against incorrect use" do } let(:settings_dir) { Stud::Temporary.directory } - shared_examples_for 'assign illegal value to tags' do |mode, pipeline_fixture, tags_match, fail_tags_match| it "[#{mode}] update tags and _tags successfully" do @logstash.env_variables = test_env diff --git a/qa/rspec/commands.rb b/qa/rspec/commands.rb index c2eaa6367..adfc41f66 100644 --- a/qa/rspec/commands.rb +++ b/qa/rspec/commands.rb @@ -26,7 +26,6 @@ require_relative "./commands/suse/sles-11" require "forwardable" module ServiceTester - # An artifact is the component being tested, it's able to interact with # a destination machine by holding a client and is basically provides all # necessary abstractions to make the test simple. diff --git a/qa/rspec/commands/base.rb b/qa/rspec/commands/base.rb index 4759f01ef..781ddc050 100644 --- a/qa/rspec/commands/base.rb +++ b/qa/rspec/commands/base.rb @@ -20,7 +20,6 @@ require_relative "../../vagrant/helpers" require_relative "system_helpers" module ServiceTester - class InstallException < Exception; end class Base diff --git a/qa/rspec/helpers.rb b/qa/rspec/helpers.rb index 3a457bc77..0aa52c6ee 100644 --- a/qa/rspec/helpers.rb +++ b/qa/rspec/helpers.rb @@ -18,9 +18,9 @@ require_relative "commands" module ServiceTester - class Configuration attr_accessor :servers, :lookup + def initialize @servers = [] @lookup = {} diff --git a/rakelib/artifacts.rake b/rakelib/artifacts.rake index ecf3ccb6b..237cae90e 100644 --- a/rakelib/artifacts.rake +++ b/rakelib/artifacts.rake @@ -16,7 +16,6 @@ # under the License. namespace "artifact" do - SNAPSHOT_BUILD = ENV["RELEASE"] != "1" VERSION_QUALIFIER = ENV["VERSION_QUALIFIER"] if VERSION_QUALIFIER @@ -183,7 +182,6 @@ namespace "artifact" do safe_system("./gradlew deleteLocalJdk") if bundle_jdk end - desc "Build a not JDK bundled tar.gz of default logstash plugins with all dependencies" task "no_bundle_jdk_tar" => ["prepare", "generate_build_metadata"] do create_local_archive_pack(false) @@ -241,7 +239,6 @@ namespace "artifact" do package("centos", :oss) end - desc "Build a DEB of logstash with all dependencies" task "deb" => ["prepare", "generate_build_metadata"] do #with bundled JDKs @@ -457,7 +454,6 @@ namespace "artifact" do end end - def build_tar(license, tar_suffix = nil, exclude_paths=default_exclude_paths, platform: '') require "zlib" require 'rubygems' @@ -487,7 +483,6 @@ namespace "artifact" do gz.close end - def write_to_tar(tar, path, path_in_tar) stat = File.lstat(path) if stat.directory? @@ -556,7 +551,6 @@ namespace "artifact" do metadata_source_file_path = BUILD_METADATA_FILE.path dir.input("#{metadata_source_file_path}=/usr/share/logstash/#{metadata_file_path}") - suffix = "" if oss suffix= "-oss" diff --git a/rakelib/default_plugins.rb b/rakelib/default_plugins.rb index 08d10e7e9..2ca0364d1 100644 --- a/rakelib/default_plugins.rb +++ b/rakelib/default_plugins.rb @@ -17,7 +17,6 @@ module LogStash module RakeLib - # @return [Array] list of all plugin names as defined in the logstash-plugins github organization, minus names that matches the ALL_PLUGINS_SKIP_LIST def self.fetch_all_plugins require 'octokit' diff --git a/rakelib/lint.rake b/rakelib/lint.rake index b21351948..c3aa4df45 100644 --- a/rakelib/lint.rake +++ b/rakelib/lint.rake @@ -16,7 +16,6 @@ # under the License. namespace "lint" do - module RuboCLI def self.run!(*args) require "rubocop" diff --git a/rakelib/modules.rake b/rakelib/modules.rake index adf00ad9b..6b292fd9c 100644 --- a/rakelib/modules.rake +++ b/rakelib/modules.rake @@ -16,7 +16,6 @@ # under the License. namespace "modules" do - def unpacker(src_file, dest_dir) puts "Reading #{src_file}" array = JSON.parse(IO.read(src_file)) diff --git a/rakelib/plugin.rake b/rakelib/plugin.rake index fc7f025b4..d52c0eb98 100644 --- a/rakelib/plugin.rake +++ b/rakelib/plugin.rake @@ -19,7 +19,6 @@ require_relative "default_plugins" require 'rubygems' namespace "plugin" do - def install_plugins(*args) require_relative "../lib/pluginmanager/main" LogStash::PluginManager::Main.run("bin/logstash-plugin", ["install"] + args) @@ -105,5 +104,4 @@ namespace "plugin" do task.reenable # Allow this task to be run again end - end # namespace "plugin" diff --git a/rakelib/plugins_docs_dependencies.rake b/rakelib/plugins_docs_dependencies.rake index 6aa6f4513..5b1a6211f 100644 --- a/rakelib/plugins_docs_dependencies.rake +++ b/rakelib/plugins_docs_dependencies.rake @@ -79,7 +79,6 @@ class PluginVersionWorking end end - # We us a brute force strategy to get the highest version possible for all the community plugins. # We take each plugin and we add it to the current dependencies and we try to resolve the tree, if it work we # record the version installed. diff --git a/rakelib/test.rake b/rakelib/test.rake index 2ba4c9f12..8795c29e5 100644 --- a/rakelib/test.rake +++ b/rakelib/test.rake @@ -21,7 +21,6 @@ require 'pathname' namespace "test" do - desc "run the java unit tests" task "core-java" do exit(1) unless system('./gradlew clean javaTests') diff --git a/rakelib/version.rake b/rakelib/version.rake index 8734112ad..72de1af05 100644 --- a/rakelib/version.rake +++ b/rakelib/version.rake @@ -121,5 +121,4 @@ namespace :version do abort("Invalid version argument: \"#{args[:version]}\". Aborting...") end end - end diff --git a/spec/compliance/license_spec.rb b/spec/compliance/license_spec.rb index 7d32e9693..1d94a6a9f 100644 --- a/spec/compliance/license_spec.rb +++ b/spec/compliance/license_spec.rb @@ -19,7 +19,6 @@ require 'spec_helper' require_relative '../../rakelib/default_plugins' describe "Project licenses" do - let(:expected_licenses) { ## # Expected licenses are Apache License 2.0, BSD license, MIT license and the ruby one, @@ -54,7 +53,6 @@ describe "Project licenses" do end shared_examples "runtime license test" do - subject(:gem_name) do |example| example.metadata[:example_group][:parent_example_group][:description] end @@ -89,5 +87,4 @@ describe "Project licenses" do it_behaves_like "runtime license test" end end - end diff --git a/spec/support/pack/valid-pack/logstash/valid-pack/dependencies/logstash-input-packtestdep.gemspec b/spec/support/pack/valid-pack/logstash/valid-pack/dependencies/logstash-input-packtestdep.gemspec index c0d175e51..ea563bd0b 100644 --- a/spec/support/pack/valid-pack/logstash/valid-pack/dependencies/logstash-input-packtestdep.gemspec +++ b/spec/support/pack/valid-pack/logstash/valid-pack/dependencies/logstash-input-packtestdep.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + Gem::Specification.new do |spec| spec.name = "logstash-input-packtestdep" spec.version = "0.0.1" diff --git a/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest.gemspec b/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest.gemspec index 49d8922c0..4a9ab0b4d 100644 --- a/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest.gemspec +++ b/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + Gem::Specification.new do |spec| spec.name = "logstash-input-packtest" spec.version = "0.0.1" diff --git a/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest_pim.gemspec b/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest_pim.gemspec index fbb1c92cb..dd65d8831 100644 --- a/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest_pim.gemspec +++ b/spec/support/pack/valid-pack/logstash/valid-pack/logstash-input-packtest_pim.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + Gem::Specification.new do |spec| spec.name = "logstash-input-packtest_pim" spec.version = "0.0.1" diff --git a/spec/support/resource_dsl_methods.rb b/spec/support/resource_dsl_methods.rb index 939289e26..4ffec5c6f 100644 --- a/spec/support/resource_dsl_methods.rb +++ b/spec/support/resource_dsl_methods.rb @@ -18,9 +18,11 @@ # Ruby doesn't have common class for boolean, # And to simplify the ResourceDSLMethods check it make sense to have it. module Boolean; end + class TrueClass include Boolean end + class FalseClass include Boolean end @@ -51,7 +53,6 @@ module ResourceDSLMethods expect(last_response).to be_ok end - describe "the default metadata" do it "should include the host" do expect(payload["host"]).to eql(Socket.gethostname) diff --git a/spec/unit/plugin_manager/gemfile_spec.rb b/spec/unit/plugin_manager/gemfile_spec.rb index 26e946be1..e2b76cda7 100644 --- a/spec/unit/plugin_manager/gemfile_spec.rb +++ b/spec/unit/plugin_manager/gemfile_spec.rb @@ -19,11 +19,8 @@ require "spec_helper" require "pluginmanager/gemfile" describe "logstash Gemfile Manager" do - context LogStash::Gemfile do - context "load" do - it "should load and return self" do file = <<-END source "https://rubygems.org" @@ -184,7 +181,6 @@ describe "logstash Gemfile Manager" do end context "keep a backup of the original file" do - end end diff --git a/spec/unit/plugin_manager/install_spec.rb b/spec/unit/plugin_manager/install_spec.rb index cf1730640..23acae1ce 100644 --- a/spec/unit/plugin_manager/install_spec.rb +++ b/spec/unit/plugin_manager/install_spec.rb @@ -42,7 +42,6 @@ describe LogStash::PluginManager::Install do end context "when installs alias plugin" do - before(:each) do # mocked to avoid validation of options expect(cmd).to receive(:validate_cli_options!).and_return(nil) diff --git a/spec/unit/plugin_manager/prepare_offline_pack_spec.rb b/spec/unit/plugin_manager/prepare_offline_pack_spec.rb index e4f02f45e..a26bc30f0 100644 --- a/spec/unit/plugin_manager/prepare_offline_pack_spec.rb +++ b/spec/unit/plugin_manager/prepare_offline_pack_spec.rb @@ -86,7 +86,6 @@ describe LogStash::PluginManager::PrepareOfflinePack do end end - context "if the output is directory" do let(:tmp_zip_file) { f = Stud::Temporary.pathname; FileUtils.mkdir_p(f); f } let(:cmd) { "prepare-offline-pack" } diff --git a/spec/unit/plugin_manager/proxy_support_spec.rb b/spec/unit/plugin_manager/proxy_support_spec.rb index 9c2beb995..4345b9160 100644 --- a/spec/unit/plugin_manager/proxy_support_spec.rb +++ b/spec/unit/plugin_manager/proxy_support_spec.rb @@ -139,7 +139,6 @@ describe "Proxy support" do } } - it "doesn't raise an exception" do expect { configure_proxy }.not_to raise_exception end @@ -153,7 +152,6 @@ describe "Proxy support" do } } - it "raises an exception" do expect { configure_proxy }.to raise_error(RuntimeError) end diff --git a/spec/unit/plugin_manager/util_spec.rb b/spec/unit/plugin_manager/util_spec.rb index 57428cbc6..38dece461 100644 --- a/spec/unit/plugin_manager/util_spec.rb +++ b/spec/unit/plugin_manager/util_spec.rb @@ -20,7 +20,6 @@ require 'pluginmanager/util' require 'gems' describe LogStash::PluginManager do - describe "fetching plugin information" do let(:plugin_name) { "logstash-output-elasticsearch" } @@ -49,7 +48,6 @@ describe LogStash::PluginManager do expect(version_info["number"]).to eq("1.0.7") end - it "should search for the last version information with prerelease" do version_info = LogStash::PluginManager.fetch_latest_version_info(plugin_name, :pre => true) expect(version_info["number"]).to eq("2.0.0.pre") diff --git a/spec/unit/util/compress_spec.rb b/spec/unit/util/compress_spec.rb index 98b031037..d7a59faa9 100644 --- a/spec/unit/util/compress_spec.rb +++ b/spec/unit/util/compress_spec.rb @@ -54,11 +54,9 @@ def list_files(target) end describe LogStash::Util::Zip do - subject { Class.new { extend LogStash::Util::Zip } } context "#extraction" do - let(:source) { File.join(File.expand_path("."), "source_file.zip") } let(:target) { File.expand_path("target_dir") } @@ -151,7 +149,6 @@ describe LogStash::Util::Zip do end describe LogStash::Util::Tar do - subject { Class.new { extend LogStash::Util::Tar } } context "#extraction" do @@ -183,7 +180,6 @@ describe LogStash::Util::Tar do end context "#compression" do - let(:target) { File.join(File.expand_path("."), "target_file.tar.gz") } let(:source) { File.expand_path("source_dir") } diff --git a/tools/logstash-docgen/lib/logstash/docgen/asciidoc_format.rb b/tools/logstash-docgen/lib/logstash/docgen/asciidoc_format.rb index 355790070..465aa0b1f 100644 --- a/tools/logstash-docgen/lib/logstash/docgen/asciidoc_format.rb +++ b/tools/logstash-docgen/lib/logstash/docgen/asciidoc_format.rb @@ -28,7 +28,6 @@ module LogStash module Docgen /%PLUGIN%/ => :config_name } - def initialize(options = {}) @options = options @template = read_template(TEMPLATE_FILE) diff --git a/tools/logstash-docgen/lib/logstash/docgen/github_generator.rb b/tools/logstash-docgen/lib/logstash/docgen/github_generator.rb index 80841c97b..6acab4241 100644 --- a/tools/logstash-docgen/lib/logstash/docgen/github_generator.rb +++ b/tools/logstash-docgen/lib/logstash/docgen/github_generator.rb @@ -132,7 +132,6 @@ module LogStash module Docgen end end - # This class orchestrate all the operation between the `logstash-plugins` organization and the # doc build for each plugin. class DocumentationGenerator diff --git a/tools/logstash-docgen/lib/logstash/docgen/plugin_doc.rb b/tools/logstash-docgen/lib/logstash/docgen/plugin_doc.rb index 71ac86a83..13ae227b9 100644 --- a/tools/logstash-docgen/lib/logstash/docgen/plugin_doc.rb +++ b/tools/logstash-docgen/lib/logstash/docgen/plugin_doc.rb @@ -32,7 +32,6 @@ end task :doc => "doc:html" - def generate_preview(options = {}) LogStash::Docgen.generate_for_plugin(Dir.pwd, options).output end diff --git a/tools/logstash-docgen/logstash-docgen.gemspec b/tools/logstash-docgen/logstash-docgen.gemspec index 91d6b6931..a93f2e4b5 100644 --- a/tools/logstash-docgen/logstash-docgen.gemspec +++ b/tools/logstash-docgen/logstash-docgen.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "logstash/docgen/version" diff --git a/tools/logstash-docgen/spec/logstash/docgen/task_runner_spec.rb b/tools/logstash-docgen/spec/logstash/docgen/task_runner_spec.rb index f14c28ac8..32e88bfd0 100644 --- a/tools/logstash-docgen/spec/logstash/docgen/task_runner_spec.rb +++ b/tools/logstash-docgen/spec/logstash/docgen/task_runner_spec.rb @@ -125,7 +125,6 @@ describe LogStash::Docgen::TaskRunner do expect(output).to match(/FAILURE: #{name}/) expect(output).to match(/Exception:/) - expect(output).to match(/FAILURE: not_working_bob/) end end diff --git a/tools/logstash-docgen/spec/logstash/docgen/util_spec.rb b/tools/logstash-docgen/spec/logstash/docgen/util_spec.rb index 5c3765fa3..622c93155 100644 --- a/tools/logstash-docgen/spec/logstash/docgen/util_spec.rb +++ b/tools/logstash-docgen/spec/logstash/docgen/util_spec.rb @@ -23,7 +23,6 @@ describe LogStash::Docgen::Util do context "time_execution" do it "prints the execution time to stdout" do - output = capture do subject.time_execution do sleep(0.1) diff --git a/tools/paquet/lib/paquet/shell_ui.rb b/tools/paquet/lib/paquet/shell_ui.rb index e44290caa..ed534e38d 100644 --- a/tools/paquet/lib/paquet/shell_ui.rb +++ b/tools/paquet/lib/paquet/shell_ui.rb @@ -20,6 +20,7 @@ module Paquet class << self def debug(message) end + def info(message) end end diff --git a/tools/paquet/paquet.gemspec b/tools/paquet/paquet.gemspec index b195778d0..d9172971d 100644 --- a/tools/paquet/paquet.gemspec +++ b/tools/paquet/paquet.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'paquet/version' @@ -14,7 +15,6 @@ Gem::Specification.new do |spec| spec.description = %q{This gem add a few rake tasks to create a uber gems that will be shipped as a zip} spec.homepage = "https://github.com/elastic/logstash" - spec.files = Dir.glob(File.join(File.dirname(__FILE__), "lib", "**", "*.rb")) spec.bindir = "exe" diff --git a/tools/release/generate_release_notes.rb b/tools/release/generate_release_notes.rb index 345a65a6a..a6cb1f573 100755 --- a/tools/release/generate_release_notes.rb +++ b/tools/release/generate_release_notes.rb @@ -120,7 +120,6 @@ branch_name = "update_release_notes_#{Time.now.to_i}" `git checkout -b #{branch_name}` `git commit docs/static/releasenotes.asciidoc -m "Update release notes for #{current_release}"` - puts "Pushing commit.." `git remote set-url origin https://x-access-token:#{token}@github.com/elastic/logstash.git` `git push origin #{branch_name}` diff --git a/x-pack/lib/config_management/bootstrap_check.rb b/x-pack/lib/config_management/bootstrap_check.rb index 1729873e0..780c28ec6 100644 --- a/x-pack/lib/config_management/bootstrap_check.rb +++ b/x-pack/lib/config_management/bootstrap_check.rb @@ -39,7 +39,6 @@ module LogStash settings.set("config.reload.automatic", true) settings.set("config.reload.interval", interval) - pipeline_ids = settings.get("xpack.management.pipeline.id") if pipeline_ids.reject { |id| id.strip.empty? }.empty? @@ -59,7 +58,6 @@ module LogStash logger.info("Using Elasticsearch as config store", :pipeline_id => pipeline_ids, :poll_interval => "#{interval}ns") end - def self.check_path_config(settings) path_config = settings.get("path.config") return if (path_config.nil? || path_config.empty?) diff --git a/x-pack/lib/config_management/elasticsearch_source.rb b/x-pack/lib/config_management/elasticsearch_source.rb index f3fe2c222..0320a996e 100644 --- a/x-pack/lib/config_management/elasticsearch_source.rb +++ b/x-pack/lib/config_management/elasticsearch_source.rb @@ -10,7 +10,6 @@ require 'helpers/elasticsearch_options' require 'helpers/loggable_try' require "license_checker/licensed" - module LogStash module ConfigManagement class ElasticsearchSource < LogStash::Config::Source::Base @@ -316,6 +315,5 @@ module LogStash end end end - end end diff --git a/x-pack/lib/config_management/hooks.rb b/x-pack/lib/config_management/hooks.rb index 17de6bab5..d09e3af2b 100644 --- a/x-pack/lib/config_management/hooks.rb +++ b/x-pack/lib/config_management/hooks.rb @@ -9,7 +9,6 @@ require "logstash/config/source/local" require "logstash/config/source/multi_local" require "logstash/config/source/modules" - module LogStash module ConfigManagement class Hooks diff --git a/x-pack/lib/filters/geoip/database_metadata.rb b/x-pack/lib/filters/geoip/database_metadata.rb index 3e037de05..62f6c3b19 100644 --- a/x-pack/lib/filters/geoip/database_metadata.rb +++ b/x-pack/lib/filters/geoip/database_metadata.rb @@ -105,5 +105,4 @@ module LogStash module Filters module Geoip class DatabaseMetadata DIRNAME = 3 IS_EULA = 4 end - end end end end diff --git a/x-pack/lib/filters/geoip/database_metric.rb b/x-pack/lib/filters/geoip/database_metric.rb index 6a720095f..73f3f320a 100644 --- a/x-pack/lib/filters/geoip/database_metric.rb +++ b/x-pack/lib/filters/geoip/database_metric.rb @@ -70,5 +70,4 @@ module LogStash module Filters module Geoip class DatabaseMetric n.gauge(:fail_check_in_days, days_without_update) end end - end end end end diff --git a/x-pack/lib/filters/geoip/download_manager.rb b/x-pack/lib/filters/geoip/download_manager.rb index 4c8e7febf..7d4b437e1 100644 --- a/x-pack/lib/filters/geoip/download_manager.rb +++ b/x-pack/lib/filters/geoip/download_manager.rb @@ -150,5 +150,4 @@ module LogStash module Filters module Geoip class DownloadManager download_uri.path = "/#{url}" download_uri.to_s end - end end end end diff --git a/x-pack/lib/helpers/elasticsearch_options.rb b/x-pack/lib/helpers/elasticsearch_options.rb index 5f6c5e5a2..1cbd89a79 100644 --- a/x-pack/lib/helpers/elasticsearch_options.rb +++ b/x-pack/lib/helpers/elasticsearch_options.rb @@ -155,7 +155,6 @@ module LogStash module Helpers opts end - # Determine whether only modules have been configured, and not monitoring # @param String feature to be checked # @param Logstash::Settings Logstash settings diff --git a/x-pack/lib/license_checker/license_manager.rb b/x-pack/lib/license_checker/license_manager.rb index 1cfc43e39..2377ef7d1 100644 --- a/x-pack/lib/license_checker/license_manager.rb +++ b/x-pack/lib/license_checker/license_manager.rb @@ -10,7 +10,6 @@ java_import java.util.concurrent.TimeUnit module LogStash module LicenseChecker - class LicenseError < StandardError; end class LicenseManager diff --git a/x-pack/lib/license_checker/licensed.rb b/x-pack/lib/license_checker/licensed.rb index e9ed04a7e..5f3bb005a 100644 --- a/x-pack/lib/license_checker/licensed.rb +++ b/x-pack/lib/license_checker/licensed.rb @@ -8,7 +8,6 @@ require 'license_checker/x_pack_info' require 'license_checker/license_reader' java_import java.util.concurrent.TimeUnit - # Mixin to add License Checking functionality to a feature: # To add license checking: # - Include the Licensed mixin to the class under license @@ -84,7 +83,6 @@ module LogStash def get_current_license_state @license_state.dup end - end end end diff --git a/x-pack/lib/monitoring/inputs/metrics.rb b/x-pack/lib/monitoring/inputs/metrics.rb index fffa14457..3b8202835 100644 --- a/x-pack/lib/monitoring/inputs/metrics.rb +++ b/x-pack/lib/monitoring/inputs/metrics.rb @@ -2,7 +2,6 @@ # or more contributor license agreements. Licensed under the Elastic License; # you may not use this file except in compliance with the Elastic License. - require "logstash/inputs/base" require "logstash/instrument/collector" require 'helpers/elasticsearch_options' diff --git a/x-pack/lib/monitoring/monitoring.rb b/x-pack/lib/monitoring/monitoring.rb index 293f1b4c4..e06b5f129 100644 --- a/x-pack/lib/monitoring/monitoring.rb +++ b/x-pack/lib/monitoring/monitoring.rb @@ -45,7 +45,6 @@ module LogStash @ssl_key = es_settings['ssl_key'] @ssl_cipher_suites = es_settings['ssl_cipher_suites'] @sniffing = es_settings['sniffing'] - end attr_accessor :system_api_version, :es_hosts, :user, :password, :node_uuid, :cloud_id, :cloud_auth, :api_key @@ -136,7 +135,6 @@ module LogStash end def after_agent(runner) - return unless monitoring_enabled?(runner.settings) deprecation_logger.deprecated( diff --git a/x-pack/qa/integration/management/multiple_pipelines_spec.rb b/x-pack/qa/integration/management/multiple_pipelines_spec.rb index a9c885f70..0511da0bf 100644 --- a/x-pack/qa/integration/management/multiple_pipelines_spec.rb +++ b/x-pack/qa/integration/management/multiple_pipelines_spec.rb @@ -74,7 +74,6 @@ describe "Read configuration from elasticsearch" do count_hashes(@pipelines.keys) end.to eq(2) - pipelines = { "super_generator" => "input { generator { count => 100 } tcp { port => 6005 } } output { file { path => '#{@temporary_directory}/super_generator_new' }}", "another_generator" => "input { generator { count => 100 } tcp { port => 6006 } } output { file { path => '#{@temporary_directory}/another_generator_new' }}" @@ -157,7 +156,6 @@ describe "Read configuration from elasticsearch" do end end - it "reloads the configuration when its different from the running pipeline" do pipelines = { "super_generator" => "input { generator { count => 100 } tcp { port => 6005 } } output { file { path => '#{@temporary_directory}/super_generator_new' }}", diff --git a/x-pack/qa/integration/monitoring/direct_shipping_spec.rb b/x-pack/qa/integration/monitoring/direct_shipping_spec.rb index 336592423..bded6b361 100644 --- a/x-pack/qa/integration/monitoring/direct_shipping_spec.rb +++ b/x-pack/qa/integration/monitoring/direct_shipping_spec.rb @@ -6,7 +6,6 @@ require_relative "../spec_helper" require 'securerandom' describe "Direct shipping" do - before :all do @elasticsearch_service = elasticsearch diff --git a/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb b/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb index 782e1ecef..9b3c31057 100644 --- a/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb +++ b/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb @@ -5,7 +5,6 @@ require_relative "../spec_helper" describe "Monitoring internal collector documents" do - before :all do @elasticsearch_service = elasticsearch diff --git a/x-pack/qa/integration/support/elasticsearch/api/actions/update_password.rb b/x-pack/qa/integration/support/elasticsearch/api/actions/update_password.rb index 96a556988..e8cc3e823 100644 --- a/x-pack/qa/integration/support/elasticsearch/api/actions/update_password.rb +++ b/x-pack/qa/integration/support/elasticsearch/api/actions/update_password.rb @@ -5,7 +5,6 @@ module Elasticsearch module API module Actions - # Update the password of the specified user def update_password(arguments={}) method = HTTP_PUT diff --git a/x-pack/qa/integration/support/helpers.rb b/x-pack/qa/integration/support/helpers.rb index a450ca7b1..f4b4af8e5 100644 --- a/x-pack/qa/integration/support/helpers.rb +++ b/x-pack/qa/integration/support/helpers.rb @@ -85,7 +85,6 @@ def bootstrap_password_exists? response.successful? && response.stdout_lines.any? { |line| line =~ /^bootstrap.password$/ } end - def elasticsearch_xpack_installed? cmd = "bin/elasticsearch-plugin list" response = Belzebuth.run(cmd, { :directory => get_elasticsearch_path }) diff --git a/x-pack/spec/config_management/bootstrap_check_spec.rb b/x-pack/spec/config_management/bootstrap_check_spec.rb index ba0ea22cb..681b9bc6a 100644 --- a/x-pack/spec/config_management/bootstrap_check_spec.rb +++ b/x-pack/spec/config_management/bootstrap_check_spec.rb @@ -43,7 +43,6 @@ describe LogStash::ConfigManagement::BootstrapCheck do .to change { settings.get_value("config.reload.interval").to_nanos }.to(interval * 1_000_000_000) end - context "when `config.string` is given" do let(:settings) do apply_settings( diff --git a/x-pack/spec/config_management/elasticsearch_source_spec.rb b/x-pack/spec/config_management/elasticsearch_source_spec.rb index 3245b2389..55083b064 100644 --- a/x-pack/spec/config_management/elasticsearch_source_spec.rb +++ b/x-pack/spec/config_management/elasticsearch_source_spec.rb @@ -612,7 +612,6 @@ describe LogStash::ConfigManagement::ElasticsearchSource do end end - context "With an invalid basic license, it should raise an error [#{es_version}]" do let(:license_type) { 'basic' } @@ -709,7 +708,6 @@ describe LogStash::ConfigManagement::ElasticsearchSource do expect { subject.pipeline_configs }.to raise_error LogStash::ConfigManagement::ElasticsearchSource::RemoteConfigError end end - } end @@ -740,14 +738,12 @@ describe LogStash::ConfigManagement::ElasticsearchSource do expect { subject.pipeline_configs }.to raise_error /Something bad/ end - it "raises the exception upstream in [7.9]" do allow(mock_client).to receive(:get).with("/").and_return(es_version_7_9_response) expect(mock_client).to receive(:post).with(es_path, {}, request_body_string).and_raise("Something bad") expect { subject.pipeline_configs }.to raise_error /Something bad/ end end - end describe "#get_es_version" do diff --git a/x-pack/spec/filters/geoip/database_manager_spec.rb b/x-pack/spec/filters/geoip/database_manager_spec.rb index c850f73a0..e39014aa1 100644 --- a/x-pack/spec/filters/geoip/database_manager_spec.rb +++ b/x-pack/spec/filters/geoip/database_manager_spec.rb @@ -7,7 +7,6 @@ require "filters/geoip/database_manager" require "filters/geoip/database_metric" describe LogStash::Filters::Geoip do - describe 'DatabaseManager', :aggregate_failures do let(:mock_geoip_plugin) { double("geoip_plugin") } let(:mock_metadata) { double("database_metadata") } @@ -329,7 +328,6 @@ describe LogStash::Filters::Geoip do let(:asn02) { get_file_path(dirname2, default_asn_db_name) } let(:city02) { get_file_path(dirname2, default_city_db_name) } - before(:each) do FileUtils.mkdir_p [dir_path, dir_path2] end diff --git a/x-pack/spec/filters/geoip/database_metadata_spec.rb b/x-pack/spec/filters/geoip/database_metadata_spec.rb index ec6a75f6d..ab168382e 100644 --- a/x-pack/spec/filters/geoip/database_metadata_spec.rb +++ b/x-pack/spec/filters/geoip/database_metadata_spec.rb @@ -9,7 +9,6 @@ require "stud/temporary" require "fileutils" describe LogStash::Filters::Geoip do - describe 'DatabaseMetadata', :aggregate_failures do let(:database_type) { LogStash::Filters::Geoip::CITY } let(:dbm) do diff --git a/x-pack/spec/filters/geoip/download_manager_spec.rb b/x-pack/spec/filters/geoip/download_manager_spec.rb index a245eb847..487916e83 100644 --- a/x-pack/spec/filters/geoip/download_manager_spec.rb +++ b/x-pack/spec/filters/geoip/download_manager_spec.rb @@ -8,7 +8,6 @@ require "filters/geoip/download_manager" require "filters/geoip/database_manager" describe LogStash::Filters::Geoip do - describe 'DownloadManager', :aggregate_failures do let(:mock_metadata) { double("database_metadata") } let(:download_manager) do @@ -27,7 +26,6 @@ describe LogStash::Filters::Geoip do # this is disabled until https://github.com/elastic/logstash/issues/13261 is solved context "rest client" do - it "can call endpoint" do conn = download_manager.send(:rest_client) res = conn.get("#{GEOIP_STAGING_ENDPOINT}?key=#{SecureRandom.uuid}&elastic_geoip_service_tos=agree") @@ -92,7 +90,6 @@ describe LogStash::Filters::Geoip do updated_db = download_manager.send(:check_update) expect(updated_db.size).to eql(0) end - end context "download database" do diff --git a/x-pack/spec/helpers/elasticsearch_options_spec.rb b/x-pack/spec/helpers/elasticsearch_options_spec.rb index 1b42c6fdf..73333c68c 100644 --- a/x-pack/spec/helpers/elasticsearch_options_spec.rb +++ b/x-pack/spec/helpers/elasticsearch_options_spec.rb @@ -168,7 +168,6 @@ describe LogStash::Helpers::ElasticsearchOptions do end describe "es_options_from_settings" do - context "with implicit username" do let(:settings) do { @@ -202,7 +201,6 @@ describe LogStash::Helpers::ElasticsearchOptions do end end - context "with api_key" do let(:settings) do super().merge( @@ -292,7 +290,6 @@ describe LogStash::Helpers::ElasticsearchOptions do it_behaves_like 'elasticsearch options hash is populated with secure options' end - context 'when cloud_id' do let(:cloud_name) { 'thebigone'} let(:cloud_domain) { 'elastic.co'} @@ -521,7 +518,6 @@ describe LogStash::Helpers::ElasticsearchOptions do it_behaves_like 'elasticsearch options hash is populated without security' end - context 'when everything is set' do let(:cloud_name) { 'thebigone'} let(:cloud_domain) { 'elastic.co'} diff --git a/x-pack/spec/license_checker/license_info_spec.rb b/x-pack/spec/license_checker/license_info_spec.rb index 6c0a31e97..8d2009bcf 100644 --- a/x-pack/spec/license_checker/license_info_spec.rb +++ b/x-pack/spec/license_checker/license_info_spec.rb @@ -9,6 +9,7 @@ require 'monitoring/monitoring' class Observer attr_reader :license + def initialize @license = nil end @@ -47,7 +48,6 @@ describe LogStash::LicenseChecker::XPackInfo do } end - let(:license) do { "status" => status, @@ -87,7 +87,6 @@ describe LogStash::LicenseChecker::XPackInfo do end end - context "when the license type is valid" do context 'the license has expired' do let(:expiry_date) { Time.now - ONE_HOUR } diff --git a/x-pack/spec/modules/arcsight/arcsight_module_config_helper_spec.rb b/x-pack/spec/modules/arcsight/arcsight_module_config_helper_spec.rb index 4f84f97ac..2d4d45494 100644 --- a/x-pack/spec/modules/arcsight/arcsight_module_config_helper_spec.rb +++ b/x-pack/spec/modules/arcsight/arcsight_module_config_helper_spec.rb @@ -10,7 +10,6 @@ require 'logstash/modules/scaffold' require 'arcsight_module_config_helper' describe LogStash::Arcsight::ConfigHelper do - let(:sample_yaml_folder) { ::File.join(File.dirname(__FILE__), "yaml") } let(:settings) { settings = LogStash::SETTINGS.clone } let(:module_name) { "arcsight" } diff --git a/x-pack/spec/modules/azure/azure_module_config_generator_spec.rb b/x-pack/spec/modules/azure/azure_module_config_generator_spec.rb index dc4890506..7bd3fb6d8 100644 --- a/x-pack/spec/modules/azure/azure_module_config_generator_spec.rb +++ b/x-pack/spec/modules/azure/azure_module_config_generator_spec.rb @@ -10,7 +10,6 @@ require 'logstash/modules/scaffold' require 'azure_module_config_generator' describe LogStash::Azure::ConfigGenerator do - # always clone and work with the clone since settings are global and can bleed between tests let(:settings) {settings = LogStash::SETTINGS.clone} @@ -140,7 +139,5 @@ event_hub_connections => ["Endpoint=sb://example1...EntityPath=insights-logs-err module_config = LogStash::Modules::LogStashConfig.new(scaffolding, module_hash) expect {module_config.config_string}.to raise_error(/'var.input.azure_event_hubs.event_hub_connections' must be set./) end - end - end diff --git a/x-pack/spec/modules/azure/filters/azure_event_spec.rb b/x-pack/spec/modules/azure/filters/azure_event_spec.rb index fa739118c..fbdb12e2b 100644 --- a/x-pack/spec/modules/azure/filters/azure_event_spec.rb +++ b/x-pack/spec/modules/azure/filters/azure_event_spec.rb @@ -45,7 +45,6 @@ describe LogStash::Filters::AzureEvent do expect(subject).not_to include("properties") end - describe "with default" do let(:config) do <<-CONFIG @@ -71,7 +70,6 @@ describe LogStash::Filters::AzureEvent do expect(subject).not_to include("properties") end - # as observed, missing the resource group, type, and name file = File.read(File.join(File.dirname(__FILE__), '../samples/activity_log/administrative3.json')) sample_one(LogStash::Json.load(file)) do @@ -87,7 +85,6 @@ describe LogStash::Filters::AzureEvent do expect(subject).not_to include("properties") end end - end describe "Parses the service health activity log" do @@ -212,7 +209,6 @@ describe LogStash::Filters::AzureEvent do expect(subject).to include("activity_log_Autoscale_properties") expect(subject).not_to include("properties") end - end describe "Parses the Alert activity log" do @@ -256,7 +252,6 @@ describe LogStash::Filters::AzureEvent do expect(subject).to include("activity_log_Alert_properties") expect(subject).not_to include("properties") end - end describe "Parses database wait stats logs" do @@ -289,9 +284,7 @@ describe LogStash::Filters::AzureEvent do expect(subject.get("[azure][category]")).to eq("DatabaseWaitStatistics") expect(subject).to include("sql_diagnostics_DatabaseWaitStatistics_properties") expect(subject).not_to include("properties") - end - end describe "Parses database block logs" do let(:config) do @@ -500,5 +493,4 @@ describe LogStash::Filters::AzureEvent do expect(subject.get("[tags][0]")).to eq("_azure_event_failure") end end - end diff --git a/x-pack/spec/modules/module_license_checker_spec.rb b/x-pack/spec/modules/module_license_checker_spec.rb index f9e6b35ff..55e1446a1 100644 --- a/x-pack/spec/modules/module_license_checker_spec.rb +++ b/x-pack/spec/modules/module_license_checker_spec.rb @@ -7,18 +7,14 @@ require "logstash/modules/settings_merger" require 'license_checker/x_pack_info' describe LogStash::LicenseChecker::ModuleLicenseChecker do - let(:license_types) { LogStash::LicenseChecker::LICENSE_TYPES } let(:settings) { LogStash::Runner::SYSTEM_SETTINGS } - shared_examples "can not get a license" do - before(:each) { expect(subject).to receive(:license_reader).and_return(mock_reader) expect(mock_reader).to receive(:fetch_xpack_info).and_return(LogStash::LicenseChecker::XPackInfo.failed_to_fetch) - } let(:mock_reader) {double("reader")} @@ -113,5 +109,4 @@ describe LogStash::LicenseChecker::ModuleLicenseChecker do end include_examples "can not get a license" end - end diff --git a/x-pack/spec/monitoring/inputs/metrics/state_event_factory_spec.rb b/x-pack/spec/monitoring/inputs/metrics/state_event_factory_spec.rb index 4a3ed5720..f79dcc8e0 100644 --- a/x-pack/spec/monitoring/inputs/metrics/state_event_factory_spec.rb +++ b/x-pack/spec/monitoring/inputs/metrics/state_event_factory_spec.rb @@ -9,7 +9,6 @@ require "monitoring/inputs/metrics/state_event_factory" require 'json' describe LogStash::Inputs::Metrics::StateEventFactory do - let(:schemas_path) { File.join(File.dirname(__FILE__), "..", "..", "..", "..", "spec", "monitoring", "schemas") } let(:config) { diff --git a/x-pack/spec/monitoring/inputs/metrics_spec.rb b/x-pack/spec/monitoring/inputs/metrics_spec.rb index 65d7aecd1..4f669cf4c 100644 --- a/x-pack/spec/monitoring/inputs/metrics_spec.rb +++ b/x-pack/spec/monitoring/inputs/metrics_spec.rb @@ -20,7 +20,6 @@ describe LogStash::Inputs::Metrics do let(:elasticsearch_username) { nil } let(:elasticsearch_password) { nil } - subject(:metrics_input) { described_class.new(options) } let(:settings) do { @@ -40,7 +39,6 @@ describe LogStash::Inputs::Metrics do end context "integration" do - let(:schemas_path) { File.join(File.dirname(__FILE__), "..", "..", "..", "spec", "monitoring", "schemas") } let(:queue) { Concurrent::Array.new } @@ -71,7 +69,6 @@ describe LogStash::Inputs::Metrics do end context "with pipeline execution" do - before :each do allow(metrics_input).to receive(:fetch_global_stats).and_return({"uuid" => "00001" }) allow(metrics_input).to receive(:exec_timer_task) diff --git a/x-pack/spec/monitoring/internal_pipeline_source_spec.rb b/x-pack/spec/monitoring/internal_pipeline_source_spec.rb index 4a23e9f9c..2689f23a4 100644 --- a/x-pack/spec/monitoring/internal_pipeline_source_spec.rb +++ b/x-pack/spec/monitoring/internal_pipeline_source_spec.rb @@ -15,7 +15,6 @@ require "json-schema" require 'license_checker/x_pack_info' require 'monitoring/monitoring' - describe LogStash::Monitoring::InternalPipelineSource do context 'license testing' do let(:xpack_monitoring_interval) { 1 } diff --git a/x-pack/spec/monitoring/pipeline_register_hook_spec.rb b/x-pack/spec/monitoring/pipeline_register_hook_spec.rb index 7b71e053f..98723413e 100644 --- a/x-pack/spec/monitoring/pipeline_register_hook_spec.rb +++ b/x-pack/spec/monitoring/pipeline_register_hook_spec.rb @@ -5,7 +5,6 @@ require 'monitoring/monitoring' describe LogStash::MonitoringExtension::PipelineRegisterHook do - subject(:monitoring_extension) { described_class.new } let(:settings) {