From c7bd57d4129d96dfb731fe2e6270792b0b574035 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 24 Jan 2024 16:53:32 +0000 Subject: [PATCH 1/6] Update test dependencies The dependecies we test against are locked in Gemfile.lock Just bumping these so we test against the latest things. --- Gemfile.lock | 271 ++++++++++++++++++++++++++++----------------------- 1 file changed, 151 insertions(+), 120 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 001f906..82753bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,90 +10,108 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + actioncable (7.1.3) + actionpack (= 7.1.3) + activesupport (= 7.1.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + zeitwerk (~> 2.6) + actionmailbox (7.1.3) + actionpack (= 7.1.3) + activejob (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.6) - actionpack (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activesupport (= 7.0.6) + actionmailer (7.1.3) + actionpack (= 7.1.3) + actionview (= 7.1.3) + activejob (= 7.1.3) + activesupport (= 7.1.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.6) - actionview (= 7.0.6) - activesupport (= 7.0.6) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.3) + actionview (= 7.1.3) + activesupport (= 7.1.3) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.6) - actionpack (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.3) + actionpack (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.6) - activesupport (= 7.0.6) + actionview (7.1.3) + activesupport (= 7.1.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.6) - activesupport (= 7.0.6) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.3) + activesupport (= 7.1.3) globalid (>= 0.3.6) - activemodel (7.0.6) - activesupport (= 7.0.6) - activerecord (7.0.6) - activemodel (= 7.0.6) - activesupport (= 7.0.6) - activestorage (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activesupport (= 7.0.6) + activemodel (7.1.3) + activesupport (= 7.1.3) + activerecord (7.1.3) + activemodel (= 7.1.3) + activesupport (= 7.1.3) + timeout (>= 0.4.0) + activestorage (7.1.3) + actionpack (= 7.1.3) + activejob (= 7.1.3) + activerecord (= 7.1.3) + activesupport (= 7.1.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.6) + activesupport (7.1.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.6) builder (3.2.4) byebug (11.1.3) climate_control (1.2.0) codecov (0.6.0) simplecov (>= 0.15, < 0.22) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) crass (1.0.6) - date (3.3.3) - diff-lcs (1.5.0) + date (3.3.4) + diff-lcs (1.5.1) docile (1.4.0) + drb (2.2.0) + ruby2_keywords erubi (1.12.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) i18n (1.14.1) concurrent-ruby (~> 1.0) - json (2.6.3) + io-console (0.7.2) + irb (1.11.2) + rdoc + reline (>= 0.4.2) + json (2.7.1) language_server-protocol (3.17.0.3) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -102,78 +120,88 @@ GEM net-pop net-smtp marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - mini_portile2 (2.8.4) - minitest (5.18.1) - net-imap (0.3.6) + mini_mime (1.1.5) + minitest (5.22.2) + mutex_m (0.2.0) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.4.0.1) net-protocol - nio4r (2.5.9) - nokogiri (1.15.3) - mini_portile2 (~> 2.8.2) + nio4r (2.7.0) + nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc - prometheus-client-mmap (1.1.1) + prometheus-client-mmap (1.1.1-arm64-darwin) rb_sys (~> 0.9.86) - racc (1.7.1) - rack (2.2.7) + psych (5.1.2) + stringio + racc (1.7.3) + rack (3.0.9) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.6) - actioncable (= 7.0.6) - actionmailbox (= 7.0.6) - actionmailer (= 7.0.6) - actionpack (= 7.0.6) - actiontext (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activemodel (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.1.3) + actioncable (= 7.1.3) + actionmailbox (= 7.1.3) + actionmailer (= 7.1.3) + actionpack (= 7.1.3) + actiontext (= 7.1.3) + actionview (= 7.1.3) + activejob (= 7.1.3) + activemodel (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) bundler (>= 1.15.0) - railties (= 7.0.6) - rails-dom-testing (2.1.1) + railties (= 7.1.3) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) - method_source + railties (7.1.3) + actionpack (= 7.1.3) + activesupport (= 7.1.3) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rb_sys (0.9.87) - regexp_parser (2.8.1) - rexml (3.2.5) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rdoc (6.6.2) + psych (>= 4.0.0) + regexp_parser (2.9.0) + reline (0.4.2) + io-console (~> 0.5) + rexml (3.2.6) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) + rspec-support (~> 3.13.0) rspec-rails (5.1.2) actionpack (>= 5.2) activesupport (>= 5.2) @@ -182,55 +210,58 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.12.1) - rubocop (1.54.2) + rspec-support (3.13.0) + rubocop (1.60.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) + rubocop-capybara (2.20.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.25.1) rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) - rubocop (~> 1.33) - rubocop-performance (1.18.0) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.22.0) - rubocop (~> 1.33) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rspec (2.26.1) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - thor (1.2.2) - timeout (0.4.0) + stringio (3.1.0) + thor (1.3.0) + timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) webrick (1.8.1) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.8) + zeitwerk (2.6.13) PLATFORMS - ruby + arm64-darwin-22 DEPENDENCIES bundler (~> 2.0) From 698d1443ed60c4cd4a139391d605b6eab5e4b79c Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 24 Jan 2024 16:57:15 +0000 Subject: [PATCH 2/6] Add dependency on "rackup" Webrick support was removed from rack to this gem! --- Gemfile.lock | 1 + exe/promenade | 5 +++-- promenade.gemspec | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 82753bf..cdea2a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,6 +6,7 @@ PATH activesupport (> 6.0, < 8.0) prometheus-client-mmap (~> 1.1) rack + rackup GEM remote: https://rubygems.org/ diff --git a/exe/promenade b/exe/promenade index 8c4431d..7d8455b 100755 --- a/exe/promenade +++ b/exe/promenade @@ -2,6 +2,7 @@ require "promenade" require "rack" +require "rackup" require "prometheus/client/rack/exporter" Promenade.setup @@ -15,6 +16,6 @@ app = Rack::Builder.app do run ->(_env) { [404, {}, ["visit /metrics for metrics"]] } end -Signal.trap("TERM") { Rack::Handler::WEBrick.shutdown } +Signal.trap("TERM") { Rackup::Handler::WEBrick.shutdown } -Rack::Handler::WEBrick.run app, Port: ENV.fetch("PORT", "9394"), Host: "0.0.0.0" +Rackup::Handler::WEBrick.run app, Port: ENV.fetch("PORT", "9394"), Host: "0.0.0.0" diff --git a/promenade.gemspec b/promenade.gemspec index cc04729..0880bdd 100644 --- a/promenade.gemspec +++ b/promenade.gemspec @@ -28,6 +28,7 @@ Gem::Specification.new do |spec| spec.add_dependency "activesupport", "> 6.0", "< 8.0" spec.add_dependency "prometheus-client-mmap", "~> 1.1" spec.add_dependency "rack" + spec.add_dependency "rackup" spec.add_development_dependency "bundler", "~> 2.0" spec.add_development_dependency "byebug" spec.add_development_dependency "climate_control" From 99ceabb191dec582cf10b4a9931057f205005b50 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 24 Jan 2024 17:04:16 +0000 Subject: [PATCH 3/6] Fix deprication warnings thrown by the testsuite --- spec/dummy/config/environments/test.rb | 2 +- spec/integration/show_exceptions_middleware_spec.rb | 2 +- spec/promenade/client/rack/exception_handler_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 7c7b14a..2e698d7 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -23,7 +23,7 @@ config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + config.action_dispatch.show_exceptions = :none # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false diff --git a/spec/integration/show_exceptions_middleware_spec.rb b/spec/integration/show_exceptions_middleware_spec.rb index ab7a314..334e006 100644 --- a/spec/integration/show_exceptions_middleware_spec.rb +++ b/spec/integration/show_exceptions_middleware_spec.rb @@ -59,7 +59,7 @@ def enable_show_exceptions self.initial_env_config = Rails.application.env_config Rails.application.env_config.merge!( - "action_dispatch.show_exceptions" => true, + "action_dispatch.show_exceptions" => :all, "action_dispatch.show_detailed_exceptions" => false, "consider_all_requests_local" => false, ) diff --git a/spec/promenade/client/rack/exception_handler_spec.rb b/spec/promenade/client/rack/exception_handler_spec.rb index d098e88..0e08879 100644 --- a/spec/promenade/client/rack/exception_handler_spec.rb +++ b/spec/promenade/client/rack/exception_handler_spec.rb @@ -100,11 +100,11 @@ exception_counter = Prometheus::Client.registry.get(:http_exceptions_total) request_duration_seconds = 1.0 - expect(Proc.new do + expect do Promenade::Client::Rack::ExceptionHandler.call(exception, env_hash, request_duration_seconds) - end).to raise_error(exception_klass) + end.to raise_error(exception_klass) end end From 148699731ed9ccc045a46761925b9e59e48e4a13 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Fri, 9 Feb 2024 13:21:17 +0000 Subject: [PATCH 4/6] Bump required ruby version --- promenade.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/promenade.gemspec b/promenade.gemspec index 0880bdd..e78ec4b 100644 --- a/promenade.gemspec +++ b/promenade.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 3.0" spec.add_dependency "actionpack" spec.add_dependency "activesupport", "> 6.0", "< 8.0" From 55a97a80fb5dcf451a2a1e71ed0f9d75f603710d Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Fri, 9 Feb 2024 13:22:56 +0000 Subject: [PATCH 5/6] Add additional platforms to lockfile --- Gemfile.lock | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index cdea2a9..8db9db8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -134,14 +134,26 @@ GEM net-smtp (0.4.0.1) net-protocol nio4r (2.7.0) + nokogiri (1.16.2-arm-linux) + racc (~> 1.4) nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) + nokogiri (1.16.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-linux) + racc (~> 1.4) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) racc + prometheus-client-mmap (1.1.1) + rb_sys (~> 0.9.86) prometheus-client-mmap (1.1.1-arm64-darwin) rb_sys (~> 0.9.86) + prometheus-client-mmap (1.1.1-x86_64-darwin) + rb_sys (~> 0.9.86) + prometheus-client-mmap (1.1.1-x86_64-linux) + rb_sys (~> 0.9.86) psych (5.1.2) stringio racc (1.7.3) @@ -263,6 +275,9 @@ GEM PLATFORMS arm64-darwin-22 + arm64-linux + x86_64-darwin-22 + x86_64-linux DEPENDENCIES bundler (~> 2.0) From 239cdddc18a2d6e66744995fee166c73a98713e7 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Fri, 9 Feb 2024 13:25:10 +0000 Subject: [PATCH 6/6] Fix rubocop issues --- .rubocop.yml | 2 +- lib/promenade/client/rack/queue_time_duration.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3d493db..c01e605 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_from: - https://raw.githubusercontent.com/cookpad/guides/master/.rubocop.yml AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 NewCops: enable Exclude: - vendor/**/* diff --git a/lib/promenade/client/rack/queue_time_duration.rb b/lib/promenade/client/rack/queue_time_duration.rb index 5a3e922..b44dde4 100644 --- a/lib/promenade/client/rack/queue_time_duration.rb +++ b/lib/promenade/client/rack/queue_time_duration.rb @@ -6,7 +6,7 @@ class QueueTimeDuration QUEUE_START_HEADER = "HTTP_X_QUEUE_START".freeze - HEADER_VALUE_MATCHER = /^(?:t=)(?\d{10}(?:\.\d+))$/.freeze + HEADER_VALUE_MATCHER = /^(?:t=)(?\d{10}(?:\.\d+))$/ def initialize(env:, request_received_time:) @env = env