diff --git a/.rubocop.yml b/.rubocop.yml index 23c3ac2..6aa5134 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -58,6 +58,9 @@ Style/SymbolArray: Metrics/AbcSize: Enabled: false +Metrics/ClassLength: + Enabled: false + Metrics/BlockLength: Exclude: - Rakefile diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 935d48e..77d0b6d 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -1,13 +1,13 @@ PATH remote: ../../../.. specs: - appsignal (3.0.15) + appsignal (3.9.2) rack GEM remote: https://rubygems.org/ specs: - rack (2.2.3) + rack (3.1.5) PLATFORMS ruby diff --git a/spec/diagnose_spec.rb b/spec/diagnose_spec.rb index 03da9d8..0b4b725 100644 --- a/spec/diagnose_spec.rb +++ b/spec/diagnose_spec.rb @@ -377,7 +377,7 @@ / activejob_report_errors: "all"/, %r{ ca_file_path: ".+/appsignal[-/]ruby/resources/cacert.pem"}, / debug: false/, - / dns_servers: \[\]/, + " dns_servers: []", / enable_allocation_tracking: true/, / enable_gvl_global_timer: true/, / enable_gvl_waiting_threads: true/, @@ -472,7 +472,7 @@ / system: true/, / ca_file_path: #{quoted ".+/_build/dev/rel/elixir_diagnose/lib/appsignal-\\d+\\.\\d+\\.\\d+(-\\w+\\.\\d+)?/priv/cacert.pem"}/, # rubocop:disable Layout/LineLength / debug: false/, - / dns_servers: \[\]/, + " dns_servers: []", / enable_error_backend: true/, / enable_host_metrics: true/, / enable_minutely_probes: false/, diff --git a/spec/support/runner.rb b/spec/support/runner.rb index 8865988..652fbe3 100644 --- a/spec/support/runner.rb +++ b/spec/support/runner.rb @@ -91,7 +91,11 @@ def install_report? end def run_env - { "APPSIGNAL_PUSH_API_KEY" => @push_api_key } + { + "APPSIGNAL_PUSH_API_KEY" => @push_api_key, + "APPSIGNAL_PUSH_API_ENDPOINT" => ENV["APPSIGNAL_PUSH_API_ENDPOINT"], + "APPSIGNAL_DIAGNOSE_ENDPOINT" => ENV["APPSIGNAL_DIAGNOSE_ENDPOINT"] + } end def run_command(_arguments) @@ -99,23 +103,29 @@ def run_command(_arguments) end def run # rubocop:disable Metrics/MethodLength - Dir.chdir directory do - before_setup - setup_commands.each do |command| - run_setup command + Bundler.with_unbundled_env do + Dir.chdir directory do + before_setup + setup_commands.each do |command| + run_setup command + end + after_setup end - after_setup end # Run the command prompt = @prompt ? %(echo "#{@prompt}" | ) : "" command = run_command(@arguments.dup) read, write = IO.pipe - pid = spawn( - run_env, - "#{prompt} #{command}", - { [:out, :err] => write, :chdir => directory } - ) + env = run_env + pid = + Bundler.with_unbundled_env do + spawn( + env, + "#{prompt} #{command}", + { [:out, :err] => write, :chdir => directory } + ) + end _pid, status = Process.wait2 pid # Wait until command exits write.close @@ -191,6 +201,13 @@ def directory File.join(project_path, "ruby") end + def setup_commands + [ + "bundle config set --local gemfile #{directory}/Gemfile", + "bundle install" + ] + end + def run_env super.merge({ "BUNDLE_GEMFILE" => File.join(directory, "Gemfile") @@ -205,7 +222,8 @@ def run_command(arguments) def ignored_lines [ - /appsignal: Unable to log to / + /appsignal: Unable to log to /, + /Calling `DidYouMean::SPELL_CHECKERS/ ] end @@ -270,7 +288,7 @@ def install_report end end - class Elixir < Runner # rubocop:disable Metrics/ClassLength + class Elixir < Runner def directory File.join(project_path, "elixir") end