From 2f67ff61e83edd733c2ed3fcdb486046dfee2f0d Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Tue, 28 May 2024 09:59:58 +0200 Subject: [PATCH 1/5] Remove end of live Rails 6.0 --- .github/workflows/spec.yml | 2 +- gemfiles/Gemfile.rails-6.0.x | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 gemfiles/Gemfile.rails-6.0.x diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index ee10825..10553c6 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: ruby: [ '3.0', '3.1', '3.2', 'head' ] - rails: [ 'gemfiles/Gemfile.rails-6.0.x', 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-7.0.x'] + rails: [ 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-7.0.x'] exclude: [] continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} env: diff --git a/gemfiles/Gemfile.rails-6.0.x b/gemfiles/Gemfile.rails-6.0.x deleted file mode 100644 index f0549fd..0000000 --- a/gemfiles/Gemfile.rails-6.0.x +++ /dev/null @@ -1,9 +0,0 @@ -source "https://rubygems.org" - -gem 'actionpack', '~> 6.0.0' -gem 'activesupport', '~> 6.0.0' -gem 'activemodel', '~> 6.0.0' -gem 'sqlite3', '~> 1.4' -gem 'rspec-rails' - -gemspec :path => '../' From b1d583336dc7eaaa98b786ef755edc6d20105a32 Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Tue, 28 May 2024 10:00:03 +0200 Subject: [PATCH 2/5] Test with Rails 7.1 --- .github/workflows/spec.yml | 2 +- gemfiles/Gemfile.rails-7.1.x | 9 +++++++++ spec/requests/active_record_sql_metrics_spec.rb | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 gemfiles/Gemfile.rails-7.1.x diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 10553c6..976e346 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: ruby: [ '3.0', '3.1', '3.2', 'head' ] - rails: [ 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-7.0.x'] + rails: [ 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-7.0.x', 'gemfiles/Gemfile.rails-7.1.x'] exclude: [] continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} env: diff --git a/gemfiles/Gemfile.rails-7.1.x b/gemfiles/Gemfile.rails-7.1.x new file mode 100644 index 0000000..d81176c --- /dev/null +++ b/gemfiles/Gemfile.rails-7.1.x @@ -0,0 +1,9 @@ +source "https://rubygems.org" + +gem 'actionpack', '~> 7.1.0' +gem 'activesupport', '~> 7.1.0' +gem 'activemodel', '~> 7.1.0' +gem 'sqlite3', '~> 1.4' +gem 'rspec-rails' + +gemspec :path => '../' diff --git a/spec/requests/active_record_sql_metrics_spec.rb b/spec/requests/active_record_sql_metrics_spec.rb index 2ed0c4d..031fe6b 100644 --- a/spec/requests/active_record_sql_metrics_spec.rb +++ b/spec/requests/active_record_sql_metrics_spec.rb @@ -29,7 +29,7 @@ additional_field: :value, request_id: :request_id, value: be_between(1, 500), - sql: "INSERT INTO \"metrics\" (\"name\", \"created_at\", \"updated_at\") VALUES (xxx)" + sql: /^INSERT INTO "metrics" \("name", "created_at", "updated_at"\) VALUES \(xxx\)( RETURNING "id")?$/ ) ) end From 46a2b4a423ce689191952ff4fcf664b91cfed413 Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Tue, 28 May 2024 10:00:06 +0200 Subject: [PATCH 3/5] Don't test Ruby 3.0. Test Ruby 3.1 --- .github/workflows/rubocop.yml | 2 +- .github/workflows/spec.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 8e99cae..717109b 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -13,6 +13,6 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0 + ruby-version: 3.1 bundler-cache: true - run: bundle exec rake rubocop diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 976e346..411e259 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: [ '3.0', '3.1', '3.2', 'head' ] + ruby: [ '3.1', '3.2', 'head' ] rails: [ 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-7.0.x', 'gemfiles/Gemfile.rails-7.1.x'] exclude: [] continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} From 76089982172777fe4b89a192492c09a117658566 Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Tue, 28 May 2024 10:00:23 +0200 Subject: [PATCH 4/5] Remove tests for Rails versions less or equal to 5.1 --- .../active_record_sql_metrics_spec.rb | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/spec/requests/active_record_sql_metrics_spec.rb b/spec/requests/active_record_sql_metrics_spec.rb index 031fe6b..f9c2510 100644 --- a/spec/requests/active_record_sql_metrics_spec.rb +++ b/spec/requests/active_record_sql_metrics_spec.rb @@ -14,8 +14,6 @@ end it "writes metric" do - skip("https://github.com/rails/rails/issues/30586") unless payload_names_fixed_in_rails? - get "/metrics" expect_metric( @@ -34,27 +32,6 @@ ) end - it "writes metric" do - skip("https://github.com/rails/rails/issues/30586") if payload_names_fixed_in_rails? - - get "/metrics" - - expect_metric( - tags: a_hash_including( - hook: "sql", - name: "SQL", - class_name: "SQL", - operation: "INSERT" - ), - fields: a_hash_including( - additional_field: :value, - request_id: :request_id, - value: be_between(1, 500), - sql: "INSERT INTO \"metrics\" (\"name\", \"created_at\", \"updated_at\") VALUES (xxx)" - ) - ) - end - it "includes correct timestamps" do travel_to Time.zone.local(2018, 1, 1, 9, 0, 0) @@ -80,14 +57,4 @@ ) ) end - - def payload_names_fixed_in_rails? - Rails::VERSION::MAJOR > 5 || - rails_after_5_1? - end - - def rails_after_5_1? - Rails::VERSION::MAJOR == 5 && - Rails::VERSION::MINOR > 1 - end end From c18ff3e3345300253630d6e90a6e7455c3a90cbd Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Tue, 28 May 2024 11:28:20 +0200 Subject: [PATCH 5/5] Test with Ruby 3.3 --- .github/workflows/spec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 411e259..1dfd6d4 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: [ '3.1', '3.2', 'head' ] + ruby: [ '3.1', '3.2', '3.3', 'head' ] rails: [ 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-7.0.x', 'gemfiles/Gemfile.rails-7.1.x'] exclude: [] continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}